I am stuck with a problem for which I searched on various threads unsuccessfully.
I have a project built with autotools utilities. This project relies on preprocessor directives which activate blocks of code depending on the presence of libraries or other stuff.
The problem I am facing is that once the project is built, for example like: ./configure --enable-mpi=yes && make
(Note that --enable-mpi=yes is set to add -DMPI_LIB=1 to the list of compiler flags.)
If I rebuild the project like ./configure --enable-mpi=no && make
Nothing is done for make. I think it is normal behaviour as no files changed except compilation flags (-DMPI_LIB=0 in that case).
How then can I add a dependence on flag changes in Makefile.am ?
I came across this thread: Makefile trigger rebuild for C/C++ preprocessor directives. Unfortunately I do not know how to adapt this to Makefile.am as there seem to be pretty high limitations in conditionals handling in Makefile.am.
Thank you for any advice !
EDIT I may have found a workaround, or maybe the right way of doing it in another thread how to force recompile when changing Makefile flags? (I am not much experienced with make). If I add Makefile as a dependency to my object files it does the job, e.g. recompiles whenever a compilation flag changed.