[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #58556] Make is confused by a target named ".o" and neither emptyin
Paul D. Smith
[bug #58556] Make is confused by a target named ".o" and neither emptying .SUFFIXES nor MAKEFLAGS=r can prevent this
Sun, 15 Nov 2020 11:46:41 -0500 (EST)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36
Follow-up Comment #6, bug #58556 (project make):
I agree this is not right. Here is what happens:
First, the command line is parsed which creates a goal target named ".o".
Second, because "-r" was not given, the default rules are created. One of the
default rules is the suffix rule for ".o", which sees the already-existing
".o" goal target and applies the recipe to it. Then finally we try to build.
Since the ".o" is an actual target now, the code that handles -r as part of
MAKEFLAGS has no effect on it. This is clearly not right. It's a little
tricky though because GNU make keeps all the different types of targets in the
same big bucket of targets indexed by name. So, it's not really possible to
have both a target ".o" which is a goal target and a target ".o" which is a
suffix rule target, but have them be two different things.
I suspect the only way to make it work as the user expects, is to delay the
conversion of the command line goals into internal targets until after all
makefiles are read in and parsed.
POSIX's requirements here are a little tricky. If you have a rule with the
target ".o" and the ".o" appears as a member of .SUFFIXES, then that rule is
an inference rule not a target rule. If .SUFFIXES does not contain ".o", then
the rule is an inference rule not a target rule. So, you don't really know
until the entire makefile has been parsed and you know the final value of
.SUFFIXES, which it is.
Reply to this item at:
Message sent via Savannah