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
This commit is contained in:
Oliver Smith 2018-11-14 14:25:18 +01:00
parent fc9426e02e
commit 2947683c3a
25 changed files with 131 additions and 79 deletions

20
.gitignore vendored
View File

@ -14,3 +14,23 @@ tests/test-usermanual.adoc
# 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

View File

@ -15,8 +15,11 @@ apt-get install \
(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',

View File

@ -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

51
Makefile.am Normal file
View File

@ -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

View File

@ -12,3 +12,5 @@ upload: $(UPLOAD_FILES)
clean:
-rm -rf $(CLEAN_FILES)
distclean: clean

46
configure.ac Normal file
View File

@ -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@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)

View File

@ -6,6 +6,8 @@ publish="$1"
osmo-clean-workspace.sh
autoreconf -fi
./configure
$MAKE $PARALLEL_MAKE
$MAKE $PARALLEL_MAKE check

6
osmo-gsm-manuals.pc.in Normal file
View File

@ -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@