From 98f79f0c47372b1774e7510bef0b2b8c1cdd89a7 Mon Sep 17 00:00:00 2001 From: Badlop Date: Fri, 23 Oct 2009 15:14:08 +0000 Subject: [PATCH] Add devdoc support to Makefiles SVN Revision: 2704 --- src/Makefile.in | 92 ++++++++++++++++++++++++++++++++++- src/ejabberd_zlib/Makefile.in | 20 ++++++++ src/eldap/Makefile.in | 22 +++++++++ src/mod_muc/Makefile.in | 19 ++++++++ src/mod_proxy65/Makefile.in | 19 ++++++++ src/mod_pubsub/Makefile.in | 19 ++++++++ src/odbc/Makefile.in | 19 ++++++++ src/pam/Makefile.in | 20 ++++++++ src/stun/Makefile.in | 19 ++++++++ src/tls/Makefile.in | 20 ++++++++ src/web/Makefile.in | 19 ++++++++ 11 files changed, 286 insertions(+), 2 deletions(-) diff --git a/src/Makefile.in b/src/Makefile.in index 484b1a0d5..15a87e767 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -138,7 +138,7 @@ all-recursive: $(ERLBEHAVBEAMS) all-recursive install-recursive uninstall-recursive \ -clean-recursive distclean-recursive \ +clean-recursive distclean-recursive devdoc-recursive \ mostlyclean-recursive maintainer-clean-recursive: @subdirs="$(SUBDIRS)"; for subdir in $$subdirs; do \ target=`echo $@|sed 's,-recursive,,'`; \ @@ -267,7 +267,7 @@ uninstall-all: uninstall-binary rm -rf $(SPOOLDIR) rm -rf $(LOGDIR) -clean: clean-recursive clean-local +clean: clean-recursive clean-local clean-devdoc clean-local: rm -f *.beam $(ERLSHLIBS) epam ejabberdctl.example @@ -294,3 +294,91 @@ changelog: --separate-daylogs --break-before-msg --reparagraph .. cat ../ChangeLog.old >> ../ChangeLog rm ../ChangeLog.old + + +## Devdoc definitions +SRCDIR=. +DDTDIR=. +DEVDOCDIR=../doc/devdoc +DEVDOC_ERLS = $(wildcard ../doc/devdoc/*.erl) +DEVDOC_BEAMS = $(DEVDOC_ERLS:.erl=.beam) +APPNAME = ejabberd +VSN = $(shell sed '/vsn/!d;s/\(.*\)"\(.*\)"\(.*\)/\2/' ./ejabberd.app) +.PHONY = all +HTMLS = $(SOURCES:%.erl=../doc/devdoc/%.html) +ERLHTMLS = $(SOURCES:%.erl=../doc/devdoc/%.erl.html) +SVGS = $(SOURCES:%.erl=../doc/devdoc/%.svg) +EDOCINDEX = $(DEVDOCDIR)/index.html + +## Devdoc rules +devdoc: compile-devdoc devdoc-root devdoc-recursive + $(devdoc-customize) + $(devdoc-move) +devdoc-root: $(EDOCINDEX) $(HTMLS) $(ERLHTMLS) $(SVGS) + +define devdoc-customize +find $(DDTDIR) -type f -name '*.erl.html' -exec sed -i 's/module<\/span>(\([A-Za-z0-9_]*\))/module<\/span>(\1<\/a>)/g;' {} \; +find $(DDTDIR) -type f -name '*.erl.html' -exec sed -i 's/arity="\([0-9]*\)" >\([A-Za-z0-9_]*\)\2<\/a>\([A-Za-z0-9_]*\)\/\([0-9]*\)\1\/\2<\/a>\1<\/a>/' >$${fn}.tmp ; \ + mv $${fn}.tmp $${fn} ; \ + sed -i 's/1<\/a> <\/link>
/<\/link>
1<\/a> /g;' $${fn} ; \
+done
+-mv *.erl.html $(DEVDOCDIR)
+
+find $(DDTDIR) -type f -name '*.html' -exec sed -i 's///g;' {} \;
+find $(DDTDIR) -type f -name '*.html' -exec sed -i 's/align=\"right\" border=\"0\" alt=\"erlang logo\"/alt=\"erlang logo\"><\/a>\"ejabberd<\/a>\"ejabberd<\/a>\"ProcessOne\"/g;'Module \([A-Za-z0-9_]*\)<\/h1>/

