bug#13928: The 'subdir-object' option breaks makefiles where foo_SOURCES contains $(var)

2015-01-01 Thread Stefano Lattarini

retitle 13928 foo_SOURCES containing unexpanded $(var) breaks with 
'subdir-object' option active
stop

Reference: http://debbugs.gnu.org/13928

Hi Johan and everybody, sorry for the awful delay.

On 07/05/2014 07:59 PM, Johan Kristensen wrote:

Hi,

What is the current status of this bug?

[MEGA-SNIP]


I'm trying a simple approach (which seems quite promising so far)
in the experimental Git branch experimental/deps-pr13928-take-2.

The new code seems to work with the following make versions:

  - GNU
  - NetBSD 5.1
  - FreeBSD 8.0
  - Solaris 10
  - AIX 7.1


Notice that the new code will not land in Automake 1.15 (that I
hope to be able to release in less than a week, as soon as my
new GPG key is accepted by ftp-upl...@gnu.org).  But unless any
unanticipated issue arises, I definitely want the fix to land
in Automake 1.16 (and the fix for this bug alone would IMHO be
enough to justify a new minor release).

Thanks,
  Stefano






bug#13928: The 'subdir-object' option breaks makefiles where foo_SOURCES contains $(var)

2015-01-01 Thread Harlan Stenn
Excellent timing, thanks!

Now that ntp-4.2.8 is settling down, I'm looking to update our
Makefile.am's to use subdir-objects, and it's not being fun.

I may wait until 1.15 is released to continue this effort.

H





[PATCH] deps: 'subdir-object' option now works when foo_SOURCES contains $(var)

2015-01-01 Thread Stefano Lattarini
Following a suggestions of Johan Kristensen, we have config.status use
'make' invocations rather than Makefile-parsing 'sed' hacks to bootstrap
the dependency-tracking '.Po' and '.Plo' makefile fragments. To handle
the inclusion of such files that are still missing when make is first
we basically generate a temporary Makefile without these includes, and
call 'make' on that Makefile.

This fixes the serious bug bug#13928, which was an hard blocker to make the
behavior mandated by the 'subdir-object' active by default (which we want
to do in Automake 2.0).

The issue has also been reported in bug#15919.

