]> git.ipfire.org Git - thirdparty/automake.git/commit
[ng] rules: forbid old-fashioned suffix rules, prefer pattern rules
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 9 May 2012 15:57:59 +0000 (17:57 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 10 May 2012 13:12:04 +0000 (15:12 +0200)
commit887d2121ad17beb91cb2c95617ac51266c0d85da
tree05af3e58b5c72a26d243b0adbd7dedd13e36611e
parent245be387d3eefe5d1b39577ded1aa9d2345f4cff
[ng] rules: forbid old-fashioned suffix rules, prefer pattern rules

Pattern rules are cleaner, safer, and vouched for in the GNU make manual
itself.  Supporting them instead of suffix rules will also allow us to
simplify a little the automake script, auxiliary perl modules, and
documentation.

This change introduces a slight backward-incompatibility now, in that
user provided definitions of the SUFFIXES variable or of the .SUFFIXES
target, as well as old-fashioned suffix rules, are now rejected.

Automake-NG still tries to parse and understand suffix-based pattern
rules though, to retain support for user-added file extensions in the
_SOURCES variables (see "Handling new file extensions" in the Automake
manual).

So, an usage like:

    SUFFIXES = .baz .c
    .baz.c:
            cp $< $@
    foo_SOURCES = foo.c bar.baz
    DISTCLEANFILES = bar.c

which was valid with mainline Automake, should be translated for
Automake-NG as:

    %.c: %.baz
            cp $< $@
    bin_PROGRAMS = foo
    foo_SOURCES = foo.c sub/bar.baz
    DISTCLEANFILES = bar.c

Note that suffix-based pattern rules with dot-less suffix are *not*
supported.

* NG-NEWS: Update.
* doc/automake.texi: Likewise.
* lib/am/footer.am: Declare '.SUFFIXES:' with empty dependencies, to
neutralize the default suffix rules.
* automake.in (&handle_footer): Reject the 'SUFFIXES' variable.  Don't
process its content anymore.  Don't generate the .SUFFIXES special target
anymore.
(&var_SUFFIXES_trigger): Remove.  And don't install it as an hook for the
now-deprecated 'SUFFIXES' variable.
* lib/Automake/Rule.pm (&define): Don't process old-fashioned suffix
rules specially, but just reject them.  Instead, process pattern rules
specially.
($_SUFFIX_RULE_PATTERN): Made local to the '&define' function, renaming
it as '$suffix_rule_rx'.
(&suffixes, @_suffixes): Delete, they are no more used.
(@EXPORT): Adjust.
(register_suffix_rule): Don't extend '@_suffixes' anymore.
(reset): Don't reset '@_suffixes' anymore.
* t/ext3.sh: Remove as obsolete.
* t/suffix4.sh: Likewise.
* t/suffix6.sh: Likewise.
* t/suffix6b.sh: Likewise.
* t/suffix7.sh: Likewise.
* t/suffix11.tap: Likewise.
* t/suffix6c.sh: Rename ...
* t/suffix-obj.sh: .. like this, and adjust.
* t/suffix-chain.tap: Rewrite a as "simple" test (rather than as
a TAP test), adjust, and rename ...
* t/suffix-chain.sh: ... like this.
* t/suffix3.tap: Likewise rewrite and rename ...
* t/suffix3.sh: ... like this.
* t/suffix8.tap: Likewise rewrite and rename ...
* t/suffix8.sh: ... like this.
* t/suffix10.tap: Likewise rewrite and rename ...
* t/suffix10.sh: ... like this.
* t/suffix5.sh: Adjust.
* t/suffix9.sh: Likewise.
* t/suffix13.sh: Likewise.
* t/parallel-tests8.sh: Likewise.
* t/warnings-strictness-interactions.sh: Likewise.
* t/warnings-win-over-strictness.sh: Likewise.
* t/warnings-precedence.sh: Likewise.
* t/warnings-override.sh: Likewise.
* t/warning-groups-win-over-strictness.sh: Likewise.
* t/amopts-variable-expansion.sh: Likewise.
* t/specflg10.sh: Likewise.
* t/suffix-rules-reject.sh: New test.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
29 files changed:
NG-NEWS
automake.in
doc/automake.texi
lib/Automake/Rule.pm
lib/am/footer.am
t/amopts-variable-expansion.sh
t/ext3.sh [deleted file]
t/parallel-tests8.sh
t/specflg10.sh
t/suffix-chain.sh [moved from t/suffix-chain.tap with 73% similarity]
t/suffix-obj.sh [moved from t/suffix6c.sh with 93% similarity]
t/suffix-rules-reject.sh [new file with mode: 0755]
t/suffix10.sh [moved from t/suffix10.tap with 80% similarity]
t/suffix11.tap [deleted file]
t/suffix12.sh
t/suffix13.sh
t/suffix3.sh [moved from t/suffix3.tap with 73% similarity]
t/suffix4.sh [deleted file]
t/suffix5.sh
t/suffix6.sh [deleted file]
t/suffix6b.sh [deleted file]
t/suffix7.sh [deleted file]
t/suffix8.sh [moved from t/suffix8.tap with 77% similarity]
t/suffix9.sh
t/warning-groups-win-over-strictness.sh
t/warnings-override.sh
t/warnings-precedence.sh
t/warnings-strictness-interactions.sh
t/warnings-win-over-strictness.sh