4.2 Make - Bug in special macro '$?' with double colons ??
John M Sellens
jmsellens at watmath.UUCP
Tue Sep 4 07:58:46 AEST 1984
(I wouldn't be suprised if this was present in ALL makes... )
In 4.2bsd make, there seems to be a minor bug in the processing of
makefiles with double colon definition lines. (The single colon
case works as you would expect - seems to be treated like one big
definition line). None of the files referred to in the makefile
exist.
The special macro '$?' gets expanded in different ways depending on
the order of the items in the makefile. It seems that if a double
colon definition does not have any commands, it is treated as part
of the next definition (at least for purposes of determining '$?').
Repeatable as shown below. My question: Is this a bug or a feature??
I don't have a fix - to my mind, this is too obscure to really be worth
the trouble. I only stumbled on it because I am trying to reproduce
the behaviour of make on a PC and I wasn't sure how it was supposed to
react.
cat Makefile
all:: one
echo ONE $@
echo $?
all:: two
# echo TWO $@
# echo $?
all:: three
echo THREE $@
echo $?
one: two
echo $@
two:
echo $@
three:
echo $@
make -n -f twoNotDefined /* # comments there */
echo two
echo one
echo ONE all
echo one
echo three
echo THREE all
echo two three <== Notice that two is here, but one is not.
<== But if you move the line containing
<== 'all:: two' to after the group that starts
<== 'all:: three', two no longer shows up on
<== this line.
make -n -f twoDefined /* #'s removed */
echo two
echo one
echo ONE all
echo one
echo TWO all
echo two
echo three
echo THREE all
echo three <== two is not here!!
John M Sellens
UUCP: {decvax|utzoo|ihnp4|allegra|clyde}!watmath!jmsellens
CSNET: jmsellens%watmath at waterloo.csnet
ARPA: jmsellens%watmath%waterloo.csnet at csnet-relay.arpa
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list