Starting from a fresh git checkout, running ./autogen.sh gives a couple of warnings on my Fedora 24 build tools, one from libtool:
libtoolize: Consider adding '-I support' to ACLOCAL_AMFLAGS in Makefile.am. and one from automake: tests/run/Makefile.am:4: warning: source file '$(top_srcdir)/cliserv.c' is in a subdirectory, tests/run/Makefile.am:4: but option 'subdir-objects' is disabled automake: warning: possible forward-incompatibility. automake: At least a source file is in a subdirectory, but the 'subdir-objects' automake: automake option hasn't been enabled. For now, the corresponding output automake: object file(s) will be placed in the top-level directory. However, automake: this behaviour will change in future Automake versions: they will automake: unconditionally cause object files to be placed in the same subdirectory automake: of the corresponding sources. automake: You are advised to start using 'subdir-objects' option throughout your automake: project, to avoid future incompatibilities. Following the advice almost works, except that automake 1.15 still has a nasty bug (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928) where use of $(foo) in a _SOURCES variable coupled with subdir-objects creates a directory with a literal name $(foo) rather than the intended name. And while open-coding it (using ../../ instead of $(top_srcdir)/) works around the problem of bad naming in automake 1.15, it fails for automake 1.11 (hello CentOS 6), due to the order in which .deps files are erased vs. included in makefiles. The solution that works across all automake versions is to only stick files in _SOURCES that do not live outside of the subtree. Note that we only need to copy cliserv.c into the tests/run directory; automakes handling of dependencies will still rebuild against .h file changes even without listing the .h files or copying them locally. I also noticed that the build was already leaving behind an untracked manpage.log file, in addition to the new .dirstamp witness file created by our new use of subdir-objects. This patch has been tested with 'make distcheck' across multiple automake and libtool versions, ranging from CentOS 6 vintage to current git toolchains. Signed-off-by: Eric Blake <ebl...@redhat.com> --- .gitignore | 2 ++ Makefile.am | 1 + configure.ac | 2 +- tests/run/Makefile.am | 7 ++++++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b8163e0..b005b11 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .deps +.dirstamp Makefile autom4te.cache autoscan.log @@ -38,6 +39,7 @@ install-sh configure man/*.sh man/*.sh.in +man/manpage.log make-integrityhuge nbd-trdump missing diff --git a/Makefile.am b/Makefile.am index 36d35b6..34f4697 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,4 @@ +ACLOCAL_AMFLAGS = -I support SUBDIRS = . man doc tests systemd gznbd bin_PROGRAMS = nbd-server nbd-trdump sbin_PROGRAMS = @NBD_CLIENT_NAME@ diff --git a/configure.ac b/configure.ac index 83e4f91..ce225a6 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ m4_define([serial_tests], [ awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}' ]) ]) -AM_INIT_AUTOMAKE(foreign dist-xz serial_tests) +AM_INIT_AUTOMAKE(foreign dist-xz serial_tests subdir-objects) AM_MAINTAINER_MODE([enable]) AC_CONFIG_MACRO_DIR([support]) LT_INIT diff --git a/tests/run/Makefile.am b/tests/run/Makefile.am index c9cfa8f..23b01e3 100644 --- a/tests/run/Makefile.am +++ b/tests/run/Makefile.am @@ -1,7 +1,12 @@ TESTS_ENVIRONMENT=$(srcdir)/simple_test TESTS = cfg1 cfgmulti cfgnew cfgsize write flush integrity dirconfig list rowrite tree rotree unix integrityhuge check_PROGRAMS = nbd-tester-client -nbd_tester_client_SOURCES = nbd-tester-client.c $(top_srcdir)/cliserv.h $(top_srcdir)/netdb-compat.h $(top_srcdir)/cliserv.c +## Various Automake versions don't play nice with files in parent +## directories, so instead work with a local copy +cliserv.c: + rm -f cliserv.c + ln -s $(top_srcdir)/cliserv.c cliserv.c +nbd_tester_client_SOURCES = nbd-tester-client.c cliserv.c nbd_tester_client_CFLAGS = @CFLAGS@ @GLIB_CFLAGS@ nbd_tester_client_CPPFLAGS = -I$(top_srcdir) nbd_tester_client_LDADD = @GLIB_LIBS@ -- 2.7.4 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Nbd-general mailing list Nbd-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nbd-general