[libxml2] Rework documentation build system



commit 74580967664bea6ca71514afdbc41b4e9d3e7ca5
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Wed Mar 2 18:45:39 2022 +0100

    Rework documentation build system
    
    Since several generated files are under version control, their
    timestamps are essentially random and rebuilding documentation using
    Makefile rules can't work reliably. Simply add a phony rebuild target
    that regenerates the whole documentation and other files
    unconditionally.
    
        make -C doc rebuild

 configure.ac             |  7 -----
 doc/Makefile.am          | 72 ++++++++++--------------------------------------
 doc/devhelp/Makefile.am  | 11 ++------
 doc/examples/Makefile.am | 13 +++------
 doc/examples/index.py    | 13 +++------
 5 files changed, 25 insertions(+), 91 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d91d4f74..179f4a92 100644
--- a/configure.ac
+++ b/configure.ac
@@ -193,13 +193,6 @@ AC_ARG_WITH(lzma,
 AC_ARG_WITH(coverage,
 [  --with-coverage         build for code coverage with GCC (off)])
 
-AC_ARG_ENABLE(rebuild-docs,
-[  --enable-rebuild-docs[[=yes/no]]  rebuild some generated docs [[default=no]]])
-if test "$enable_rebuild_docs" = "yes" -a "$srcdir" != "."; then
-  AC_MSG_ERROR([cannot rebuild docs when builddir != srcdir])
-fi
-AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "yes"])
-
 dnl
 dnl hard dependencies on options
 dnl
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 07ed79dd..0205974f 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,16 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 SUBDIRS = . devhelp examples
 
