Relative Content

Tag Archive for makefilebuildgnu-make

Conditionally updating a target in a Makefile

I have a tool that I use to generate C++ header files as part of the build. I only want to write out the generated headers if they changed from what is already on disk so that I don’t trigger a rebuild of the object files that depend on those headers. I’m trying to do this with GNU Make. My problem is, because of the conditional write, I end up in a situation where the prerequisites are always newer than the target.