On Sat, 2019-06-01 at 19:47 +0430, Arham Amouei wrote: > It seems to me that -include depend.mk in addition to including > depend.mk, executes the rule that depend.mk is its target. I'd like > to stop this behavior. Found nothing helpful in the manual for this > purpose.
I saw your question on StackOverflow. As replied there, it's not possible to turn off this behavior. I don't understand how your makefile is intended to work: it seems to me there are holes which would allow incorrect dependency information to be used, possibly leading to tricky-to-find build errors. If you really want to keep the behavior you have you'll have to trick make by using different filenames for the target and the included file. something like this: depend.mk: *.c *.h $(CC) -MM *.c > depend.mk cp depend.mk depend.inc -include depend.inc Make doesn't know that the rule for target depend.mk builds the file depend.inc, so when you include depend.inc it won't try to rebuild depend.mk. _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make