-# The top-level SGML file.
-DOC_MAIN_XML_FILE=gnome-xml.xml
-
-# The directory containing the source code (if it contains documentation).
-DOC_SOURCE_DIR=..
-
-# A file in win32 depends upon one of the doc files
-WIN32_DIR=$(top_srcdir)/win32
-
-if REBUILD_DOCS
 EXTRA_DIST_wc = $(wildcard tutorial/*.html) \
     $(wildcard tutorial/*.c) \
     $(wildcard tutorial/images/*.png) \
@@ -19,7 +9,6 @@ EXTRA_DIST_wc = $(wildcard tutorial/*.html) \
     libxml2-api.xml \
     apibuild.py xmllint.xml xmlcatalog_man.xml \
     symbols.xml
-endif
 
 # Expanded form of EXTRA_DIST_wc
 #
@@ -87,57 +76,26 @@ EXTRA_DIST = \
 
 man_MANS = xmllint.1 xmlcatalog.1
 
-if REBUILD_DOCS
-docs: $(man_MANS)
-
-api: libxml2-api.xml libxml2-refs.xml $(WIN32_DIR)/libxml2.def.src
-
-web: xmllint.html xmlcatalog_man.html
-
-$(WIN32_DIR)/libxml2.def.src: libxml2-api.xml
-       -@(if [ -x $(XSLTPROC) ] ; then \
-         $(XSLTPROC) -o $(WIN32_DIR)/libxml2.def.src \
-         --nonet $(WIN32_DIR)/defgen.xsl libxml2-api.xml ; fi )
-
-source_file_deps = \
-       $(filter-out %/xmlversion.h, $(wildcard $(top_srcdir)/include/libxml/*.h)) \
-       $(top_srcdir)/include/libxml/xmlversion.h.in \
-       $(wildcard $(top_srcdir)/*.c)
-
-libxml2-api.xml libxml2-refs.xml ../libxml2.syms: apibuild.py symbols.xml syms.xsl checkapisym.xsl 
$(source_file_deps)
-       test -f $(top_srcdir)/include/libxml/xmlversion.h
-       (cd $(srcdir) && ./apibuild.py)
-       ($(XSLTPROC) $(srcdir)/checkapisym.xsl $(srcdir)/libxml2-api.xml)
-       ($(XSLTPROC) -o ../libxml2.syms $(srcdir)/syms.xsl $(srcdir)/symbols.xml)
-       -@(cd .. ; $(MAKE) rebuild_testapi)
-
-
-xmllint.1: xmllint.xml
-       -@($(XSLTPROC) --nonet xmllint.xml)
-
-xmllint.html: xmllint.xml
-       -@($(XSLTPROC) --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl 
xmllint.xml)
-
-xmlcatalog.1: xmlcatalog_man.xml
-       -@($(XSLTPROC) --nonet xmlcatalog_man.xml)
-
-xmlcatalog_man.html: xmlcatalog_man.xml
-       -@($(XSLTPROC) --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl 
xmlcatalog_man.xml)
+DOCBOOK_HTML = http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
+
+rebuild:
+       cd $(srcdir) && ./apibuild.py
+       cd $(srcdir) && $(XSLTPROC) checkapisym.xsl libxml2-api.xml
+       cd $(srcdir) && $(XSLTPROC) -o ../libxml2.syms syms.xsl symbols.xml
+       cd $(srcdir) && $(XSLTPROC) -o ../win32/libxml2.def.src ../win32/defgen.xsl libxml2-api.xml
+       cd $(srcdir) && $(XSLTPROC) --nonet xmllint.xml
+       cd $(srcdir) && $(XSLTPROC) --nonet -o xmllint.html $(DOCBOOK_HTML) xmllint.xml
+       cd $(srcdir) && $(XSLTPROC) --nonet xmlcatalog_man.xml
+       cd $(srcdir) && $(XSLTPROC) --nonet -o xmlcatalog_man.html $(DOCBOOK_HTML) xmlcatalog_man.xml
+       cd devhelp && $(MAKE) rebuild
+       cd examples && $(MAKE) rebuild
+       cd .. && $(MAKE) rebuild_testapi
 
 check-extra-dist:
        for f in $(EXTRA_DIST_wc) ; do echo $$f; done | sort -u >tmp.EXTRA_DIST_wc
        for f in $(EXTRA_DIST) ;    do echo $$f; done | sort    >tmp.EXTRA_DIST
        diff -u tmp.EXTRA_DIST_wc tmp.EXTRA_DIST
        rm -f tmp.EXTRA_DIST_wc tmp.EXTRA_DIST
-endif
-
-clean-local:
-       rm -f *~ *.bak *.hierarchy *.signals *-unused.txt
-
-maintainer-clean-local: clean-local
-       rm -rf libxml-decl-list.txt libxml-decl.txt 
-
-rebuild: api docs
 
 install-data-local: 
        $(MKDIR_P) $(DESTDIR)$(HTML_DIR)/tutorial
@@ -150,4 +108,4 @@ install-data-local:
        -$(INSTALL) -m 0644 $(srcdir)/tutorial/images/callouts/*.* \
                $(DESTDIR)$(HTML_DIR)/tutorial/images/callouts
 
-.PHONY: docs api web rebuild
+.PHONY: rebuild
diff --git a/doc/devhelp/Makefile.am b/doc/devhelp/Makefile.am
index 57156cc8..d70dc372 100644
--- a/doc/devhelp/Makefile.am
+++ b/doc/devhelp/Makefile.am
@@ -67,12 +67,5 @@ EXTRA_FORMAT=                                \
 
 EXTRA_DIST = devhelp2.xsl html.xsl
 
-if REBUILD_DOCS
-rebuild: libxml2.devhelp2 $(HTML_FILES)
-.PHONY: rebuild
-
-libxml2.devhelp2 $(HTML_FILES): devhelp2.xsl html.xsl $(top_srcdir)/doc/libxml2-api.xml
-       -@(if [ -x $(XSLTPROC) ] ; then \
-         echo Rebuilding devhelp2 files ; \
-         $(XSLTPROC) --nonet -o $(srcdir)/libxml2.devhelp2 $(srcdir)/devhelp2.xsl 
$(top_srcdir)/doc/libxml2-api.xml ; fi );
-endif
+rebuild:
+       (cd $(srcdir) && $(XSLTPROC) -o libxml2.devhelp2 devhelp2.xsl ../libxml2-api.xml)
diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am
index cd417848..4e375ff1 100644
--- a/doc/examples/Makefile.am
+++ b/doc/examples/Makefile.am
@@ -9,18 +9,13 @@ LDADD = $(RDL_LIBS) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(ICONV_
 
 CLEANFILES = *.tmp
 
-if REBUILD_DOCS
-rebuild: examples.xml index.html
-.PHONY: rebuild
-
-examples.xml: index.py $(check_PROGRAMS:=.c)
+rebuild:
        cd $(srcdir) && $(PYTHON) index.py
        $(MAKE) Makefile
-
-index.html: examples.xml examples.xsl
-       cd $(srcdir) && xsltproc examples.xsl examples.xml && echo "Rebuilt web page"
+       cd $(srcdir) && xsltproc examples.xsl examples.xml
        -cd $(srcdir) && xmllint --valid --noout index.html
-endif
+
+.PHONY: rebuild
 
 install-data-local: 
        $(MKDIR_P) $(DESTDIR)$(HTML_DIR)/examples
diff --git a/doc/examples/index.py b/doc/examples/index.py
index fa8b3970..422ab2ae 100755
--- a/doc/examples/index.py
+++ b/doc/examples/index.py
@@ -231,18 +231,13 @@ LDADD = $(RDL_LIBS) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(ICONV_
 
 CLEANFILES = *.tmp
 
-if REBUILD_DOCS
-rebuild: examples.xml index.html
-.PHONY: rebuild
-
-examples.xml: index.py $(check_PROGRAMS:=.c)
+rebuild:
        cd $(srcdir) && $(PYTHON) index.py
        $(MAKE) Makefile
-
-index.html: examples.xml examples.xsl
-       cd $(srcdir) && xsltproc examples.xsl examples.xml && echo "Rebuilt web page"
+       cd $(srcdir) && xsltproc examples.xsl examples.xml
        -cd $(srcdir) && xmllint --valid --noout index.html
-endif
+
+.PHONY: rebuild
 
 install-data-local: 
        $(MKDIR_P) $(DESTDIR)$(HTML_DIR)/examples


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]