Module \1 [erl<\/a> svg<\/a>]<\/h1>/g;' {} \; +find $(DDTDIR) -type f -name '*.html' -exec sed -i 's/class="function">/class="function">/g;' {} \; +-for fn in *.html; do sed -i 's/ESCOFILENAME/'$${fn%.html}.erl.html'/g;' $${fn} ; done + +find $(DDTDIR) -type f -name '*.svg' -exec sed -i 's/xlink:href="EXP\([A-Za-z0-9_]*\).html#\([A-Za-z0-9_]*\)\/\([0-9_]*\)"/xlink:href="\1.html#\2-\3"/g;' {} \; +find $(DDTDIR) -type f -name '*.svg' -exec sed -i 's/xlink:href="PRI\([A-Za-z0-9_]*\).html#\([A-Za-z0-9_]*\)\/\([0-9_]*\)"/xlink:href="\1.html#\2-\3"/g;' {} \; +find $(DDTDIR) -type f -name '*.svg' -exec sed -i 's/xlink:href="APP\([A-Za-z0-9_]*\):\([A-Za-z0-9_]*\)\/\([0-9_]*\)"/xlink:href="\1.html#\2-\3"/g;' {} \; +find $(DDTDIR) -type f -name '*.svg' -exec sed -i 's/xlink:href="EXM\([A-Za-z0-9_]*\):\([A-Za-z0-9_]*\)\/\([0-9_]*\)"/xlink:href="http:\/\/www.process-one.net\/docs\/exmpp\/devdoc\/trunk\/\1.html#\2-\3"/g;' {} \; +find $(DDTDIR) -type f -name '*.svg' -exec sed -i 's/xlink:href="OTP\([A-Za-z0-9_]*\):\([A-Za-z0-9_]*\)\/\([0-9_]*\)"/xlink:href="http:\/\/www.erlang.org\/doc\/man\/\1.html#\2-\3"/g;' {} \; +find $(DDTDIR) -type f -name '*.svg' -exec sed -i 's/xlink:href="OTP\([A-Za-z0-9_]*\)\/\([0-9_]*\)"/xlink:href="http:\/\/www.erlang.org\/doc\/man\/erlang.html#\1-\2"/g;' {} \; +endef + +define devdoc-move +-rm *.dot +-mv *.html $(DEVDOCDIR) +-mv *.svg $(DEVDOCDIR) +endef + +compile-devdoc: $(DEVDOC_BEAMS) + [ ! -f funrelg.beam ] || mv funrelg.beam $(DEVDOCDIR) + [ ! -f escobar_hilite.beam ] || mv escobar_hilite.beam $(DEVDOCDIR) + [ ! -f escobar_run.beam ] || mv escobar_run.beam $(DEVDOCDIR) + +$(EDOCINDEX): + @ERL@ -noshell -run edoc_run application "'$(APPNAME)'" '"$(SRCDIR)"' \ + '[{dir,"$(DDTDIR)"},{packages,false},{todo,true},{private,true},{def,{vsn,"$(VSN)"}},{stylesheet,"process-one.css"},{overview,"overview.edoc"}]' -s init stop + sed -i 's/The ejabberd application<\/title>/<title>ejabberd devdoc<\/title><link rel="shortcut icon" href="favicon.ico" type="image\/x-icon"\/>/g;' $(DDTDIR)/index.html + mv edoc-info $(DEVDOCDIR) + mv *.png $(DEVDOCDIR) + cp *.html $(DEVDOCDIR) + @ERL@ -noshell -pa $(DEVDOCDIR) -run escobar_run dir $(SRCDIR) $(SRCDIR) -s init stop + @ERL@ -noshell -pa $(DEVDOCDIR) -run funrelg dir $(SRCDIR) $(SRCDIR) -s init stop + $(devdoc-customize) + $(devdoc-move) + +$(DEVDOCDIR)/%.erl.html: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run escobar_run file $< $(SRCDIR) -s init stop + +$(DEVDOCDIR)/%.html: %.erl + @ERL@ -noshell -run edoc_run file $< \ + '[{dir,"$(DDTDIR)"},{packages,false},{todo,true},{private,true},{def,{vsn,"$(VSN)"}},{stylesheet,"process-one.css"},{overview,"overview.edoc"}]' -s init stop + +$(DEVDOCDIR)/%.svg: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run funrelg file $< $(SRCDIR) -s init stop + +clean-devdoc: + rm -f $(DEVDOCDIR)/edoc-info + rm -f $(DEVDOCDIR)/erlang.png + rm -f $(DEVDOCDIR)/*.beam + rm -f $(DEVDOCDIR)/*.dot + rm -f $(DEVDOCDIR)/*.html + rm -f $(DEVDOCDIR)/*.svg diff --git a/src/ejabberd_zlib/Makefile.in b/src/ejabberd_zlib/Makefile.in index b572c1169..1f1e88460 100644 --- a/src/ejabberd_zlib/Makefile.in +++ b/src/ejabberd_zlib/Makefile.in @@ -61,3 +61,23 @@ distclean: clean TAGS: etags *.erl + + +DEVDOCDIR=../../doc/devdoc +DDTDIR=.. +HTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.html) +ERLHTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.erl.html) +SVGS = $(SOURCES:%.erl=../../doc/devdoc/%.svg) + +devdoc: $(HTMLS) $(ERLHTMLS) $(SVGS) + +$(DEVDOCDIR)/%.erl.html: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run escobar_run file $< $(DDTDIR) -s init stop + +$(DEVDOCDIR)/%.html: %.erl + @ERL@ -noshell -run edoc_run file $< \ + '[{dir,"$(DDTDIR)"},{packages,false},{todo,true},{private,true},{def,{vsn,"$(VSN)"}},{stylesheet,"process-one.css"},{overview,"overview.edoc"}]' -s init stop + +$(DEVDOCDIR)/%.svg: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run funrelg dir $< $(DDTDIR) -s init stop + diff --git a/src/eldap/Makefile.in b/src/eldap/Makefile.in index 50794018c..3291f17c4 100644 --- a/src/eldap/Makefile.in +++ b/src/eldap/Makefile.in @@ -47,3 +47,25 @@ distclean: clean TAGS: etags *.erl + +# Don't include ELDAPv3.erl in sources for Devdoc +SOURCES = eldap.erl eldap_filter.erl eldap.hrl eldap_pool.erl eldap_utils.erl + +DEVDOCDIR=../../doc/devdoc +DDTDIR=.. +HTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.html) +ERLHTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.erl.html) +SVGS = $(SOURCES:%.erl=../../doc/devdoc/%.svg) + +devdoc: $(HTMLS) $(ERLHTMLS) $(SVGS) + +$(DEVDOCDIR)/%.erl.html: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run escobar_run file $< $(DDTDIR) -s init stop + +$(DEVDOCDIR)/%.html: %.erl + @ERL@ -noshell -run edoc_run file $< \ + '[{dir,"$(DDTDIR)"},{packages,false},{todo,true},{private,true},{def,{vsn,"$(VSN)"}},{stylesheet,"process-one.css"},{overview,"overview.edoc"}]' -s init stop + +$(DEVDOCDIR)/%.svg: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run funrelg dir $< $(DDTDIR) -s init stop + diff --git a/src/mod_muc/Makefile.in b/src/mod_muc/Makefile.in index 5ede5e521..4d0fa11e0 100644 --- a/src/mod_muc/Makefile.in +++ b/src/mod_muc/Makefile.in @@ -40,3 +40,22 @@ distclean: clean TAGS: etags *.erl + +DEVDOCDIR=../../doc/devdoc +DDTDIR=.. +HTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.html) +ERLHTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.erl.html) +SVGS = $(SOURCES:%.erl=../../doc/devdoc/%.svg) + +devdoc: $(HTMLS) $(ERLHTMLS) $(SVGS) + +$(DEVDOCDIR)/%.erl.html: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run escobar_run file $< $(DDTDIR) -s init stop + +$(DEVDOCDIR)/%.html: %.erl + @ERL@ -noshell -run edoc_run file $< \ + '[{dir,"$(DDTDIR)"},{packages,false},{todo,true},{private,true},{def,{vsn,"$(VSN)"}},{stylesheet,"process-one.css"},{overview,"overview.edoc"}]' -s init stop + +$(DEVDOCDIR)/%.svg: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run funrelg dir $< $(DDTDIR) -s init stop + diff --git a/src/mod_proxy65/Makefile.in b/src/mod_proxy65/Makefile.in index 3fc94c662..4e6f6480d 100644 --- a/src/mod_proxy65/Makefile.in +++ b/src/mod_proxy65/Makefile.in @@ -36,3 +36,22 @@ distclean: clean TAGS: etags *.erl + +DEVDOCDIR=../../doc/devdoc +DDTDIR=.. +HTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.html) +ERLHTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.erl.html) +SVGS = $(SOURCES:%.erl=../../doc/devdoc/%.svg) + +devdoc: $(HTMLS) $(ERLHTMLS) $(SVGS) + +$(DEVDOCDIR)/%.erl.html: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run escobar_run file $< $(DDTDIR) -s init stop + +$(DEVDOCDIR)/%.html: %.erl + @ERL@ -noshell -run edoc_run file $< \ + '[{dir,"$(DDTDIR)"},{packages,false},{todo,true},{private,true},{def,{vsn,"$(VSN)"}},{stylesheet,"process-one.css"},{overview,"overview.edoc"}]' -s init stop + +$(DEVDOCDIR)/%.svg: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run funrelg dir $< $(DDTDIR) -s init stop + diff --git a/src/mod_pubsub/Makefile.in b/src/mod_pubsub/Makefile.in index 88bf2ba0c..846355457 100644 --- a/src/mod_pubsub/Makefile.in +++ b/src/mod_pubsub/Makefile.in @@ -44,3 +44,22 @@ mod_pubsub_odbc.erl: TAGS: etags *.erl + +DEVDOCDIR=../../doc/devdoc +DDTDIR=.. +HTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.html) +ERLHTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.erl.html) +SVGS = $(SOURCES:%.erl=../../doc/devdoc/%.svg) + +devdoc: $(HTMLS) $(ERLHTMLS) $(SVGS) + +$(DEVDOCDIR)/%.erl.html: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run escobar_run file $< $(DDTDIR) -s init stop + +$(DEVDOCDIR)/%.html: %.erl + @ERL@ -noshell -run edoc_run file $< \ + '[{dir,"$(DDTDIR)"},{packages,false},{todo,true},{private,true},{def,{vsn,"$(VSN)"}},{stylesheet,"process-one.css"},{overview,"overview.edoc"}]' -s init stop + +$(DEVDOCDIR)/%.svg: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run funrelg dir $< $(DDTDIR) -s init stop + diff --git a/src/odbc/Makefile.in b/src/odbc/Makefile.in index 3f4898d3a..adc0a3455 100644 --- a/src/odbc/Makefile.in +++ b/src/odbc/Makefile.in @@ -36,3 +36,22 @@ distclean: clean TAGS: etags *.erl + +DEVDOCDIR=../../doc/devdoc +DDTDIR=.. +HTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.html) +ERLHTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.erl.html) +SVGS = $(SOURCES:%.erl=../../doc/devdoc/%.svg) + +devdoc: $(HTMLS) $(ERLHTMLS) $(SVGS) + +$(DEVDOCDIR)/%.erl.html: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run escobar_run file $< $(DDTDIR) -s init stop + +$(DEVDOCDIR)/%.html: %.erl + @ERL@ -noshell -run edoc_run file $< \ + '[{dir,"$(DDTDIR)"},{packages,false},{todo,true},{private,true},{def,{vsn,"$(VSN)"}},{stylesheet,"process-one.css"},{overview,"overview.edoc"}]' -s init stop + +$(DEVDOCDIR)/%.svg: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run funrelg dir $< $(DDTDIR) -s init stop + diff --git a/src/pam/Makefile.in b/src/pam/Makefile.in index bde289402..83e6301db 100644 --- a/src/pam/Makefile.in +++ b/src/pam/Makefile.in @@ -45,3 +45,23 @@ distclean: clean TAGS: etags *.erl + + +DEVDOCDIR=../../doc/devdoc +DDTDIR=.. +HTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.html) +ERLHTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.erl.html) +SVGS = $(SOURCES:%.erl=../../doc/devdoc/%.svg) + +devdoc: $(HTMLS) $(ERLHTMLS) $(SVGS) + +$(DEVDOCDIR)/%.erl.html: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run escobar_run file $< $(DDTDIR) -s init stop + +$(DEVDOCDIR)/%.html: %.erl + @ERL@ -noshell -run edoc_run file $< \ + '[{dir,"$(DDTDIR)"},{packages,false},{todo,true},{private,true},{def,{vsn,"$(VSN)"}},{stylesheet,"process-one.css"},{overview,"overview.edoc"}]' -s init stop + +$(DEVDOCDIR)/%.svg: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run funrelg dir $< $(DDTDIR) -s init stop + diff --git a/src/stun/Makefile.in b/src/stun/Makefile.in index e77da8452..fd41613d5 100644 --- a/src/stun/Makefile.in +++ b/src/stun/Makefile.in @@ -36,3 +36,22 @@ distclean: clean TAGS: etags *.erl + +DEVDOCDIR=../../doc/devdoc +DDTDIR=.. +HTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.html) +ERLHTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.erl.html) +SVGS = $(SOURCES:%.erl=../../doc/devdoc/%.svg) + +devdoc: $(HTMLS) $(ERLHTMLS) $(SVGS) + +$(DEVDOCDIR)/%.erl.html: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run escobar_run file $< $(DDTDIR) -s init stop + +$(DEVDOCDIR)/%.html: %.erl + @ERL@ -noshell -run edoc_run file $< \ + '[{dir,"$(DDTDIR)"},{packages,false},{todo,true},{private,true},{def,{vsn,"$(VSN)"}},{stylesheet,"process-one.css"},{overview,"overview.edoc"}]' -s init stop + +$(DEVDOCDIR)/%.svg: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run funrelg dir $< $(DDTDIR) -s init stop + diff --git a/src/tls/Makefile.in b/src/tls/Makefile.in index 44142fa7e..855ead584 100644 --- a/src/tls/Makefile.in +++ b/src/tls/Makefile.in @@ -62,3 +62,23 @@ distclean: clean TAGS: etags *.erl + + +DEVDOCDIR=../../doc/devdoc +DDTDIR=.. +HTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.html) +ERLHTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.erl.html) +SVGS = $(SOURCES:%.erl=../../doc/devdoc/%.svg) + +devdoc: $(HTMLS) $(ERLHTMLS) $(SVGS) + +$(DEVDOCDIR)/%.erl.html: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run escobar_run file $< $(DDTDIR) -s init stop + +$(DEVDOCDIR)/%.html: %.erl + @ERL@ -noshell -run edoc_run file $< \ + '[{dir,"$(DDTDIR)"},{packages,false},{todo,true},{private,true},{def,{vsn,"$(VSN)"}},{stylesheet,"process-one.css"},{overview,"overview.edoc"}]' -s init stop + +$(DEVDOCDIR)/%.svg: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run funrelg dir $< $(DDTDIR) -s init stop + diff --git a/src/web/Makefile.in b/src/web/Makefile.in index 151f4c476..ee25cf90b 100644 --- a/src/web/Makefile.in +++ b/src/web/Makefile.in @@ -35,3 +35,22 @@ distclean: clean TAGS: etags *.erl + +DEVDOCDIR=../../doc/devdoc +DDTDIR=.. +HTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.html) +ERLHTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.erl.html) +SVGS = $(SOURCES:%.erl=../../doc/devdoc/%.svg) + +devdoc: $(HTMLS) $(ERLHTMLS) $(SVGS) + +$(DEVDOCDIR)/%.erl.html: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run escobar_run file $< $(DDTDIR) -s init stop + +$(DEVDOCDIR)/%.html: %.erl + @ERL@ -noshell -run edoc_run file $< \ + '[{dir,"$(DDTDIR)"},{packages,false},{todo,true},{private,true},{def,{vsn,"$(VSN)"}},{stylesheet,"process-one.css"},{overview,"overview.edoc"}]' -s init stop + +$(DEVDOCDIR)/%.svg: %.erl + @ERL@ -noshell -pa $(DEVDOCDIR) -run funrelg dir $< $(DDTDIR) -s init stop +