[Top][All Lists]

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

Re: Proposed syntax for coincidental rules

From: Paul D. Smith
Subject: Re: Proposed syntax for coincidental rules
Date: Mon, 15 May 2006 11:23:08 -0400

%% Alessandro Vesely <address@hidden> writes:

  >> I couldn't find it either: but I think this must just be an error
  >> in the spec.  There is not even one single implementation of "make"
  >> that I'm aware of that treats multiple targets like this.

  av> OTOH, there is no point in prescribing how many times make should
  av> run a command after having said that the purpose of commands is to
  av> update the targets and that inferring the correct sequence of
  av> invocations is make's task.

Sorry, but I didn't quite grok that.

The purpose of having multiple targets in explicit rules (today) is a
kind of syntactic sugar that allows you to condense a number of rules
that are identical except for the target name, into one declaration.

In other words, this:

    foo bar baz: blah
            cp $< $@

is exactly identical to this:

    foo: blah
            cp $< $@
    bar: blah
            cp $< $@
    baz: blah
            cp $< $@

This is completely distinct from what we are discussing (one invocation
creates all targets), so a different syntax is required.  Further, this
feature is definitely used in many makefiles that exist today.

  >> [...]
  >> This is _required_ for parallel builds.  If you use "make -j3" make will
  >> try to build all three of those targets at the same time, so it will run
  >> the same command three times, which will wreak havoc on the output.

  av> Parallel builds is an added feature. It may only be useful under certain
  av> assumptions, namely that one command only builds one target...?

Not sure what you're advocating here, but if you mean that make should
choose to interpret a rule with multiple targets (such as the example
above) differently if the user specifies -j on the command line than if
they don't, then obviously that can not be acceptable.

  >> Basically, make is allowed to do "bad things" (and it will do them, at
  >> least sometimes) if it thinks that each target is built individually.

  av> That's a somewhat less reassuring statement. Anyway, how do you
  av> like .COINCIDENTAL as a special built-in target name? Do you still
  av> believe what you wrote in
  av> (last paragraph)?

I still believe that this ability would be very useful, yes.

My problem with something like .COINCIDENTAL is that it doesn't enforce
a locality of reference.  That is, the set of targets can be defined in
one place and .COINCIDENTAL can be somewhere completely different.  This
can be extremely confusing and difficult to understand for both the
makefile writer and the user.

Of course in some situations it's important to have the flexibility to
define things "remotely".  But, I'm not sure this is one of those
times.  Is there real benefit to this?

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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