Enable doc building on MacOS 99/3099/2
authorChris Luke <chrisy@flirble.org>
Fri, 23 Sep 2016 00:52:26 +0000 (20:52 -0400)
committerDamjan Marion <dmarion.lists@gmail.com>
Fri, 23 Sep 2016 07:52:28 +0000 (07:52 +0000)
Simple tweak to the Makefiles to allow "make doxygen" to work
natively on Macs - assuming the appropriate things have been
installed first, which it tests for.

Change-Id: I1a3e72759d533270a0512de38595c3bc3f71dee0
Signed-off-by: Chris Luke <chrisy@flirble.org>
Makefile
doxygen/Makefile

index b3bd8d3..59f14e3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -24,8 +24,11 @@ GDB_ARGS= -ex "handle SIGUSR1 noprint nostop"
 #
 # OS Detection
 #
+# We allow Darwin (MacOS) for docs generation; VPP build will still fail.
+ifneq ($(shell uname),Darwin)
 OS_ID        = $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
 OS_VERSION_ID= $(shell grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
+endif
 
 DEB_DEPENDS  = curl build-essential autoconf automake bison libssl-dev ccache
 DEB_DEPENDS += debhelper dkms git libtool libganglia1-dev libapr1-dev dh-systemd
index 97225f3..7031e84 100644 (file)
@@ -23,11 +23,20 @@ all: doxygen
 # These should be passed in by the root Makefile
 WS_ROOT ?= $(CURDIR)/..
 BR ?= $(WS_ROOT)/build-root
+
+# We support MacOS for docs generation
+ifeq ($(shell uname),Darwin)
+OS_ID = darwin
+endif
+
+# Work out the OS if we haven't already
 OS_ID ?= $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
 
 # Package dependencies
 DOC_DEB_DEPENDS = doxygen graphviz python-pyparsing python-jinja2
 DOC_RPM_DEPENDS = doxygen graphviz pyparsing python-jinja2
+DOC_MAC_BIN_DEPENDS = doxygen dot git
+DOC_MAC_PY_DEPENDS = pyparsing jinja2
 
 # Doxygen configuration and our utility scripts
 DOXY_DIR ?= $(WS_ROOT)/doxygen
@@ -130,8 +139,23 @@ ifeq ($(OS_ID),ubuntu)
        fi
 else ifneq ("$(wildcard /etc/redhat-release)","")
        @sudo yum install $(CONFIRM) $(DOC_RPM_DEPENDS)
+else ifeq ($(OS_ID),darwin)
+       @set -e; \
+       for bin in $(DOC_MAC_BIN_DEPENDS); do \
+               which -s $${bin} || (\
+                       echo "Program '$${bin}' not found, please install it."; \
+                       false; \
+               ); \
+       done
+       @set -e; \
+       for py in $(DOC_MAC_PY_DEPENDS); do \
+               python -c "import $${py}" >/dev/null 2>&1 || (\
+                       echo "Python package '$${py}' not found, please install it."; \
+                       false; \
+               ); \
+       done
 else
-       $(error "This option currently works only on Ubuntu or Centos systems")
+       $(error "Building documentation currently works only on Ubuntu, CentOS or MacOS systems.")
 endif
        @touch $@