bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug: documentation suggests incorrect behavior (was: Bug: concurrent


From: Eli Zaretskii
Subject: Re: Bug: documentation suggests incorrect behavior (was: Bug: concurrent make and references to different names of a multi-target rule)
Date: Sat, 09 Jun 2012 16:21:52 +0300

> Date: Sat, 09 Jun 2012 15:57:48 +0300
> From: Shachar Shemesh <address@hidden>
> CC: address@hidden
> 
> At the time I wanted to reply, but failed to find my sources. Today I
> happened to stumble on them. The misleading behavior, i.e. - building
> two targets with one receipt invocation, is suggested by the
> documentation itself (which is where I originally got it too):
> 
> http://www.gnu.org/software/make/manual/make.html#Automatic-Prerequisites
> 
> We see a suggestion to generate the dependency file as part of the
> normal build, and then use sed to turn that into a multi-target rule.
> The code, as placed in the documentation, exhibits the same bug as my
> original question. Since I was relying on that code (from memory) when I
> wrote my incorrect make file, I would like to suggest that this be
> considered a bug in the documentation, and that an example be placed
> that produces better make scripts.

The manual _does_ use pattern rules, which is what I suggested you to
use back then.  Here's the example from the manual:

  %.d: %.c
          @set -e; rm -f $@; \
           $(CC) -M $(CPPFLAGS) $< > address@hidden; \
           sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < address@hidden > $@; \
           rm -f address@hidden

All the other examples in the manual are for dependencies only,
i.e. rules with no commands.

By contrast, your example Makefile used ordinary, non-pattern rules,
which don't support the single-execution feature you wanted.

Of course, I have no objections against making the manual even more
clear on this issue.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]