From patchwork Tue Jun 16 21:23:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mail@rotty.xx.vu X-Patchwork-Id: 485186 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (unknown [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 117E61402AB for ; Wed, 17 Jun 2015 07:23:50 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id E1E0D76AB; Tue, 16 Jun 2015 21:23:48 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from yade.xx.vu (yade.xx.vu [78.47.92.94]) by lists.osmocom.org (Postfix) with ESMTP id 8696C767E for ; Tue, 16 Jun 2015 21:23:44 +0000 (UTC) Received: from delenn.home.rotty.xx.vu (85-127-115-72.dynamic.xdsl-line.inode.at [85.127.115.72]) by yade.xx.vu (Postfix) with ESMTPSA id AF505230E09; Tue, 16 Jun 2015 23:23:42 +0200 (CEST) Received: by delenn.home.rotty.xx.vu (Postfix, from userid 1000) id BDD773258E5; Tue, 16 Jun 2015 23:23:43 +0200 (CEST) From: Andreas Rottmann To: openbsc@lists.osmocom.org Subject: [PATCH 2/4] Add subdir-objects automake option Date: Tue, 16 Jun 2015 23:23:29 +0200 Message-Id: <1434489811-10097-3-git-send-email-mail@rotty.xx.vu> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1434489811-10097-1-git-send-email-mail@rotty.xx.vu> References: <1434489811-10097-1-git-send-email-mail@rotty.xx.vu> X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Development of the OpenBSC GSM base station controller List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andreas Rottmann Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" From: Andreas Rottmann 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, we simply compile the files referenced in this way into a static library in their own source directory, and instead of referencing the source files, we link against that library. Besides making the build system a bit more future proof, this change also potentially enhances build times, as it reduces the number of compiler invocations, in exchange a slight increase of "ar" invocations. --- openbsc/configure.ac | 2 +- openbsc/src/gprs/Makefile.am | 20 ++++++++++++-------- openbsc/src/osmo-bsc_nat/Makefile.am | 7 +++++-- openbsc/tests/bsc-nat-trie/Makefile.am | 6 +++--- openbsc/tests/bsc-nat/Makefile.am | 11 +++-------- openbsc/tests/bsc/Makefile.am | 6 +++--- openbsc/tests/gprs/Makefile.am | 6 +++--- openbsc/tests/smpp/Makefile.am | 7 ++++--- 8 files changed, 34 insertions(+), 31 deletions(-) diff --git a/openbsc/configure.ac b/openbsc/configure.ac index fb6feb9..e022393 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -3,7 +3,7 @@ AC_INIT([openbsc], m4_esyscmd([./git-version-gen .tarball-version]), [openbsc@lists.osmocom.org]) -AM_INIT_AUTOMAKE([dist-bzip2]) +AM_INIT_AUTOMAKE([subdir-objects dist-bzip2]) AC_CONFIG_TESTDIR(tests) dnl kernel style compile messages diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index f46a402..9765cdd 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -16,18 +16,22 @@ bin_PROGRAMS += osmo-sgsn endif endif +noinst_LIBRARIES = libgprs.a + +libgprs_a_SOURCES = gprs_gb_parse.c crc24.c gprs_utils.c \ + gprs_llc.c gprs_llc_parse.c gprs_llc_vty.c \ + gprs_subscriber.c \ + gprs_gsup_messages.c gprs_gsup_client.c + osmo_gbproxy_SOURCES = gb_proxy.c gb_proxy_main.c gb_proxy_vty.c \ - gb_proxy_patch.c gb_proxy_tlli.c gb_proxy_peer.c \ - gprs_gb_parse.c gprs_llc_parse.c crc24.c gprs_utils.c -osmo_gbproxy_LDADD = $(top_builddir)/src/libcommon/libcommon.a \ + gb_proxy_patch.c gb_proxy_tlli.c gb_proxy_peer.c +osmo_gbproxy_LDADD = libgprs.a $(top_builddir)/src/libcommon/libcommon.a \ $(OSMO_LIBS) -lrt osmo_sgsn_SOURCES = gprs_gmm.c gprs_sgsn.c gprs_sndcp.c gprs_sndcp_vty.c \ sgsn_main.c sgsn_vty.c sgsn_libgtp.c \ - gprs_llc.c gprs_llc_parse.c gprs_llc_vty.c crc24.c \ - sgsn_ctrl.c sgsn_auth.c gprs_subscriber.c \ - gprs_gsup_messages.c gprs_utils.c gprs_gsup_client.c \ - gsm_04_08_gprs.c sgsn_cdr.c sgsn_ares.c -osmo_sgsn_LDADD = \ + sgsn_ctrl.c sgsn_auth.c \ + gsm_04_08_gprs.c sgsn_cdr.c +osmo_sgsn_LDADD = libgprs.a \ $(top_builddir)/src/libcommon/libcommon.a \ -lgtp $(OSMO_LIBS) $(LIBOSMOABIS_LIBS) $(LIBCARES_LIBS) -lrt diff --git a/openbsc/src/osmo-bsc_nat/Makefile.am b/openbsc/src/osmo-bsc_nat/Makefile.am index d96a391..a38d68a 100644 --- a/openbsc/src/osmo-bsc_nat/Makefile.am +++ b/openbsc/src/osmo-bsc_nat/Makefile.am @@ -3,12 +3,15 @@ AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) AM_LDFLAGS = $(COVERAGE_LDFLAGS) bin_PROGRAMS = osmo-bsc_nat +noinst_LIBRARIES = libbsc_nat.a - -osmo_bsc_nat_SOURCES = bsc_filter.c bsc_mgcp_utils.c bsc_nat.c bsc_nat_utils.c \ +libbsc_nat_a_SOURCES = \ + bsc_filter.c bsc_mgcp_utils.c bsc_nat_utils.c \ bsc_nat_vty.c bsc_sccp.c bsc_ussd.c bsc_nat_ctrl.c \ bsc_nat_rewrite.c bsc_nat_rewrite_trie.c bsc_nat_filter.c +osmo_bsc_nat_SOURCES = bsc_nat.c osmo_bsc_nat_LDADD = \ + libbsc_nat.a \ $(top_builddir)/src/libmgcp/libmgcp.a \ $(top_builddir)/src/libbsc/libbsc.a \ $(top_builddir)/src/libtrau/libtrau.a \ diff --git a/openbsc/tests/bsc-nat-trie/Makefile.am b/openbsc/tests/bsc-nat-trie/Makefile.am index cf8ebaf..64c71ba 100644 --- a/openbsc/tests/bsc-nat-trie/Makefile.am +++ b/openbsc/tests/bsc-nat-trie/Makefile.am @@ -6,9 +6,9 @@ EXTRA_DIST = bsc_nat_trie_test.ok prefixes.csv noinst_PROGRAMS = bsc_nat_trie_test -bsc_nat_trie_test_SOURCES = bsc_nat_trie_test.c \ - $(top_srcdir)/src/osmo-bsc_nat/bsc_nat_rewrite_trie.c -bsc_nat_trie_test_LDADD = $(top_builddir)/src/libbsc/libbsc.a \ +bsc_nat_trie_test_SOURCES = bsc_nat_trie_test.c +bsc_nat_trie_test_LDADD = $(top_builddir)/src/osmo-bsc_nat/libbsc_nat.a \ + $(top_builddir)/src/libbsc/libbsc.a \ $(top_builddir)/src/libmgcp/libmgcp.a \ $(top_builddir)/src/libtrau/libtrau.a \ $(top_builddir)/src/libcommon/libcommon.a \ diff --git a/openbsc/tests/bsc-nat/Makefile.am b/openbsc/tests/bsc-nat/Makefile.am index 26e5500..c1a5b1a 100644 --- a/openbsc/tests/bsc-nat/Makefile.am +++ b/openbsc/tests/bsc-nat/Makefile.am @@ -6,15 +6,10 @@ EXTRA_DIST = bsc_nat_test.ok bsc_data.c barr.cfg barr_dup.cfg prefixes.csv noinst_PROGRAMS = bsc_nat_test -bsc_nat_test_SOURCES = bsc_nat_test.c \ - $(top_srcdir)/src/osmo-bsc_nat/bsc_filter.c \ - $(top_srcdir)/src/osmo-bsc_nat/bsc_sccp.c \ - $(top_srcdir)/src/osmo-bsc_nat/bsc_nat_utils.c \ - $(top_srcdir)/src/osmo-bsc_nat/bsc_nat_rewrite.c \ - $(top_srcdir)/src/osmo-bsc_nat/bsc_nat_rewrite_trie.c \ - $(top_srcdir)/src/osmo-bsc_nat/bsc_mgcp_utils.c \ - $(top_srcdir)/src/osmo-bsc_nat/bsc_nat_filter.c +bsc_nat_test_SOURCES = bsc_nat_test.c + bsc_nat_test_LDADD = \ + $(top_builddir)/src/osmo-bsc_nat/libbsc_nat.a \ $(top_builddir)/src/libfilter/libfilter.a \ $(top_builddir)/src/libbsc/libbsc.a \ $(top_builddir)/src/libmgcp/libmgcp.a \ diff --git a/openbsc/tests/bsc/Makefile.am b/openbsc/tests/bsc/Makefile.am index 8b786ff..7c3a219 100644 --- a/openbsc/tests/bsc/Makefile.am +++ b/openbsc/tests/bsc/Makefile.am @@ -6,9 +6,9 @@ EXTRA_DIST = bsc_test.ok noinst_PROGRAMS = bsc_test -bsc_test_SOURCES = bsc_test.c \ - $(top_srcdir)/src/osmo-bsc/osmo_bsc_filter.c -bsc_test_LDADD = $(top_builddir)/src/libbsc/libbsc.a \ +bsc_test_SOURCES = bsc_test.c +bsc_test_LDADD = $(top_builddir)/src/osmo-bsc/libbsc.a \ + $(top_builddir)/src/libbsc/libbsc.a \ $(top_builddir)/src/libmsc/libmsc.a \ $(top_builddir)/src/libmgcp/libmgcp.a \ $(top_builddir)/src/libtrau/libtrau.a \ diff --git a/openbsc/tests/gprs/Makefile.am b/openbsc/tests/gprs/Makefile.am index 633c362..44d9965 100644 --- a/openbsc/tests/gprs/Makefile.am +++ b/openbsc/tests/gprs/Makefile.am @@ -5,7 +5,7 @@ EXTRA_DIST = gprs_test.ok noinst_PROGRAMS = gprs_test -gprs_test_SOURCES = gprs_test.c $(top_srcdir)/src/gprs/gprs_utils.c \ - $(top_srcdir)/src/gprs/gprs_gsup_messages.c +gprs_test_SOURCES = gprs_test.c -gprs_test_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) +gprs_test_LDADD = $(top_builddir)/src/gprs/libgprs.a \ + $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) diff --git a/openbsc/tests/smpp/Makefile.am b/openbsc/tests/smpp/Makefile.am index b3d4568..d36266d 100644 --- a/openbsc/tests/smpp/Makefile.am +++ b/openbsc/tests/smpp/Makefile.am @@ -6,7 +6,8 @@ EXTRA_DIST = smpp_test.ok smpp_test.err noinst_PROGRAMS = smpp_test -smpp_test_SOURCES = smpp_test.c \ - $(top_builddir)/src/libmsc/smpp_utils.c -smpp_test_LDADD = $(LIBOSMOCORE_LIBS) \ +smpp_test_SOURCES = smpp_test.c +smpp_test_LDADD = \ + $(top_builddir)/src/libmsc/libmsc.a + $(LIBOSMOCORE_LIBS) \ $(top_builddir)/src/libcommon/libcommon.a