Review at  https://gerrit.osmocom.org/3315

Makefile: Add check-deps target and run it by default

This target will do several quick tests to ensure all the required
dependencies needed to build all documents are installed on the system.
If a dependency is missing, we abort the build early. Otherwise we can
end up building documents which some content missing.

Change-Id: I9b86aedd3bfccd7ac00343c16b9d25adc605808d
---
M Makefile
1 file changed, 20 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals 
refs/changes/15/3315/1

diff --git a/Makefile b/Makefile
index fc8ebbf..a870bef 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-all:
+all: check-deps
        cd OsmoBTS; $(MAKE)
        cd OsmoNITB; $(MAKE)
        cd OsmoBSC; $(MAKE)
@@ -38,3 +38,22 @@
        #cd OsmoMGCP; $(MAKE) check
        #cd OsmoNAT; $(MAKE) check
        cd OsmoGSMTester; $(MAKE) check
+
+define check_dep_bin
+    @type $(1) >/dev/null 2>&1 || { echo >&2 "Binary '$(1)' not found in path, 
please install $(2)."; exit 1; }
+endef
+define check_dep_python2_module
+    @echo "import $(1)" | python2 - >/dev/null 2>&1 || { echo >&2 "Failed to 
import '$(1)' module, please install $(2)."; exit 1; }
+endef
+
+check-deps:
+       $(call check_dep_bin,mscgen,mscgen)
+       $(call check_dep_bin,xsltproc,libxslt)
+       $(call check_dep_bin,git,git)
+       $(call check_dep_bin,a2x,asciidoc)
+       $(call check_dep_bin,asciidoc,asciidoc)
+       $(call check_dep_bin,dblatex,dblatex)
+       $(call check_dep_bin,packetdiag,nwdiag)
+       $(call check_dep_bin,dot,graphviz)
+       $(call check_dep_bin,python2,python2)
+       $(call check_dep_python2_module,pychart,python2-pychart)

-- 
To view, visit https://gerrit.osmocom.org/3315
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b86aedd3bfccd7ac00343c16b9d25adc605808d
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <[email protected]>

Reply via email to