[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: make is setting exit code to 0 when gcc command fails
From: |
Reinier Post |
Subject: |
Re: make is setting exit code to 0 when gcc command fails |
Date: |
Tue, 10 Feb 2015 10:57:34 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon Feb 9 12:35:36 2015, address@hidden (Paul Smith) wrote:
> On Mon, 2015-02-09 at 16:19 +0000, David Aldrich wrote:
> > If I deliberately introduce a syntax error into one of my C files,
> > make calls gcc to build the file, as expected, and an error is
> > reported as text in bash. However, the exit code (checked using echo
> > $?) returns 0. If I run the gcc command from the bash command line,
> > the exit code is 1.
> >
> > Why might make return 0 instead of 1 in the case of this compiler
> > error?
Guess: you're checking it like this:
%.o: %.c
$(CC) -c -o $@ $<
@echo $?
That won't work: each line will use a separate shell invocation, unless
.ONESHELL:
is specified.
--
Reinier Post