From 2f93254d2c929d0563c2ab8152da62ee0a91ea10 Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Thu, 8 Jul 2010 13:20:32 +0200 Subject: Prepare erl_docgen for using Dialyzer specs and types Support for using Dialyzer specifications and types has been added. This is an experimental release; changes are expected before the new functionality is used when building the OTP documentation. --- make/otp.mk.in | 29 +++++++++++++++++++++-------- make/otp_release_targets.mk | 44 ++++++++++++++++++++++++++++++++------------ 2 files changed, 53 insertions(+), 20 deletions(-) (limited to 'make') diff --git a/make/otp.mk.in b/make/otp.mk.in index 6ae7c5b456..bf287be416 100644 --- a/make/otp.mk.in +++ b/make/otp.mk.in @@ -209,6 +209,8 @@ MAN9DIR = $(DOCDIR)/man9 TEXDIR = . +SPECDIR = $(DOCDIR)/specs + # HTML & GIF files that always are generated and must be delivered SGML_COLL_FILES = $(SGML_APPLICATION_FILES) $(SGML_PART_FILES) XML_COLL_FILES = $(XML_APPLICATION_FILES) $(XML_PART_FILES) @@ -237,41 +239,52 @@ FOP = @FOP@ DOCGEN=$(ERL_TOP)/lib/erl_docgen +SPECS_ESRC = ../../src +# Extract specifications and types from Erlang source files (-spec, -type) +$(SPECDIR)/specs_%.xml: $(SPECS_ESRC)/%.erl + escript $(DOCGEN)/priv/bin/specs_gen.escript $(SPECS_FLAGS) -o$(dir $@) $< -$(MAN1DIR)/%.1:: %.xml +$(MAN1DIR)/%.1: %.xml date=`date +"%B %e %Y"`; \ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $< -$(MAN2DIR)/%.2:: %.xml +$(MAN2DIR)/%.2: %.xml date=`date +"%B %e %Y"`; \ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $< -$(MAN3DIR)/%.3:: %.xml +ifneq ($(wildcard $(SPECDIR)),) +$(MAN3DIR)/%.3: %.xml $(SPECDIR)/specs_%.xml + date=`date +"%B %e %Y"`; \ + specs_file=`pwd`/$(SPECDIR)/specs_$*.xml; \ + xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --stringparam specs_file "$$specs_file" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $< +else +$(MAN3DIR)/%.3: %.xml date=`date +"%B %e %Y"`; \ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $< +endif # left for compatability -$(MAN4DIR)/%.4:: %.xml +$(MAN4DIR)/%.4: %.xml date=`date +"%B %e %Y"`; \ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $< -$(MAN4DIR)/%.5:: %.xml +$(MAN4DIR)/%.5: %.xml date=`date +"%B %e %Y"`; \ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $< # left for compatability -$(MAN6DIR)/%.6:: %_app.xml +$(MAN6DIR)/%.6: %_app.xml date=`date +"%B %e %Y"`; \ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $< -$(MAN6DIR)/%.7:: %_app.xml +$(MAN6DIR)/%.7: %_app.xml date=`date +"%B %e %Y"`; \ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $< -$(MAN9DIR)/%.9:: %.xml +$(MAN9DIR)/%.9: %.xml date=`date +"%B %e %Y"`; \ xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $< diff --git a/make/otp_release_targets.mk b/make/otp_release_targets.mk index 7d433e738c..8058e634d4 100644 --- a/make/otp_release_targets.mk +++ b/make/otp_release_targets.mk @@ -21,13 +21,30 @@ # Targets for the new documentation support # ---------------------------------------------------- +ifneq ($(TOP_SPECS_FILE),) +TOP_SPECS_PARAM = --stringparam specs_file "`pwd`/$(TOP_SPECS_FILE)" +endif + +MOD2APP = $(ERL_TOP)/make/$(TARGET)/mod2app.xml +ifneq ($(wildcard $(MOD2APP)),) +MOD2APP_PARAM = --stringparam mod2app_file "$(MOD2APP)" +endif + ifeq ($(TOPDOC),) -$(HTMLDIR)/index.html: $(XML_FILES) +$(HTMLDIR)/index.html: $(XML_FILES) $(SPECS_FILES) date=`date +"%B %e %Y"`; \ - $(XSLTPROC) --noout --stringparam outdir $(HTMLDIR) --stringparam docgen "$(DOCGEN)" --stringparam topdocdir "$(TOPDOCDIR)" \ - --stringparam pdfdir "$(PDFDIR)" \ - --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude \ - -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_html_entities $(DOCGEN)/priv/xsl/db_html.xsl book.xml + $(XSLTPROC) --noout \ + --stringparam outdir $(HTMLDIR) \ + --stringparam docgen "$(DOCGEN)" \ + --stringparam topdocdir "$(TOPDOCDIR)" \ + --stringparam pdfdir "$(PDFDIR)" \ + --xinclude $(TOP_SPECS_PARAM) $(MOD2APP_PARAM) \ + --stringparam gendate "$$date" \ + --stringparam appname "$(APPLICATION)" \ + --stringparam appver "$(VSN)" \ + -path $(DOCGEN)/priv/docbuilder_dtd \ + -path $(DOCGEN)/priv/dtd_html_entities \ + $(DOCGEN)/priv/xsl/db_html.xsl book.xml endif $(HTMLDIR)/users_guide.html: $(XML_FILES) @@ -37,14 +54,17 @@ $(HTMLDIR)/users_guide.html: $(XML_FILES) --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude \ -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_html_entities $(DOCGEN)/priv/xsl/db_html.xsl book.xml - -%.fo: $(XML_FILES) +%.fo: $(XML_FILES) $(SPECS_FILES) date=`date +"%B %e %Y"`; \ - $(XSLTPROC) --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" \ - --stringparam appver "$(VSN)" --xinclude \ - -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_html_entities $(DOCGEN)/priv/xsl/db_pdf.xsl book.xml > $@ - - + $(XSLTPROC) \ + --stringparam docgen "$(DOCGEN)" \ + --stringparam gendate "$$date" \ + --stringparam appname "$(APPLICATION)" \ + --stringparam appver "$(VSN)" \ + --xinclude $(TOP_SPECS_PARAM) \ + -path $(DOCGEN)/priv/docbuilder_dtd \ + -path $(DOCGEN)/priv/dtd_html_entities \ + $(DOCGEN)/priv/xsl/db_pdf.xsl book.xml > $@ # ------------------------------------------------------------------------ # The following targets just exist in the documentation directory -- cgit v1.2.3