bug-make
[Top][All Lists]
Advanced

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

RE: Error in processing of :: targets


From: reid . madsen
Subject: RE: Error in processing of :: targets
Date: Tue, 14 Jun 2005 07:03:42 -0700

Paul,

I guess I should provide an example for my previous statement:

all:: first
        @echo one
all:: second
        @echo two
first:
        @echo first
second:
        @echo second

In GNUmake 3.75, this produced:

        first
        one
        second
        two

In GNUmake 3.80, this produced:

        first
        second
        one
        two

On the surface, this might not appear to be a big deal -- unless the
order of execution between first & second is important.

In the larger picture, we like to intermix serialism and parallelism in
the same makefile.  In 3.80, if you choose parallelism, serialism is
impossible.  However, in 3.75, this worked just fine.

Why did the functionality change?

Reid 

-----Original Message-----
From: Paul Smith [mailto:address@hidden On Behalf Of Paul D. Smith
Sent: Tuesday, June 14, 2005 7:48 AM
To: Madsen, Reid
Cc: address@hidden
Subject: Re: Error in processing of :: targets

%% address@hidden writes:

  rm> I've run into a functional difference between the standard unix
  rm> make and GNUmake (3.80) involving how the :: rules are processed.

By "standard unix make" you seem to mean SystemV make.  Note that the
only official Standard-with-a-capital-S (recognized by the FSF and GNU
project) for make is the POSIX standard.  The POSIX standard doesn't
address this issue (it doesn't address parallelism at all).

SystemV make is, at best, a de facto standard, and there are plenty of
other (incompatible) versions of make out there.

In fact, GNU make is not intended to be a drop-in replacement for
SystemV make and there are _several_ points at which the behavior of the
two versions diverge.

  rm> In the standard unix make (Solaris), the :: targets ( i.e., all::)
  rm> are process in the order they are found in the Makefile serially,
  rm> regardless of whether parallelism is used (i.e., -jN, where N is >
  rm> 1).

  rm> In GNUmake (3.80), the when -j1 is used, the "::" targets are
  rm> executed serially.  When -jN is used the "::" targets are executed
  rm> in parallel.

GNU make's behavior here is exactly in keeping with the definition of
double-colon rules in the GNU make manual, which states:

>    When a target appears in multiple rules, all the rules must be the 
> same type: all ordinary, or all double-colon.  If they are 
> double-colon, each of them is independent of the others.  Each 
> double-colon rule's commands are executed if the target is older than 
> any prerequisites of that rule.  If there are no prerequisites for 
> that rule, its commands are always executed (even if the target 
> already exists).  This can result in executing none, any, or all of 
> the double-colon rules.
>
>    Double-colon rules with the same target are in fact completely 
> separate from one another.  Each double-colon rule is processed 
> individually, just as rules with different targets are processed.

If you think a different set of behavior is desirable, the best thing is
probably to file an enhancement request on the Savannah
(https://savannah.gnu.org/) project page for GNU make and someone will
look at it.

Cheers!

--
------------------------------------------------------------------------
-------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "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]