[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
-include
From: |
Boris Kolpackov |
Subject: |
-include |
Date: |
Mon, 9 Feb 2004 13:22:05 -0600 |
User-agent: |
Mutt/1.5.4i |
Good day,
I found a somewhat surprising behavior of -include. Consider the
following makefile:
bar: foo := baz
-include bar
hello:
@echo hello
I would expect it to print 'hello'. Instead make complains that it
cannot build 'bar'. Here is what happens. The first line of this
makefile results in the file 'bar' being inserted into the table of
files. A flag 'dontcare' is not set. Later, when make reads a second
line, 'bar' is already in the table so the 'dontcare' flag is left
unset. When make tries to rebuild 'bar', 'dontcare' is 0 and make
complains that it cannot build 'bar'.
I also don't think that simply over-setting 'dontcare' is the right
thing to do. Consider, for example, the following file (which shows
another surprising feature, btw):
-include bar
bar: foo := baz
hello:
@echo hello
foo : bar
When I say 'make foo' nothing happens even though there is no rule
to build 'bar'.
So it seems to me that 'dontcare' flag is not an attribute of a file
but rather of a situation when the file is being built (i.e., when
make tries to remake 'bar' for -include it should have 'dontcare'
set to 1, but when it tries to build it as a prerequisite for 'foo'
it should have 'dontcare' set to 0.
thanks,
-boris
signature.asc
Description: Digital signature
- -include,
Boris Kolpackov <=