Module: sip-router
Branch: andrei/cdefs2doc
Commit: e46889f5d4dd3c8a3ceff4480d1285805b1f5b0e
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e46889f…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Wed Feb 17 17:21:18 2010 +0100
doc: rpc_list: support for generating docbook output
- make docbook will generate the rpc lists in docbook format
- make all will generate both txt and docbook
- generate docbook index file (rpc_list.xml)
- configurable output directories (txt_output_dir and
docbook_output_dir)
---
doc/rpc_list/Makefile | 84 ++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 73 insertions(+), 11 deletions(-)
diff --git a/doc/rpc_list/Makefile b/doc/rpc_list/Makefile
index 18d6918..b4e7afd 100644
--- a/doc/rpc_list/Makefile
+++ b/doc/rpc_list/Makefile
@@ -4,6 +4,12 @@ COREPATH=../..
#include $(COREPATH)/Makefile.defs
CFG2TXT=../scripts/cdefs2doc/dump_rpcs.pl
+CFG2DOCBOOK=../scripts/cdefs2doc/dump_rpcs.pl
+
+# output directory for generated txt files
+txt_output_dir=.
+# output directory for generated docbook xml files
+docbook_output_dir=docbook
# list of files contanining rpc defs in the following format:
# <filename>:<cfg_grp_name>
@@ -64,7 +70,7 @@ get_grp=$(strip $(if $(grp_f_$(call get_bname,$(1))), \
$(call get_listed_grp,$(1))) ) )
# get target from file:grp (get_target(file:grp) => rpc_grp.txt)
-get_target=rpc_$(call get_grp,$(1)).txt
+get_target=rpc_$(call get_grp,$(1))
define mk_rules
@@ -72,17 +78,30 @@ $(call check_fname_grp, $(1))
#$$(info generating rpc_$$(call get_grp,$(1)).txt: $$(call get_prereq,$(1)))
-$$(call get_target,$(1)): $$(call get_prereq,$(1)) Makefile $(CFG2TXT)
+$(txt_output_dir)/$$(call get_target,$(1)).txt: \
+ $$(call get_prereq,$(1)) Makefile $(CFG2TXT)
$(CFG2TXT) --file $$< --$(force_grp)grp=$$(call get_grp,$(1)) \
- --gcc="$(gcc)" > "$$@" || (rm -f "$$@"; exit 1)
+ --gcc="$(gcc)" --txt > "$$@" || (rm -f "$$@"; exit
1)
+
+$(docbook_output_dir)/$$(call get_target,$(1)).xml: \
+ $$(call get_prereq,$(1)) Makefile $(CFG2TXT)
+ $(CFG2DOCBOOK) --file $$< --$(force_grp)grp=$$(call get_grp,$(1)) \
+ --gcc="$(gcc)" --docbook > "$$@" || (rm -f "$$@";
exit 1)
+
+
+clean_$$(call get_target,$(1)).txt:
+ rm -f "$(txt_output_dir)/$$(call get_target,$(1)).txt"
+clean_$$(call get_target,$(1)).xml:
+ rm -f "$(docbook_output_dir)/$$(call get_target,$(1)).xml"
-clean_$$(call get_target,$(1)):
- rm -f "$$(call get_target,$(1))"
+txt: $(txt_output_dir)/$$(call get_target,$(1)).txt
-all: $$(call get_target,$(1))
+docbook: $(docbook_output_dir)/$$(call get_target,$(1)).xml
-clean: clean_$$(call get_target,$(1))
+clean_txt: clean_$$(call get_target,$(1)).txt
+
+clean_docbook: clean_$$(call get_target,$(1)).xml
endef
@@ -92,22 +111,65 @@ endef
# GCC:TranslationUnit module, make all won't work)
.PHONY: help
help:
- @echo "To regenerate $(foreach f,$(flist),$(call get_target,$f) )"
+ @echo "To regenerate $(foreach f,$(flist),$(call get_target,$f).{txt,xml})"
@echo "type: $(MAKE) all ."
@echo "or to regenerate all the rpc lists by searching all"
@echo " the source files for definitions, type: $(MAKE) autogen ."
@echo "NOTE: you need the GCC:TranslationUnit perl module with an "
@echo "extra patch applied (see $(CFG2TXT) --patch)."
+.PHONY: txt
+txt:
+
+.PHONY: docbook
+docbook:
+
+.PHONY: clean_txt
+clean_txt:
+
+.PHONY: clean_docbook
+clean_docbook:
+
+
.PHONY: all
-all:
+all: txt $(docbook_output_dir)/rpc_list.xml
.PHONY: clean
-clean:
+clean: clean_txt clean_docbook
+ @rm -f $(docbook_output_dir)/rpc_list.xml
.PHONY: proper
proper:
- @rm -f rpc_*.txt
+ @rm -f $(txt_output_dir)/rpc_*.txt
+ @rm -f $(docbook_output_dir)/rpc_*.xml
+
+repo_ver="sip-router"\
+ "git-$(shell git rev-parse --verify --short=6 HEAD 2>/dev/null)"
+ifeq ($(repo_ver),git-)
+repo_ver="sip-router unknown"
+endif
+
+$(docbook_output_dir)/rpc_list.xml: \
+ $(foreach f,$(flist),$(docbook_output_dir)/$(call get_target,$f).xml)
+ @echo '<?xml version="1.0" encoding="UTF-8"?>' >$@
+ @echo '<!-- this file is autogenerated, do not edit! -->' >>$@
+ @echo '<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML
V4.2//EN"' >>$@
+ @echo ' "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">'
>>$@
+ @echo '<book id="rpc_list"'\
+ 'xmlns:xi="http://www.w3.org/2001/XInclude">' >>$@
+ @echo ' <title>RPC Exports List</title>' >>$@
+ @echo ' <info><revhistory><revision>' >>$@
+ @echo ' <revnumber>'$(repo_ver)'</revnumber>' >>$@
+ @echo ' <revremark>' >>$@
+ @echo " Automatically generated by:">>$@
+ @echo " $(MAKE) -C doc/rpc_list $(MAKECMDGOALS)" >>$@
+ @echo ' </revremark>' >>$@
+ @echo ' </revision></revhistory></info>' >>$@
+ @$(foreach f,$(flist),\
+ echo ' <xi:include'\
+ 'href="'$(call get_target,$f).xml'"/>' \
+ >>$@ ; )
+ @echo '</book>' >>$@
find_rpc_files_cmd= find $(COREPATH) -type f -name "*.c" \
-exec grep "rpc_export_t[ ][a-zA-Z0-9_]*\[\][ ]*=" /dev/null {} \; \