From c3f92adf6be41263eb466e074e4136d29b50b59a Mon Sep 17 00:00:00 2001 From: Chris Luke Date: Wed, 5 Oct 2016 15:45:19 -0400 Subject: Add support for using documentation siphons in multiple ways Experiental support for generating multiple output formats from the same siphoned data. Adds a contrived example to generate a plain list of all CLI commands (the "itemlist" format). Eventually we can consider moving the tempate procesisng into the Output class as well as a way to override how the data is traversed (ordered). Change-Id: I77629a74a8fa0c7e583993469dc50491f72f13e7 Signed-off-by: Chris Luke --- doxygen/Makefile | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'doxygen/Makefile') diff --git a/doxygen/Makefile b/doxygen/Makefile index 7031e84d523..92fa36352fe 100644 --- a/doxygen/Makefile +++ b/doxygen/Makefile @@ -121,6 +121,7 @@ SIPHONS ?= clicmd syscfg SIPHON_FILES = $(addprefix $(SIPHON_INPUT)/,$(addsuffix .siphon,$(SIPHONS))) SIPHON_DOCS = $(addprefix $(SIPHON_OUTPUT)/,$(addsuffix .md,$(SIPHONS))) +SIPHON_ITEMLIST = $(addprefix $(SIPHON_OUTPUT)/,$(addsuffix .itemlist,$(filter clicmd,$(SIPHONS)))) $(BR)/.doxygen-bootstrap.ok: Makefile @echo "Checking whether dependencies for Doxygen are installed..." @@ -200,24 +201,37 @@ $(SIPHON_FILES): $(BR)/.doxygen-bootstrap.ok \ --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 \ +# Evaluate this to build a siphon doc output target for each desired +# output type: +# $(eval $(call siphon-process,file_extension,output_type_name)) +define siphon-process +$(SIPHON_OUTPUT)/%.$(1): $(SIPHON_INPUT)/%.siphon \ $(DOXY_DIR)/siphon-process \ $(wildcard $(DOXY_DIR)/siphon/*.py) \ - $(wildcard $(DOXY_DIR)/siphon_templates/*/*.md) - @echo "Processing siphon from $(notdir $<)..." + $(wildcard $(DOXY_DIR)/siphon_templates/$(2)/*/*.$(1)) + @echo "Processing siphon for $(2) from $$(notdir $$<)..." @set -e; \ cd "$(WS_ROOT)"; \ $(DOXY_DIR)/siphon-process \ - --type=$(basename $(notdir $<)) \ - --output="$@" \ - "$<" + --type=$$(basename $$(notdir $$<)) \ + --format=$(2) \ + --output="$$@" \ + "$$<" +endef + +# Process the .siphon source fragments and render them into doxygen flavored +# markdown documentation +.DELETE_ON_ERROR: $(SIPHON_DOCS) +$(eval $(call siphon-process,md,markdown)) + +# Process the .siphon source fragments and render them into a list of cli +# commands. +.DELETE_ON_ERROR: $(SIPHON_ITEMLIST) +$(eval $(call siphon-process,itemlist,itemlist)) -# This target can be used just to generate the siphoned docs +# This target can be used just to generate the siphoned things .PHONY: doxygen-siphon -doxygen-siphon: $(SIPHON_DOCS) +doxygen-siphon: $(SIPHON_DOCS) $(SIPHON_ITEMLIST) # Generate the doxygen docs .PHONY: doxygen -- cgit 1.2.3-korg