]> granicus.if.org Git - re2c/commit
Fixed build system to support automake's 'subdir-objects' feature.
authorUlya Trofimovich <skvadrik@gmail.com>
Tue, 2 Jun 2015 11:34:09 +0000 (12:34 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Tue, 2 Jun 2015 11:34:09 +0000 (12:34 +0100)
commit9fcd8640506a5ad020f36b63858898efbda1f429
tree1a890fb94ac0d58786b714192a7d147a33d22f13
parente5221e125903d55763f7626e7e20479f7fb4bb97
Fixed build system to support automake's 'subdir-objects' feature.

As I updated automake to version 1.15 it began to produce lots of
warnings about 'subdir-objects' not used when it should have been.
Turns out that 'subdir-objects' will be on by default in 2.0.

So I tried to turn on 'subdir-objects' and builds began to fail:
automake didn't expand '$(sourcedir)' and '$(builddir)' prefixes.
I erroneously prepended these prefixes in commit
38f526d04415adb7b5e6bca228fc26409833f5c3 "Updated build system.",
as commit message says:
...
    Makefile.am:
        - explicitly prefixed all file names with $(srcdir) or $(builddir)
...

But automake prepends these prefixes already where necessary, except
for custom rules with side effects: if a custom rule touches some
files that are not explicit targets or dependencies of this rule,
then automake won't find these files unless they are in build directory.
We have such side-effectful custom rules:
    - parser rule produces multiple files and touches bootstrap files
    - scanner rule touches bootstrap file
    - doc rules touch bootstrap files
Multiple files is a common problem of make. Bootstrap introduces
circular dependency, since bootstrap files need to be updated after
they've been used. So it's hard to get rid of side effects in these
rules.

This commit enabels 'subdir-objects' feature and removes all prefixes
in variables and adds them in side-effectful custom rules (for files
from source directory, not for files from build directory). It also
makes use of '$@' and '$<' special variables in custom rules (which
makes side effects more explicit).

Still I don't yet fully understand how automake uses things like
'$(sourcedir)' and '$(builddir)' and their relation with 'subdir-objects'
(it's probably related with non-recursive makefiles).
re2c/Makefile.am
re2c/bootstrap/parser.cc
re2c/bootstrap/y.tab.h
re2c/configure.ac