* NEWS, THANKS, PLANS/subdir-objects.txt: Update
* bin/automake.in (handle_languages): Add a trailing marking comment
(# am--include-marker) to the generated Makefile lines issuing 'include'
directives for the dependency-tracking '.Po' and '.Plo' makefile fragments.
Also rename the generated Makefile variable 'am__depfiles_maybe' to the
clearer 'am__maybe_remake_depfiles'.
Minor unrelated refactoring.
* lib/am/configure.am: Adjust to account for the 'am__depfiles_maybe' -
'am__maybe_remake_depfiles' renaming.
* lib/am/depend.am: Add rules to generate a dummy version of all the
dependency-tracking '.Po' and '.Plo' makefile fragments.
* m4/depout.m4: Use make invocations rather than Makefile-parsing sed hacks
to bootstrap the dependency-tracking '.Po' and '.Plo' makefile fragments.
We still use some sed trickery in order to remove the inclusion of the
still non existing .Po and .Plo files from the Makefile we invoke make
upon; this is done stripping lines that contain the magic string
# am--include-marker.
* m4/make.m4 (AM_MAKE_INCLUDE): Given that now automake generates Makefiles
containing include statements with trailing comment, adjust the checks done
here to make sure $MAKE support that; e.g., include foo.mk # comment
rather than just include foo.mk.
Also refactor and adjust to leave better debugging info in config.log.
* t/postproc.sh: Rename ...
* t/depend-postproc.sh: ... to this, and adjust and enhance.
* t/list-of-tests.mk (handwritten_TESTS): Adjust.
(XFAIL_TESTS): Remove 't/subobj-indir-pr13928.sh', which is now succeeding.
* t/subobj-indir-pr13928.sh: Simplify slightly, now that we expect it to
pass.
* t/depcomp8a.sh: Adjust grepping check to account for the changes in
the generated Makefile, and tp be somewhat more robust in light of possible
future modifications.
* t/depcomp8b.sh: Likewise.
* t/subobj11b.sh: Likewise.
* t/subobj11c.sh: Likewise.
* t/extra-sources.sh: Likewise.
* t/lex-depend-grep.sh: Likewise.
* t/lex-depend-cxx.sh: Add a command to help debugging in case of test
failure.

Helped-by: Johan Kristensen johankristen...@gmail.com
Signed-off-by: Stefano Lattarini stefano.lattar...@gmail.com
---
 NEWS  | 28 
 PLANS/subdir-objects.txt  | 10 ++---
 THANKS|  1 +
 bin/automake.in   | 84 ++-
 lib/am/configure.am   |  6 +--
 lib/am/depend.am  |  7 +++
 m4/depout.m4  | 78 ++--
 m4/make.m4| 59 +++-
 t/depcomp8a.sh| 16 +++
 t/depcomp8b.sh| 16 +++
 t/{postproc.sh = depend-postproc.sh} | 29 ++--
 t/extra-sources.sh|  5 ++-
 t/lex-depend-cxx.sh   |  5 +++
 t/lex-depend-grep.sh  |  2 +-
 t/list-of-tests.mk|  3 +-
 t/subobj-indir-pr13928.sh |  4 +-
 t/subobj11b.sh| 10 ++---
 t/subobj11c.sh|  2 +-
 18 files changed, 206 insertions(+), 159 deletions(-)
 rename t/{postproc.sh = depend-postproc.sh} (68%)

diff --git a/NEWS b/NEWS
index 84a5e0a..a930049 100644
--- a/NEWS
+++ b/NEWS
@@ -62,6 +62,34 @@
 
 
 
+New in 1.16:
+
+* Bugs fixed:
+
+  - Automatic dependency tracking has been fixed to work also when the
+subdir-object option is used and some 'foo_SOURCES' definition contains
+unexpanded references to make variables, as in, e.g.:
+
+a_src = sources/libs/aaa
+b_src = sources/bbb
+foo_SOURCES = $(a_src)/bar.c $(b_src)/baz.c
+
+With such a setup, the created makefile fragment containing dependency
+tracking information will be correctly placed under the directories
+named 'sources/libs/aaa/.deps' and 'sources/bbb/.deps', rather than
+mistakenly under directories named (literally!) '$(src_a)/.deps' and
+'$(src_b)/.deps' (this was automake bug#13928).
+
+Notice that in order to fix this bug we had to slightly change the
+semantics of how config.status bootstraps the makefile fragments
+required for the dependency tracking to work: rather than attempting
+to parse the Makefiles via grep and sed 

The 'subdir-object' option breaks makefiles where foo_SOURCES contains $(var)

2015-01-01 Thread Stefano Lattarini

retitle 13928 foo_SOURCES containing unexpanded $(var) breaks with 
'subdir-object' option active
stop

Reference: http://debbugs.gnu.org/13928

Hi Johan and everybody, sorry for the awful delay.

On 07/05/2014 07:59 PM, Johan Kristensen wrote:

Hi,

What is the current status of this bug?

[MEGA-SNIP]


I'm trying a simple approach (which seems quite promising so far)
in the experimental Git branch experimental/deps-pr13928-take-2.

The new code seems to work with the following make versions:

  - GNU
  - NetBSD 5.1
  - FreeBSD 8.0
  - Solaris 10
  - AIX 7.1


Notice that the new code will not land in Automake 1.15 (that I
hope to be able to release in less than a week, as soon as my
new GPG key is accepted by ftp-upl...@gnu.org).  But unless any
unanticipated issue arises, I definitely want the fix to land
in Automake 1.16 (and the fix for this bug alone would IMHO be
enough to justify a new minor release).

Thanks,
  Stefano




Re: The 'subdir-object' option breaks makefiles where foo_SOURCES contains $(var)

2015-01-01 Thread Harlan Stenn
Excellent timing, thanks!

Now that ntp-4.2.8 is settling down, I'm looking to update our
Makefile.am's to use subdir-objects, and it's not being fun.

I may wait until 1.15 is released to continue this effort.

H