aboutsummaryrefslogtreecommitdiffstats
path: root/doxygen/Makefile
diff options
context:
space:
mode:
authorChris Luke <chrisy@flirble.org>2016-09-12 08:55:13 -0400
committerChris Luke <chrisy@flirble.org>2016-09-21 15:42:25 -0400
commit90f52bf990791ea73479ffc50fc1eb3450de443a (patch)
treeffcd6f5a94c4fc1a44ce9a3e088f18449007e3db /doxygen/Makefile
parentce64b8e5b247149887caf77fd139d2a6880acbe6 (diff)
Refactor pre-Doxy siphon scripts; VPP-396
- Modularize the code to make the Siphon process easier to maintain. - Move much of the output rendering into Jinja2 templates. - Add syscfg siphon type for startup config documentation. - Add sample syscfg documentation. - Add clicfg and syscfg preamble docs, adapted from their wiki pages. - Fix sorting of CLI items across multiple directories. Change-Id: Ib8288fe005adfea68ceed75a38ff8eba25d3cc79 Signed-off-by: Chris Luke <chrisy@flirble.org>
Diffstat (limited to 'doxygen/Makefile')
-rw-r--r--doxygen/Makefile48
1 files changed, 36 insertions, 12 deletions
diff --git a/doxygen/Makefile b/doxygen/Makefile
index 0a69c2dfe21..97225f3cd57 100644
--- a/doxygen/Makefile
+++ b/doxygen/Makefile
@@ -16,14 +16,18 @@
# Build the documentation
#
+# Default target
+.PHONY: all
+all: doxygen
+
# These should be passed in by the root Makefile
WS_ROOT ?= $(CURDIR)/..
BR ?= $(WS_ROOT)/build-root
OS_ID ?= $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
# Package dependencies
-DOC_DEB_DEPENDS = doxygen graphviz python-pyparsing
-DOC_RPM_DEPENDS = doxygen graphviz pyparsing
+DOC_DEB_DEPENDS = doxygen graphviz python-pyparsing python-jinja2
+DOC_RPM_DEPENDS = doxygen graphviz pyparsing python-jinja2
# Doxygen configuration and our utility scripts
DOXY_DIR ?= $(WS_ROOT)/doxygen
@@ -104,19 +108,22 @@ SIPHON_OUTPUT ?= $(DOXY_OUTPUT)/siphon_docs
EXTRA_DOXY_INPUT += $(SIPHON_OUTPUT)
# All the siphon types we know about
-SIPHONS ?= clicmd
+SIPHONS ?= clicmd syscfg
SIPHON_FILES = $(addprefix $(SIPHON_INPUT)/,$(addsuffix .siphon,$(SIPHONS)))
SIPHON_DOCS = $(addprefix $(SIPHON_OUTPUT)/,$(addsuffix .md,$(SIPHONS)))
-$(BR)/.doxygen-bootstrap.ok:
+$(BR)/.doxygen-bootstrap.ok: Makefile
@echo "Checking whether dependencies for Doxygen are installed..."
ifeq ($(OS_ID),ubuntu)
@set -e; inst=; \
for i in $(DOC_DEB_DEPENDS); do \
dpkg-query --show $$i >/dev/null 2>&1 || inst="$$inst $$i"; \
done; \
- if [ "$$inst" ]; then sudo apt-get $(CONFIRM) $(FORCE) install $$inst; fi
+ if [ "$$inst" ]; then \
+ sudo apt-get update; \
+ sudo apt-get $(CONFIRM) $(FORCE) install $$inst; \
+ fi
@if [ ! -s /usr/lib/graphviz/config6a ]; then \
echo "Rebuidlding system Graphviz configuration."; \
sudo dot -c; \
@@ -145,8 +152,12 @@ $(BR)/.doxygen-siphon.dep: Makefile
# Include the source -> siphon dependencies
-include $(BR)/.doxygen-siphon.dep
+# Generate .siphon files that contain fragments of source file that
+# relate to the siphons we support.
.NOTPARALLEL: $(SIPHON_FILES)
-$(SIPHON_FILES): $(DOXY_DIR)/siphon_generate.py $(BR)/.doxygen-bootstrap.ok
+$(SIPHON_FILES): $(BR)/.doxygen-bootstrap.ok \
+ $(DOXY_DIR)/siphon-generate \
+ $(wildcard $(DOXY_DIR)/siphon/*.py)
@rm -rf "$(SIPHON_INPUT)" "$(SIPHON_OUTPUT)"
@mkdir -p "$(SIPHON_INPUT)" "$(SIPHON_OUTPUT)"
@touch $(SIPHON_INPUT)/files
@@ -159,23 +170,33 @@ $(SIPHON_FILES): $(DOXY_DIR)/siphon_generate.py $(BR)/.doxygen-bootstrap.ok
>> $(SIPHON_INPUT)/files; \
done
@echo "Generating siphons..."
- @set -e; cd "$(WS_ROOT)"; $(DOXY_DIR)/siphon_generate.py \
+ @set -e; \
+ cd "$(WS_ROOT)"; \
+ $(DOXY_DIR)/siphon-generate \
--output="$(SIPHON_INPUT)" \
"@$(SIPHON_INPUT)/files"
-
+# Process the .siphon source fragments and render them into doxygen flavored
+# markdown documentation
.DELETE_ON_ERROR: $(SIPHON_DOCS)
-$(SIPHON_OUTPUT)/%.md: $(SIPHON_INPUT)/%.siphon $(DOXY_DIR)/siphon_process.py
+$(SIPHON_OUTPUT)/%.md: $(SIPHON_INPUT)/%.siphon \
+ $(DOXY_DIR)/siphon-process \
+ $(wildcard $(DOXY_DIR)/siphon/*.py) \
+ $(wildcard $(DOXY_DIR)/siphon_templates/*/*.md)
@echo "Processing siphon from $(notdir $<)..."
- @set -e; cd "$(WS_ROOT)"; \
- $(DOXY_DIR)/siphon_process.py --type=$(basename $(notdir $<)) \
- --output="$(SIPHON_OUTPUT)" $< > $@
+ @set -e; \
+ cd "$(WS_ROOT)"; \
+ $(DOXY_DIR)/siphon-process \
+ --type=$(basename $(notdir $<)) \
+ --output="$@" \
+ "$<"
# This target can be used just to generate the siphoned docs
.PHONY: doxygen-siphon
doxygen-siphon: $(SIPHON_DOCS)
# Generate the doxygen docs
+.PHONY: doxygen
doxygen: $(SIPHON_DOCS)
@mkdir -p "$(DOXY_OUTPUT)"
@echo "Running Doxygen..."
@@ -189,6 +210,9 @@ doxygen: $(SIPHON_DOCS)
VERSION="`git describe --tags --dirty`" \
doxygen $(DOXY_DIR)/doxygen.cfg
+.PHONY: wipe-doxygen
wipe-doxygen:
rm -rf "$(BR)/docs" "$(BR)/.doxygen-siphon.d"
+.PHONY: clean
+clean: wipe-doxygen