bug-automake
[Top][All Lists]
Advanced

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

[PATCH 0/6] Lex, Yacc and explicit declarations of dependencies.


From: Stefano Lattarini
Subject: [PATCH 0/6] Lex, Yacc and explicit declarations of dependencies.
Date: Thu, 20 May 2010 11:58:10 +0200
User-agent: KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.4; i686; ; )

This patch series stems from a discussion on bug-automake:
[<http://comments.gmane.org/gmane.comp.sysutils.automake.bugs/4892>]

In short, some make implementations tend to use their built-in ".y => .o"
and ".l => .o" rules instead of respectively the ".y => .c => .o" and
".l => .c => .o" implicit rule chains provided by the automake-generated
Makefiles.  This problem can be solved by always declaring more
dependencies *explicitly* in the generated Makefile.in.

The patch n.4 in the series does this.  The other patches provide new and
enhanced tests to verify the functionalities affected by the change.

-*-*-*-

It might be worth reporting the extensive comments in the automake scripts
regarding dependencies/rules generation.  Note that the following comments
are the updated, extended version provided by the propsed patch series:

# If the object file has been renamed (because per-target
# flags are used) we cannot compile the file with an
# inference rule: we need an explicit rule.
#
# If the source is in a subdirectory and the object is in
# the current directory, we also need an explicit rule.
#
# If both source and object files are in a subdirectory
# (this happens when the subdir-objects option is used),
# then the inference will work.
#
# [CUT]
#
# Using inference rules for subdir-objects has been tested
# with GNU make, Solaris make, Ultrix make, BSD make,
# HP-UX make, and OSF1 make successfully.
#
# Unfortunately, explicit *dependencies* might still be needed
# in the generated Makefile.in, even when explicit *rules* are
# *not* required.  Otherwise, in particular situations, some
# make implementations (e.g. Heirloom make) might end up using
# their built-in implicit rules, rather then the rules' chains
# inferred from Automake-generated generic suffix rules.
#
# An example will help to clarify this.
#
# Let's say we have a C file `foo.c' generated from a Yacc
# input `foo.y'.  If the Makefile contains no target which
# depends *explicitly* from foo.c, Heirloom make will end up
# using its builtin `.y => .o' rule (calling $(YACC) and $(CC)
# directly, and obviously ignoring the $(AM_CFLAGS) variable,
# the ylwarp script, etc.), instead of the `.y => .c => .o'
# rule chain generated by Automake (thanks to the two suffix
# rules `.y.c' and `.c.o').
#
# So, for consistency and simplicity, we always declare
# *explicit* dependencies, while avoiding to output
# unnecessary explicit *rules*.

-*-*-*-

Most relevant bits of the original discussion on bug-automake are reported 
here, just  for the record ...

Stefano Lattarini:
> I encounterd the following failure in silent5.test when trying out the
> Automake testsuite using Heirloom make as $MAKE:
>> [...]
>>       rm -f baz5.c
>>       flex  -t baz5.l > baz5.c
>>       gcc -g -O2  -c -o baz5.o baz5.c
>>       rm -f baz5.c
>>   CC  baz6.o
>> [...]
>>   LEX  baz5.c
>>   CC  ba2-baz5.o
>> [...]
>>     rm -f foo5.c
>>     flex  -t foo5.l > foo5.c
>>     gcc -g -O2  -c -o foo5.o foo5.c
>>     rm -f foo5.c
>> [...]
> [CUT]
> The failure is not spurious, and seems due to the fact that heirloom 
> make is overly verbose in rules involving `flex' even when silent-rules 
> are enabled.

Ralf Wildenhues:
> That looks like heirloom-make uses its own internal rule for baz5.c and
> for foo5.c.  That would be problematic because ylwrap is not used, and
> other problems.  With a non-flex lex you'd see more test failures I
> suppose.
> [CUT]
> I'm guessing this has to do with chains of inference rules not being
> detected or so.

Ralf Wildenhues:
> Yeah, the make has a .l.o rule that triggers before our .l.c and .c.o
> rule chains.
> I guess this could be worked around by adding explicit rules (at least
> that's what SUSv3 recommends), maybe explicit dependencies without
> rules suffice. 

Stefano Lattarini:
> Yes, explicit dependencies without rules suffice.
> If I venture to write a patch to solve this problem, will you
> consider it?

Ralf Wildenhues:
> Yes, if it's not dangerous or regresses other situations.

-*-*-*-

Patch series' summary:

Stefano Lattarini (6):
  Extend, fix and improve tests on Yacc/Lex support.
  New tests: Heirloom make and Lex/Yacc rules.
  Add new tests on Lex and Yacc.
  automake.in: improve declaration of dependencies in generated Makefile.in
  New tests on Lex and Yacc dependencies declarations.
  More tests on AM_PROG_LEX, AC_PROG_LEX and @address@hidden

 ChangeLog                 |   77 +++++++++++
 automake.in               |  114 ++++++++++------
 tests/Makefile.am         |   22 +++-
 tests/Makefile.in         |   22 +++-
 tests/defs.in             |    7 +
 tests/exeext3.test        |   10 +-
 tests/lex10.test          |   26 ++++
 tests/lex11.test          |   26 ++++
 tests/lex12.test          |   49 +++++++
 tests/lex13.test          |   70 ++++++++++
 tests/lex2.test           |    2 +
 tests/lex3.test           |   28 ++--
 tests/lex4.test           |    2 +
 tests/lex5.test           |   21 +--
 tests/lex6.test           |   54 ++++++++
 tests/lex7.test           |  152 +++++++++++++++++++++
 tests/lex8.test           |  134 ++++++++++++++++++
 tests/lex9.test           |  102 ++++++++++++++
 tests/lexcpp.test         |   46 ++++++
 tests/lexlib.test         |   55 ++++++++
 tests/lexvpath.test       |  117 ++++++++++++++++
 tests/suffix3.test        |   26 +++--
 tests/yacc.test           |    7 +-
 tests/yacc10.test         |  164 ++++++++++++++++++++++
 tests/yacc11.test         |  145 ++++++++++++++++++++
 tests/yacc12.test         |   26 ++++
 tests/yacc13.test         |   26 ++++
 tests/yacc2.test          |   15 +-
 tests/yacc3.test          |   15 +-
 tests/yacc4.test          |   18 +--
 tests/yacc5.test          |   24 ++--
 tests/yacc6.test          |   14 +-
 tests/yacc7.test          |    8 +-
 tests/yacc8.test          |   21 ++--
 tests/yacc9.test          |   56 ++++++++
 tests/yaccpp.test         |   21 ++-
 tests/yaccvpath.test      |   27 ++--
 tests/yl-static-checks.sh |  333 +++++++++++++++++++++++++++++++++++++++++++++
 38 files changed, 1920 insertions(+), 162 deletions(-)
 create mode 100755 tests/lex10.test
 create mode 100755 tests/lex11.test
 create mode 100755 tests/lex12.test
 create mode 100755 tests/lex13.test
 create mode 100755 tests/lex6.test
 create mode 100755 tests/lex7.test
 create mode 100755 tests/lex8.test
 create mode 100755 tests/lex9.test
 create mode 100755 tests/lexcpp.test
 create mode 100755 tests/lexlib.test
 create mode 100755 tests/lexvpath.test
 create mode 100755 tests/yacc10.test
 create mode 100755 tests/yacc11.test
 create mode 100755 tests/yacc12.test
 create mode 100755 tests/yacc13.test
 create mode 100755 tests/yacc9.test
 create mode 100644 tests/yl-static-checks.sh

-*-*-*-

Patches will follow soon.

Regards,
    Stefano



reply via email to

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