Question

I'm using Eclipse (Juno) + CDT on Windows 7 to drive GCC, with automatic makefile generation. Worked great up until I used GCC's __DATE__ and __TIME__ preprocessor macros to add a build date/timestamp in my project configuration header file.

On a clean build, these macros work great - but on an incremental build, Make doesn't rebuild the associated object file; it just jumps straight to linking.

I tried doing the Windows equivalent of touch as a pre-build step (described here: https://stackoverflow.com/questions/51435/windows-version-of-the-unix-touch-command) but Make still skips the file. Also tried to "touch" a source file that includes the header; still no dice.

How can I tell Make to always rebuild any files that depend on a particular header, even on an incremental build?

Était-ce utile?

La solution 2

Turns out I needed to delete the object file as a pre-build step, as described here:

Force Eclipse CDT makefile to clean file before compiling (this is possibly a duplicate of that question)

Autres conseils

Mark the header as .PHONY. That will ensure it is always considered not up to date:

.PHONY: particular_header.h
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top