[Top][All Lists]

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

RE: make -j and multiple targets

From: Howard Chu
Subject: RE: make -j and multiple targets
Date: Thu, 6 Sep 2001 02:17:26 -0700

> -----Original Message-----
> From: address@hidden [mailto:address@hidden Behalf Of
> Peter Gammie

> g'day,
> i'm using make 3.79.1.
> if i write a rule like so:

These rules don't accurately describe the dependencies that you're dealing
If you analyzed your actual order of events, you wouldn't have this problem:

lexer.c: lexer.l
        flex -t lexer.l > lexer.c

lexer.h: lexer.c
        genHeader.pl lexer.l

As a side note, it seems odd to me that a script designed to generate a
file needs to append anything to the C source file. Surely anything that
to be defined should have gone into the header file, and #include'd by the C

> ----Makefile----
> ... overall target that depends on lexer.o ...
> ... rules that depend on lexer.h ....
> lexer.c lexer.h: lexer.l
>       flex -t lexer.l > lexer.c
>       genHeader.pl lexer.l # generates lexer.h and appends stuff
> to lexer.c
> lexer.o: lexer.c # and some other stuff
> ----
> and run make like so:
> % make -j2
> i get the rule for lexer.c/lexer.h firing twice, which makes the
> compilation bomb sometimes due to the two appends (race).
> now, this is probably well understood behaviour, but could you at least
> add a caveat to the info page? (specifically in "parallel"). i'd prefer
> the semantics to be something like the following:
> "apply the rule once, taking the timestamp of the lhs to be the oldest of
> the n lhs files, and of the rhs to be the youngest of the m source files."
> rather than firing the rule several times.
> being completely naive about build systems, however, i'm sure someone will
> point out why this is a bad idea.
> cheers
> peter

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc

reply via email to

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