help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Makefile not correctly rebuilding project


From: Greg Chicares
Subject: Re: Makefile not correctly rebuilding project
Date: Tue, 08 Jun 2010 01:33:07 +0000
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

On 2010-06-08 00:01Z, Alex Buell wrote:
> 
> %.d: %.c
>       $(CC) -MM $(CFLAGS) $< | $(SED) -e 's/$*.o/& $@/g' > $@
> 
> %.o: %.c
>       $(CC) $(CFLAGS) -c $^ -o $@

Use '$<' instead of '$^' in the '%.o: %.c' rule.

> gcc -ggdb3 -c vasm.c vasm.h -o vasm.o
> gcc: cannot specify -o with -c or -S with multiple files

$^ is 'vasm.c vasm.h'
$< is 'vasm.c'

> $ more vasm.d
> vasm.o vasm.d: vasm.c vasm.h
> 
> Hmm, it got both vasm.c and vasm.h, can't be right. Any ideas?

Both .c and .h files really should appear on the right-hand side of
the colon. If the .h files weren't there, then changing a header
wouldn't trigger recompilation.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]