%% Reid Madsen <[EMAIL PROTECTED]> writes:
rm> It would be nice if there were such a thing as conditional includes.
rm> For example:
rm> depend:: -include dependencies
rm> Then in the case where the dependencies file has an error, the
rm> dependencies file would not be included when doing 'make depend'.
I don't understand the exact semantics you mean this syntax to provide.
rm> We structure our Makefiles as follows:
rm> depend::
rm> @makedepend -o dependencies ....
rm> -include dependencies
rm> However, if someone deletes a file that is used as a dependency in
rm> the dependencies file, make fails with an error. Any attempt to
rm> do 'make depend' fails with the same error -- still including the
rm> dependencies file. The only recourse is to delete the
rm> dependencies file and then do 'make depend'. This is difficult to
rm> communicate to a large development staff, and breaks automated
rm> build procedures.
If you don't need the dependencies file to be included when running
"make depend" you can test the MAKECMDGOALS variable to see what targets
are being made, and not do the include if it's "depend". See the GNU
make manual for info on this variable; you need GNU make 3.76 or
better. I believe the manual has an example of doing almost exactly
this, except for the "clean" rule.
Also, for an all-around better way of handling automatically generated
dependencies, see my web page below.
--
-------------------------------------------------------------------------------
Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at:
http://www.gnu.org http://www.paulandlesley.org/gmake/
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist