avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Code version timestamp


From: Dave Hansen
Subject: Re: [avr-gcc-list] Code version timestamp
Date: Wed, 14 Sep 2005 17:19:26 -0400

From: "Anton Erasmus" <address@hidden>

On 14 Sep 2005 at 6:21, John Altstadt wrote:
[...]
> %.elf: $(OBJ)
>          @echo
>          @echo $(MSG_LINKING) $@
>          $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
>          rm version.o

There is a better way to force the recompile of version.c
Add the following at the end of your makefile

# Always compile version.c to get correct compilation date and time
.PHONY: version.c


ITYM

.PHONY: version.o

Another method that works with make utilities besides GNU's (and is perhaps more self-documenting) is

version.o: FORCE

FORCE:

IOW, make version.o depend on FORCE, and make FORCE a phony target (no prerequisites and no commands). As long as you don't make a file named FORCE, version.o will always be made (compiled from version.c) Of course, if you are using GNU make, it's good to add

.PHONY: FORCE

so FORCEd commands are executed even if a file named FORCE is created...

Regards,
  -=Dave






reply via email to

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