From b012588c966395ea4098fab833c577c4f0851416 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sun, 15 May 2016 14:11:02 +0100 Subject: [PATCH] build: Cope with the `subdir-objects' world Automake wants us to live in. Essentially, the Automake developers want to put the objects for `PATH/TO/FILE.c' in `PATH/TO/FILE.o'. This is wrongheaded, but we don't seem to get much choice. Unfortunately, it's also buggered. This causes trouble for our precomputed source files. The obvious trouble happens if the source file we reference is explicitly in the source tree, so we'll need to refer to the files differently in `mumble_SOURCES' lines and the machinery which makes the generates the files. The obvious answer would be to introduce two variables for referring to the precomptations tree. This is where Automake's bugs start to really bite. The main problem is with Automake's automatic dependency-tracking machinery. For each object `FILE.o' which is going to be built, it wants to make a `.deps/FILE.Po' file to track the detected dependencies. Furthermore, the generated makefiles get unhappy if these files don't already exist, so there's magic hung off the side of `config.status' to make them. This would be great, but the Automake machinery doesn't actually work properly. If you refer to a source file via a variable reference, something like `$(things)/file.c', then Automake's `config.status' magic creates a dependency-tracking file which is literally named `.deps/$(things)/file.Po', and then the makefile gets upset when it tries to include `$(things)/.deps/file.Po'. So we have to write explicit relative paths to precomputed source file names in `nodist_mumble_SOURCES' lists (because we make our own arrangements for distributing them). --- configure.ac | 2 +- hash/Makefile.am | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 5973f45..1f0ada8 100644 --- a/configure.ac +++ b/configure.ac @@ -31,7 +31,7 @@ mdw_AUTO_VERSION AC_INIT([mLib], AUTO_VERSION, [mdw@distorted.org.uk], [mLib]) AC_CONFIG_SRCDIR([mLib.pc.in]) AC_CONFIG_AUX_DIR([config]) -AM_INIT_AUTOMAKE([foreign]) +AM_INIT_AUTOMAKE([foreign subdir-objects]) mdw_SILENT_RULES AC_PROG_CC diff --git a/hash/Makefile.am b/hash/Makefile.am index 07fa219..f20c251 100644 --- a/hash/Makefile.am +++ b/hash/Makefile.am @@ -28,6 +28,7 @@ include $(top_srcdir)/vars.am noinst_LTLIBRARIES = libhash.la libhash_la_SOURCES = +nodist_libhash_la_SOURCES = libhash_la_LIBADD = ###-------------------------------------------------------------------------- @@ -43,7 +44,7 @@ crc_mktab_SOURCES = crc-mktab.c crc_mktab_LDADD = $(UTIL_LIBS) PROGMANS += crc-mktab.1 -libhash_la_SOURCES += $(precomp)/crc32-tab.c +nodist_libhash_la_SOURCES += ../precomp/crc32-tab.c PRECOMPS += $(precomp)/crc32-tab.c if !CROSS_COMPILING $(precomp)/crc32-tab.c: @@ -74,7 +75,7 @@ unihash_mkstatic_SOURCES = unihash-mkstatic.c unihash_mkstatic_LDADD = libunihash.la $(UTIL_LIBS) PROGMANS += unihash-mkstatic.1 -libhash_la_SOURCES += $(precomp)/unihash-global.c +nodist_libhash_la_SOURCES += ../precomp/unihash-global.c PRECOMPS += $(precomp)/unihash-global.c if !CROSS_COMPILING $(precomp)/unihash-global.c: -- 2.11.0