Change in osmo-gsm-manuals[master]: use autotools to add "make install" target

osmith gerrit-no-reply at lists.osmocom.org
Wed Nov 21 15:12:52 UTC 2018


osmith has submitted this change and it was merged. ( https://gerrit.osmocom.org/11725 )

Change subject: use autotools to add "make install" target
......................................................................

use autotools to add "make install" target

For reasoning why a transition to autotools is desired, see the commit
message of the previous patch in this series.

"make install" copies the "build", "common" dirs, as well as the "*.xsl"
files to $(prefix)/share/osmo-gsm-manuals. Prefix is typically
/usr/local. Also a pkg-config file gets installed, so the path of the
shared files can be looked up by autoconf scripts of the project
repositories. The check-depends script is installed to
$(prefix)/bin/osmo-gsm-manuals-check-depends and will be used by
project specific autoconf scripts, too.

All existing make targets ("make", "make check", "make upload") are
still working, users only need to run "autoreconf -fi" and
"./configure" beforehand.

Makefile.am uses custom install-data-hook and uninstall-local targets,
so we don't need to specify each file of the relevant subdirs in a
_DATA variable (no extra maintenance effort).

(moving manuals to project repositories 5/19)

Related: OS#3385
Change-Id: I8e7036fae062ee783cb132b14608827a82c5e7c7
---
M .gitignore
M INSTALL.txt
D Makefile
A Makefile.am
R OsmoBSC/Makefile.am
R OsmoBTS/Makefile.am
R OsmoGGSN/Makefile.am
R OsmoGSMTester/Makefile.am
R OsmoHLR/Makefile.am
R OsmoMGCP/Makefile.am
R OsmoMGW/Makefile.am
R OsmoMSC/Makefile.am
R OsmoNAT/Makefile.am
R OsmoNITB/Makefile.am
R OsmoPCU/Makefile.am
R OsmoSGSN/Makefile.am
R OsmoSIPConnector/Makefile.am
R OsmoSTP/Makefile.am
R OsmoTRX/Makefile.am
R OsmocomBB/Makefile.am
M build/Makefile.common.inc
A configure.ac
M contrib/jenkins.sh
A osmo-gsm-manuals.pc.in
R tests/Makefile.am
25 files changed, 131 insertions(+), 79 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Neels Hofmeyr: Looks good to me, approved



diff --git a/.gitignore b/.gitignore
index fbe2111..30bc93e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,23 @@
 # git-version-gen
 .tarball-version
 .version
+
+# autotools
+aclocal.m4
+autom4te.cache/
+config.log
+config.status
+config.guess
+config.sub
+configure
+compile
+depcomp
+install-sh
+missing
+stamp-h1
+libtool
+ltmain.sh
+m4/*.m4
+*.pc
+Makefile.in
+Makefile
diff --git a/INSTALL.txt b/INSTALL.txt
index 9c3ee7b..6efe8d1 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -15,8 +15,11 @@
 (Note that asciidoc-dblatex is required from debian 9 on and did not exist before.)
 
 Build PDFs, run:
+  autoreconf -fi
+  ./configure
   make
-or for a parallel build using more CPU cores:
+
+or for a parallel build using more CPU cores, replace make with:
   make -j 5
 
 To update the VTY reference for a given program, use 'osmo_interact_vty.py -X',
diff --git a/Makefile b/Makefile
deleted file mode 100644
index c94f0a8..0000000
--- a/Makefile
+++ /dev/null
@@ -1,78 +0,0 @@
-all: check-deps
-	cd OsmoBTS; $(MAKE)
-	cd OsmoNITB; $(MAKE)
-	cd OsmoBSC; $(MAKE)
-	cd OsmoMGCP; $(MAKE)
-	cd OsmoSGSN; $(MAKE)
-	cd OsmoGGSN; $(MAKE)
-	cd OsmoNAT; $(MAKE)
-	cd OsmoPCU; $(MAKE)
-	cd OsmoGSMTester; $(MAKE)
-	cd OsmoMSC; $(MAKE)
-	cd OsmoHLR; $(MAKE)
-	cd OsmoSIPConnector; $(MAKE)
-	cd OsmoSTP; $(MAKE)
-	cd OsmocomBB; $(MAKE)
-	cd OsmoMGW; $(MAKE)
-	cd OsmoTRX; $(MAKE)
-
-clean:
-	cd tests; $(MAKE) clean
-	cd OsmoBTS; $(MAKE) clean
-	cd OsmoNITB; $(MAKE) clean
-	cd OsmoBSC; $(MAKE) clean
-	cd OsmoMGCP; $(MAKE) clean
-	cd OsmoSGSN; $(MAKE) clean
-	cd OsmoGGSN; $(MAKE) clean
-	cd OsmoNAT; $(MAKE) clean
-	cd OsmoPCU; $(MAKE) clean
-	cd OsmoGSMTester; $(MAKE) clean
-	cd OsmoMSC; $(MAKE) clean
-	cd OsmoHLR; $(MAKE) clean
-	cd OsmoSIPConnector; $(MAKE) clean
-	cd OsmoSTP; $(MAKE) clean
-	cd OsmocomBB; $(MAKE) clean
-	cd OsmoMGW; $(MAKE) clean
-	cd OsmoTRX; $(MAKE) clean
-
-upload:
-	cd OsmoBTS; $(MAKE) upload
-	cd OsmoNITB; $(MAKE) upload
-	cd OsmoBSC; $(MAKE) upload
-	cd OsmoMGCP; $(MAKE) upload
-	cd OsmoSGSN; $(MAKE) upload
-	cd OsmoGGSN; $(MAKE) upload
-	cd OsmoNAT; $(MAKE) upload
-	cd OsmoPCU; $(MAKE) upload
-	cd OsmoGSMTester; $(MAKE) upload
-	cd OsmoMSC; $(MAKE) upload
-	cd OsmoHLR; $(MAKE) upload
-	cd OsmoSIPConnector; $(MAKE) upload
-	cd OsmoSTP; $(MAKE) upload
-	cd OsmocomBB; $(MAKE) upload
-	cd OsmoMGW; $(MAKE) upload
-	cd OsmoTRX; $(MAKE) upload
-
-check:
-	cd tests; $(MAKE)
-	cd OsmoBTS; $(MAKE) check
-	cd OsmoNITB; $(MAKE) check
-	cd OsmoBSC; $(MAKE) check
-	cd OsmoSGSN; $(MAKE) check
-	cd OsmoGGSN; $(MAKE) check
-	cd OsmoPCU; $(MAKE) check
-	cd OsmoSTP; $(MAKE) check
-	# These don't use asciidoc, so they have no 'make check' target:
-	#cd OsmoMGCP; $(MAKE) check
-	#cd OsmoNAT; $(MAKE) check
-	#cd OsmoMGW; $(MAKE) check
-	cd OsmoGSMTester; $(MAKE) check
-	cd OsmoMSC; $(MAKE) check
-	cd OsmoHLR; $(MAKE) check
-	cd OsmoSIPConnector; $(MAKE) check
-	cd OsmoSTP; $(MAKE) check
-	cd OsmocomBB; $(MAKE) check
-	cd OsmoTRX; $(MAKE) check
-
-check-deps:
-	./check-depends.sh
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..dc8f1ca
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,51 @@
+share_files = $(srcdir)/build $(srcdir)/common $(srcdir)/*.xsl
+share_path = "$(DESTDIR)$(prefix)/share/osmo-gsm-manuals"
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = osmo-gsm-manuals.pc
+BUILT_SOURCES = $(top_srcdir)/.version
+EXTRA_DIST = git-version-gen .version check-depends.sh $(share_files)
+SUBDIRS = tests \
+	OsmoBSC \
+	OsmoBTS \
+	OsmoGGSN \
+	OsmoGSMTester \
+	OsmoHLR \
+	OsmoMGCP \
+	OsmoMGW \
+	OsmoMSC \
+	OsmoNAT \
+	OsmoNITB \
+	OsmoPCU \
+	OsmoSGSN \
+	OsmoSIPConnector \
+	OsmoSTP \
+	OsmoTRX \
+	OsmocomBB
+
+$(top_srcdir)/.version:
+	echo $(VERSION) > $@-t && mv $@-t $@
+
+dist-hook:
+	echo $(VERSION) > $(distdir)/.tarball-version
+
+install-data-hook:
+	cd "$(srcdir)" && \
+		files="$$(find $(notdir $(share_files)) -not -type d)" && \
+		for i in $$files; do \
+			if [ -x "$$i" ]; then \
+				mode=755; \
+			else \
+				mode=644; \
+			fi; \
+			install -vDm$$mode "$$i" "$(share_path)/$$i" || exit 1; \
+		done;
+	install -Dm755 "$(srcdir)/check-depends.sh" "$(DESTDIR)$(prefix)/bin/osmo-gsm-manuals-check-depends"
+
+uninstall-local:
+	rm -rv "$(share_path)" "$(DESTDIR)$(prefix)/bin/osmo-gsm-manuals-check-depends"
+
+upload:
+	for i in Osmo*; do \
+		$(MAKE) -C "$$i" upload || exit 1; \
+	done
diff --git a/OsmoBSC/Makefile b/OsmoBSC/Makefile.am
similarity index 100%
rename from OsmoBSC/Makefile
rename to OsmoBSC/Makefile.am
diff --git a/OsmoBTS/Makefile b/OsmoBTS/Makefile.am
similarity index 100%
rename from OsmoBTS/Makefile
rename to OsmoBTS/Makefile.am
diff --git a/OsmoGGSN/Makefile b/OsmoGGSN/Makefile.am
similarity index 100%
rename from OsmoGGSN/Makefile
rename to OsmoGGSN/Makefile.am
diff --git a/OsmoGSMTester/Makefile b/OsmoGSMTester/Makefile.am
similarity index 100%
rename from OsmoGSMTester/Makefile
rename to OsmoGSMTester/Makefile.am
diff --git a/OsmoHLR/Makefile b/OsmoHLR/Makefile.am
similarity index 100%
rename from OsmoHLR/Makefile
rename to OsmoHLR/Makefile.am
diff --git a/OsmoMGCP/Makefile b/OsmoMGCP/Makefile.am
similarity index 100%
rename from OsmoMGCP/Makefile
rename to OsmoMGCP/Makefile.am
diff --git a/OsmoMGW/Makefile b/OsmoMGW/Makefile.am
similarity index 100%
rename from OsmoMGW/Makefile
rename to OsmoMGW/Makefile.am
diff --git a/OsmoMSC/Makefile b/OsmoMSC/Makefile.am
similarity index 100%
rename from OsmoMSC/Makefile
rename to OsmoMSC/Makefile.am
diff --git a/OsmoNAT/Makefile b/OsmoNAT/Makefile.am
similarity index 100%
rename from OsmoNAT/Makefile
rename to OsmoNAT/Makefile.am
diff --git a/OsmoNITB/Makefile b/OsmoNITB/Makefile.am
similarity index 100%
rename from OsmoNITB/Makefile
rename to OsmoNITB/Makefile.am
diff --git a/OsmoPCU/Makefile b/OsmoPCU/Makefile.am
similarity index 100%
rename from OsmoPCU/Makefile
rename to OsmoPCU/Makefile.am
diff --git a/OsmoSGSN/Makefile b/OsmoSGSN/Makefile.am
similarity index 100%
rename from OsmoSGSN/Makefile
rename to OsmoSGSN/Makefile.am
diff --git a/OsmoSIPConnector/Makefile b/OsmoSIPConnector/Makefile.am
similarity index 100%
rename from OsmoSIPConnector/Makefile
rename to OsmoSIPConnector/Makefile.am
diff --git a/OsmoSTP/Makefile b/OsmoSTP/Makefile.am
similarity index 100%
rename from OsmoSTP/Makefile
rename to OsmoSTP/Makefile.am
diff --git a/OsmoTRX/Makefile b/OsmoTRX/Makefile.am
similarity index 100%
rename from OsmoTRX/Makefile
rename to OsmoTRX/Makefile.am
diff --git a/OsmocomBB/Makefile b/OsmocomBB/Makefile.am
similarity index 100%
rename from OsmocomBB/Makefile
rename to OsmocomBB/Makefile.am
diff --git a/build/Makefile.common.inc b/build/Makefile.common.inc
index e624b5f..6a210bc 100644
--- a/build/Makefile.common.inc
+++ b/build/Makefile.common.inc
@@ -12,3 +12,5 @@
 
 clean:
 	-rm -rf $(CLEAN_FILES)
+
+distclean: clean
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..e890b3e
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,46 @@
+dnl Process this file with autoconf to produce a configure script
+AC_INIT([osmo-gsm-manuals],
+	m4_esyscmd([./git-version-gen .tarball-version]),
+	[openbsc at lists.osmocom.org])
+
+dnl *This* is the root dir, even if an install-sh exists in ../ or ../../
+AC_CONFIG_AUX_DIR([.])
+
+AM_INIT_AUTOMAKE([foreign dist-bzip2 1.6 subdir-objects])
+
+dnl checks for programs
+AC_PROG_INSTALL
+LT_INIT
+
+dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
+AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
+if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
+        AC_MSG_WARN([You need to install pkg-config])
+fi
+PKG_PROG_PKG_CONFIG([0.20])
+
+if ! $srcdir/check-depends.sh
+then
+	AC_MSG_ERROR("missing dependencies!")
+fi
+
+AC_OUTPUT(
+    osmo-gsm-manuals.pc
+    Makefile
+    tests/Makefile
+    OsmoBSC/Makefile
+    OsmoBTS/Makefile
+    OsmoGGSN/Makefile
+    OsmoGSMTester/Makefile
+    OsmoHLR/Makefile
+    OsmoMGCP/Makefile
+    OsmoMGW/Makefile
+    OsmoMSC/Makefile
+    OsmoNAT/Makefile
+    OsmoNITB/Makefile
+    OsmoPCU/Makefile
+    OsmoSGSN/Makefile
+    OsmoSIPConnector/Makefile
+    OsmoSTP/Makefile
+    OsmoTRX/Makefile
+    OsmocomBB/Makefile)
diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
index 80d873d..1fd19d1 100755
--- a/contrib/jenkins.sh
+++ b/contrib/jenkins.sh
@@ -6,6 +6,8 @@
 
 osmo-clean-workspace.sh
 
+autoreconf -fi
+./configure
 $MAKE $PARALLEL_MAKE
 $MAKE $PARALLEL_MAKE check
 
diff --git a/osmo-gsm-manuals.pc.in b/osmo-gsm-manuals.pc.in
new file mode 100644
index 0000000..f9b318e
--- /dev/null
+++ b/osmo-gsm-manuals.pc.in
@@ -0,0 +1,6 @@
+prefix=@prefix@
+osmogsmmanualsdir=@prefix@/share/osmo-gsm-manuals
+
+Name: Osmocom GSM Manuals Development Files
+Description: Common files for building manuals of Osmocom programs
+Version: @VERSION@
diff --git a/tests/Makefile b/tests/Makefile.am
similarity index 100%
rename from tests/Makefile
rename to tests/Makefile.am

-- 
To view, visit https://gerrit.osmocom.org/11725
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8e7036fae062ee783cb132b14608827a82c5e7c7
Gerrit-Change-Number: 11725
Gerrit-PatchSet: 7
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181121/838da546/attachment.html>


More information about the gerrit-log mailing list