I want (GNU) make to rebuild when variables change. How can I achieve this?
For example,
$ make project
[...]
$ make project
make: `project' is up to date.
…like it should, but then I’d prefer
$ make project IMPORTANTVARIABLE=foobar
make: `project' is up to date.
to rebuild some or all of project.
You could use empty files to record the last value of your variable by using something like this:
After your
makerun, there will be an empty file in your directory whose name starts withIMPORTANTVARIABLE.and has the value of your variable appended. This basically contains the information about what the last value of the variableIMPORTANTVARIABLEwas.You can add more variables with this approach and make it more sophisticated using pattern rules — but this example gives you the gist of it.