bug-make
[Top][All Lists]
Advanced

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

[bug #27609] Stupid inference rule for yacc files can clobber C sources!


From: Paul D. Smith
Subject: [bug #27609] Stupid inference rule for yacc files can clobber C sources!
Date: Mon, 05 Oct 2009 22:20:13 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.14) Gecko/2009090217 Ubuntu/9.04 (jaunty) Firefox/3.0.14

Follow-up Comment #5, bug #27609 (project make):

First let me point out that the behavior you're concerned about is actually
required by the POSIX standard for make; the standard requires this as a built
in rule to all conforming implementations:


.y.c:
    $(YACC) $(YFLAGS) $<
    mv y.tab.c $@


So we can continue to discuss this to see if there's some way to alleviate
the potential bad effects, but ultimately I'm not going to remove this rule or
modify it in a way that breaks the standard (and also many makefiles out there
which are written to expect this behavior).

The heuristics you suggest for detecting yacc-generated files are not
acceptable.  Any builtin rule MUST be completely portable to all platforms
that make runs on, which includes not only all POSIX platforms with just
/bin/sh, not bash, as shells, but also VMS, Windows, DOS, OS/2, and Amiga
platforms (currently) where other tools like "diff" might not even exist. 
Furthermore, different implementations of yacc may well generate different
output in the first 3 lines.  This is simply not robust OR portable enough to
be included as the builtin rule for GNU make.

The complaint about make updating foo.c from foo.y even though foo.c already
exists is a primary feature of GNU make (see the manual discussion of implicit
rule chaining).  Even if I wanted to, which I don't, there's no way to change
this without breaking the vast majority of GNU makefiles, which rely on this
very useful behavior in some form.

A builtin rule that builds a .o directly from a .y doesn't help your
situation unless the current rule to build a .c from a .y were also removed
completely, and that's not going to happen.

You can, of course, disable these rules in your own makefiles in various
ways.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?27609>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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