bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A problem with "-include"


From: Paul Smith
Subject: Re: A problem with "-include"
Date: Sat, 01 Jun 2019 11:56:22 -0400
User-agent: Evolution 3.32.1-2

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]