diff mbox

[2/2] Add subdir-objects automake option

Message ID 1431873115-23794-3-git-send-email-mail@rotty.xx.vu
State Superseded
Headers show

Commit Message

mail@rotty.xx.vu May 17, 2015, 2:31 p.m. UTC
From: Andreas Rottmann <a.rottmann@gmx.at>

Having subdir-objects enabled is recommended by automake 1.14, to avoid
future incompatibilities.

However, adding that option breaks out-of-tree builds, and also seems to
break "make distclean" for in-tree builds. The reason is that
apparently, automake with subdir-objects enabled cannot cope with source
files in a different, non-child directory. To avoid that, instead of
referencing the source files, we (just) link against that library.
---
 configure.ac      | 2 +-
 tests/Makefile.am | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index acd153d..dccc564 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@  AC_INIT([libosmocore],
 	m4_esyscmd([./git-version-gen .tarball-version]),
 	[openbsc@lists.osmocom.org])
 
-AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.6])
+AM_INIT_AUTOMAKE([subdir-objects foreign dist-bzip2 no-dist-gzip 1.6])
 AC_CONFIG_TESTDIR(tests)
 
 dnl kernel style compile messages
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8db2533..efbea3b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,4 +1,4 @@ 
-AM_CPPFLAGS = -I$(top_srcdir)/include
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
 AM_CFLAGS = -Wall
 
 check_PROGRAMS = timer/timer_test sms/sms_test ussd/ussd_test		\
@@ -18,12 +18,13 @@  endif
 utils_utils_test_SOURCES = utils/utils_test.c
 utils_utils_test_LDADD = $(top_builddir)/src/libosmocore.la
 
-a5_a5_test_SOURCES = a5/a5_test.c ../src/gsm/a5.c
+a5_a5_test_SOURCES = a5/a5_test.c
 a5_a5_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la
 a5_a5_test_LDFLAGS = -static
 
-kasumi_kasumi_test_SOURCES = kasumi/kasumi_test.c ../src/gsm/kasumi.c
+kasumi_kasumi_test_SOURCES = kasumi/kasumi_test.c
 kasumi_kasumi_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la
+kasumi_kasumi_test_LDFLAGS = -static
 
 comp128_comp128_test_SOURCES = comp128/comp128_test.c
 comp128_comp128_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la