Discussion:
[bug #40657] Suffix rules and prerequisites
John Marshall
2013-11-21 14:08:35 UTC
Permalink
URL:
<http://savannah.gnu.org/bugs/?40657>

Summary: Suffix rules and prerequisites
Project: make
Submitted by: jmarshall
Submitted on: Thu 21 Nov 2013 14:08:34 GMT
Severity: 3 - Normal
Item Group: Documentation
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Component Version: 3.81
Operating System: Any
Fixed Release: None
Triage Status: None

_______________________________________________________

Details:

The "Suffix Rules" info node states

"Suffix rules cannot have any prerequisites of their own. If they have any,
they are treated as normal files with funny names, not as suffix rules."

However this appears to be incorrect. Here is the example following that
text, with -DHELLO added so we can see it for certain:

$ cat badsuffix.mk
.c.o: foo.h
$(CC) -DHELLO -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
$ touch hello.c

$ make -f badsuffix.mk -n hello.o .c.o
cc -DHELLO -c -o hello.o hello.c
make: *** No rule to make target `foo.h', needed by `.c.o'. Stop.

$ make -f badsuffix.mk -p | grep -B4 -A1 'badsuffix.mk.*line 2'
[snip]
%.o: %.c
# commands to execute (from `badsuffix.mk', line 2):
$(CC) -DHELLO -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
--
.c.o: foo.h
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# commands to execute (from `badsuffix.mk', line 2):
$(CC) -DHELLO -c $(CFLAGS) $(CPPFLAGS) -o $@ $<

So both a suffix rule and a rule for a funnily-named file have been made, and
only one got the prerequisite. Perusal of the NEWS file suggests that this
may have changed in 3.58 ("Suffix rules may have dependencies (which are
ignored)"), but it seems that the documentation has not caught up.




_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?40657>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Paul D. Smith
2018-09-08 21:44:01 UTC
Permalink
Update of bug #40657 (project make):

Item Group: Documentation => Bug
Triage Status: None => Medium Effort

_______________________________________________________

Follow-up Comment #1:

I think this is actually a bug, not a documentation error. Or I guess, it
could also be a documentation error, depending on how the bug is resolved.

It should not be the case that a suffix rule with a prerequisite creates both
a pattern rule (without an extra prerequisite) AND an explicit rule named for
the suffix (with a prerequisite). That is bogus.

It should create either one or the other.

My inclination is to follow the documentation and keep the explicit rule and
not create a pattern rule any longer.

_______________________________________________________

Reply to this item at:

<https://savannah.gnu.org/bugs/?40657>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
Paul D. Smith
2018-09-15 20:04:04 UTC
Permalink
Update of bug #40657 (project make):

Status: None => Fixed
Assigned to: None => psmith
Open/Closed: Open => Closed
Fixed Release: None => SCM


_______________________________________________________

Reply to this item at:

<https://savannah.gnu.org/bugs/?40657>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Loading...