makefile - Make: Redo some targets if configuration changes -
I want to re-execute some goals in the configuration changes.
Consider this example:
I have a configuration variable (which either reads from the environment variable or a config.local file):
CONF: = ... Based on this variable CONF, I collect a header file like .com.hpp:
conf .hpp: buildConfHeader $ (CONF) Now, of course, I want to recreate this header if the configuration variable changes, because otherwise the header will not reflect the new configuration . But how can I make it? The configuration variable is not connected to a file, as it can be read from environment variables.
Is there any way to get this?
If the configuration has changed through a macro or environment variable, then make < There is no way for / code>. You, however, use a goal that only updates the timestamp of conf.hpp , which will always force it to rebuild: conf.pp: confupdate buildConfHeader $ (CONF) confupdate: @touchconf.hpp However, as I said, conf.pp always made , Which means that any goals that depend on him as well as need to be made again is to create a more friendly solution to make himself. Seamke or GNU autototals are good for this, except you sacrifice a lot of control over the makefile. You can also use makefile build scripts, but I would advise against it because there are tools available that will allow you to make one more easily.
Comments
Post a Comment