bugmake - Bugs: bug #40657, Suffix rules and prerequisites


bug #40657: Suffix rules and prerequisites

Submitted by:  John Marshall <jmarshall>
Submitted on:  Thu 21 Nov 2013 02:08:34 PM UTC  
Severity:  3 - Normal Item Group:  Documentation
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  3.81 Operating System:  Any
Fixed Release:  None Triage Status:  None

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Thu 21 Nov 2013 02:08:34 PM UTC, original submission:

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'
%.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.

John Marshall <jmarshall>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by jmarshall (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.3