[GTK] Streamline wk1 documentation build
authorkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Oct 2011 00:35:07 +0000 (00:35 +0000)
committerkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Oct 2011 00:35:07 +0000 (00:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=70447

Reviewed by Martin Robinson.

.:

* GNUmakefile.am: include the documentation's GNUmakefile.am;
* autogen.sh: we no longer call gtkdocize, since we now ship
  a modified gtk-doc.make;
* configure.ac: no longer generate a separate GNUmakefile for
  the documentation build.

Source/WebKit/gtk:

* GNUmakefile.am: move files pertaining to the docs build to the
  docs GNUmakefile.am;
* GNUmakefile.gtk-doc.make: incorporate the gtk-doc makefile, and customize it
  to our non-recursive build;
* docs/GNUmakefile.am: simplification and adaption to work with the
  rest of the build system.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@97901 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
GNUmakefile.am
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/GNUmakefile.am
Source/WebKit/gtk/GNUmakefile.gtk-doc.am [new file with mode: 0644]
Source/WebKit/gtk/docs/GNUmakefile.am
autogen.sh
configure.ac

index dd75aec..9e22a95 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2011-10-19  Gustavo Noronha Silva  <gns@gnome.org>
+
+        [GTK] Streamline wk1 documentation build
+        https://bugs.webkit.org/show_bug.cgi?id=70447
+
+        Reviewed by Martin Robinson.
+
+        * GNUmakefile.am: include the documentation's GNUmakefile.am;
+        * autogen.sh: we no longer call gtkdocize, since we now ship
+          a modified gtk-doc.make;
+        * configure.ac: no longer generate a separate GNUmakefile for
+          the documentation build.
+
 2011-10-18  Adam Barth  <abarth@webkit.org>
 
         Always enable ENABLE(XPATH)
index 06fcc7d..d5e71f1 100644 (file)
@@ -194,18 +194,19 @@ endif
 
 EXTRA_DIST += \
        $(srcdir)/Source/autotools/symbols.filter \
-       $(srcdir)/gtk-doc.make \
        $(srcdir)/Source/WebKit/LICENSE
 
 # Include module makefiles
 if USE_JSC
 include Source/JavaScriptCore/GNUmakefile.am
 endif
+
 include Source/WebCore/GNUmakefile.am
 include Source/WebKit/gtk/GNUmakefile.am
 include Source/WebCore/bindings/gobject/GNUmakefile.am
 include Tools/GNUmakefile.am
 include Source/WebKit/gtk/po/GNUmakefile.am
+include Source/WebKit/gtk/docs/GNUmakefile.am
 include Tools/DumpRenderTree/gtk/GNUmakefile.ImageDiff.am
 
 if ENABLE_WEBKIT2
index 713ade0..27f5aa8 100644 (file)
@@ -1,3 +1,17 @@
+2011-10-19  Gustavo Noronha Silva  <gns@gnome.org>
+
+        [GTK] Streamline wk1 documentation build
+        https://bugs.webkit.org/show_bug.cgi?id=70447
+
+        Reviewed by Martin Robinson.
+
+        * GNUmakefile.am: move files pertaining to the docs build to the
+          docs GNUmakefile.am;
+        * GNUmakefile.gtk-doc.make: incorporate the gtk-doc makefile, and customize it
+          to our non-recursive build;
+        * docs/GNUmakefile.am: simplification and adaption to work with the
+          rest of the build system.
+
 2011-10-19  Zan Dobersek  <zandobersek@gmail.com>
 
         [Gtk][Geolocation] Build guards missing in geolocation clients
index d2eabab..670e915 100644 (file)
@@ -383,11 +383,7 @@ EXTRA_DIST += \
        $(WebKit)/ChangeLog \
        $(WebKit)/NEWS \
        $(WebKit)/webkitmarshal.list \
-       $(WebKit)/docs/GNUmakefile.* \
-       $(WebKit)/docs/webkitenvironment.xml \
-       $(WebKit)/docs/webkitgtk-docs.sgml \
-       $(WebKit)/docs/webkitgtk-sections.txt \
-       $(WebKit)/docs/version.xml.in \
+       $(WebKit)/GNUmakefile.gtk-doc.am \
        $(WebKit)/po/* \
        $(WebKit)/resources/* \
        $(WebKit)/tests/resources/* \
@@ -591,8 +587,6 @@ CLEANFILES += \
        $(top_builddir)/Programs/GtkLauncher
 
 DISTCLEANFILES += \
-       $(top_builddir)/Source/WebKit/gtk/docs/version.xml \
-       $(top_builddir)/Source/WebKit/gtk/docs/GNUmakefile \
        $(top_builddir)/Source/WebKit/gtk/@WEBKITGTK_PC_NAME@-@WEBKITGTK_API_VERSION@.pc \
        $(top_builddir)/Source/WebKit/gtk/org.webkitgtk-@WEBKITGTK_API_VERSION@.gschema.xml \
        $(top_builddir)/Source/WebKit/gtk/webkit/webkitversion.h
diff --git a/Source/WebKit/gtk/GNUmakefile.gtk-doc.am b/Source/WebKit/gtk/GNUmakefile.gtk-doc.am
new file mode 100644 (file)
index 0000000..b372f2b
--- /dev/null
@@ -0,0 +1,215 @@
+# -*- mode: makefile -*-
+
+GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
+GTKDOC_RUN = $(LIBTOOL) --mode=execute
+
+# We set GPATH here; this gives us semantics for GNU make
+# which are more like other make's VPATH, when it comes to
+# whether a source that is a target of one rule is then
+# searched for in VPATH/GPATH.
+#
+GPATH = $(srcdir)
+
+TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
+
+SETUP_FILES = \
+       $(DOC_MAIN_SGML_FILE)           \
+       webkitenvironment.xml           \
+       $(DOC_MODULE)-sections.txt      \
+       $(DOC_MODULE)-overrides.txt
+
+EXTRA_DIST += \
+       $(HTML_IMAGES)                  \
+       $(SETUP_FILES)
+
+DOC_STAMPS=doc-setup-build.stamp scan-build.stamp tmpl-build.stamp sgml-build.stamp \
+       html-build.stamp pdf-build.stamp \
+       tmpl.stamp sgml.stamp html.stamp pdf.stamp
+
+SCANOBJ_FILES =                 \
+       $(DOC_MODULE).args       \
+       $(DOC_MODULE).hierarchy  \
+       $(DOC_MODULE).interfaces \
+       $(DOC_MODULE).prerequisites \
+       $(DOC_MODULE).signals
+
+REPORT_FILES = \
+       $(DOC_MODULE)-undocumented.txt \
+       $(DOC_MODULE)-undeclared.txt \
+       $(DOC_MODULE)-unused.txt
+
+CLEANFILES += $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
+
+if ENABLE_GTK_DOC
+HTML_BUILD_STAMP=html-build.stamp
+endif
+
+doc_srcdir := $(abs_srcdir)/Source/WebKit/gtk/docs
+
+docs: $(HTML_BUILD_STAMP)
+
+$(REPORT_FILES): sgml-build.stamp
+
+#### setup ####
+
+doc-setup-build.stamp: libwebkitgtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la
+       -@mkdir -p Documentation
+       -@ln -fs ../doltlibtool Documentation/
+       -@ln -fs ../doltcompile Documentation/
+       -@ln -fs ../libtool Documentation/
+       -@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
+           echo '  DOC   Preparing build'; \
+           files=`echo $(SETUP_FILES) $(DOC_MODULE).types`; \
+           if test "x$$files" != "x" ; then \
+               for file in $$files ; do \
+                   test -f $(doc_srcdir)/$$file && \
+                       cp -pu $(doc_srcdir)/$$file $(abs_builddir)/Documentation/ || true; \
+               done; \
+           fi; \
+           test -d $(doc_srcdir)/tmpl && \
+               { cp -rp $(doc_srcdir)/tmpl $(abs_builddir)/Documentation/; \
+               chmod -R u+w $(abs_builddir)/Documentation/tmpl; } \
+       fi
+       @touch doc-setup-build.stamp
+
+#### scan ####
+
+scan-build.stamp: doc-setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
+       @echo '  DOC   Scanning header files'
+       @cd Documentation; _source_dir='' ; \
+       for i in $(DOC_SOURCE_DIR) ; do \
+           _source_dir="$${_source_dir} --source-dir=../$$i" ; \
+       done ; \
+       gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES)
+       @cd Documentation; if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
+           echo "  DOC   Introspecting gobjects"; \
+           scanobj_options=""; \
+           gtkdoc-scangobj 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
+           if test "$(?)" = "0"; then \
+               if test "x$(V)" = "x1"; then \
+                   scanobj_options="--verbose"; \
+               fi; \
+           fi; \
+           CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \
+           gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \
+       else \
+           for i in $(SCANOBJ_FILES) ; do \
+               test -f $$i || touch $$i ; \
+           done \
+       fi
+       @touch scan-build.stamp
+
+Documentation/$(DOC_MODULE)-decl.txt Documentation/$(SCANOBJ_FILES) Documentation/$(DOC_MODULE)-sections.txt Documentation/$(DOC_MODULE)-overrides.txt: scan-build.stamp
+       @true
+
+#### templates ####
+
+tmpl-build.stamp: doc-setup-build.stamp Documentation/$(DOC_MODULE)-decl.txt Documentation/$(SCANOBJ_FILES) Documentation/$(DOC_MODULE)-sections.txt Documentation/$(DOC_MODULE)-overrides.txt
+       @echo '  DOC   Rebuilding template files'
+       @cd Documentation; gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS)
+       @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
+         if test -w $(abs_srcdir) ; then \
+           cp -rp $(abs_builddir)/Documentation/tmpl $(doc_srcdir); \
+         fi \
+       fi
+       @touch tmpl-build.stamp
+
+tmpl.stamp: tmpl-build.stamp
+       @true
+
+$(srcdir)/tmpl/*.sgml:
+       @true
+
+#### xml ####
+
+sgml-build.stamp: doc-setup-build.stamp tmpl.stamp Documentation/$(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml
+       @echo '  DOC   Building XML'
+       @-chmod -R u+w $(srcdir)
+       @cd Documentation; _source_dir='' ; \
+       for i in $(DOC_SOURCE_DIR) ; do \
+           _source_dir="$${_source_dir} --source-dir=../$$i" ; \
+       done ; \
+       gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS)
+       @touch sgml-build.stamp
+
+sgml.stamp: sgml-build.stamp
+       @true
+
+#### html ####
+
+Documentation/$(DOC_MAIN_SGML_FILE): sgml.stamp
+Documentation/webkitenvironment.xml: doc-setup-build.stamp
+
+html-build.stamp: sgml.stamp Documentation/$(DOC_MAIN_SGML_FILE)
+       @echo '  DOC   Building HTML'
+       @rm -rf Documentation/html
+       @mkdir Documentation/html
+       @cd Documentation; mkhtml_options=""; \
+       gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
+       if test "$(?)" = "0"; then \
+         if test "x$(V)" = "x1"; then \
+           mkhtml_options="$$mkhtml_options --verbose"; \
+         fi; \
+       fi; \
+       gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-path"; \
+       if test "$(?)" = "0"; then \
+         mkhtml_options="$$mkhtml_options --path=\"$(doc_srcdir)\""; \
+       fi; \
+       cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
+       -@test "x$(HTML_IMAGES)" = "x" || \
+       for file in $(HTML_IMAGES) ; do \
+         if test -f $(abs_srcdir)/$$file ; then \
+           cp $(abs_srcdir)/$$file $(abs_builddir)/html; \
+         fi; \
+         if test -f $(abs_builddir)/$$file ; then \
+           cp $(abs_builddir)/$$file $(abs_builddir)/html; \
+         fi; \
+       done;
+       @echo '  DOC   Fixing cross-references'
+       @cd Documentation; gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
+       @touch html-build.stamp
+
+clean-local: doc-clean-local
+
+doc-clean-local:
+       @rm -f Documentation/*~ Documentation/*.bak
+       @rm -rf Documentation/.libs
+
+distclean-local: doc-distclean-local
+
+doc-distclean-local:
+       @rm -rf Documentation
+
+maintainer-clean-local: doc-maintainer-clean-local
+
+doc-maintainer-clean-local: clean
+       @rm -rf Documentation/xml Documentation/html
+       -@rmdir Documentation
+
+#
+# Require gtk-doc when making dist
+#
+if ENABLE_GTK_DOC
+dist-check-gtkdoc:
+
+all: docs
+else
+dist-check-gtkdoc:
+       @echo "*** gtk-doc must be installed and enabled in order to make dist"
+       @false
+endif
+
+dist-hook: doc-dist-hook
+
+doc-dist-hook: dist-check-gtkdoc dist-hook-local
+       @mkdir $(distdir)/tmpl
+       @mkdir $(distdir)/html
+       @-cp ./Documentation/tmpl/*.sgml $(distdir)/tmpl
+       @cp ./Documentation/html/* $(distdir)/html
+       @-cp ./Documentation/$(DOC_MODULE).types $(distdir)/
+       @-cp ./Documentation/$(DOC_MODULE)-sections.txt $(distdir)/
+       @cd $(distdir) && rm -f $(DISTCLEANFILES)
+       @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
+
+.PHONY : dist-hook-local docs
index 233b282..0e0ef6b 100644 (file)
@@ -74,55 +74,51 @@ IGNORE_HFILES = \
 # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
 HTML_IMAGES=
 
-# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
-# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
-content_files=webkitenvironment.xml
-
-# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
-# These files must be listed here *and* in content_files
-# e.g. expand_content_files=running.sgml
-expand_content_files=
-
 # CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
 # Only needed if you are using gtkdoc-scangobj to dynamically query widget
 # signals and properties.
 # e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
 # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
 INCLUDES= \
-       -I$(top_srcdir)/Source/WebKit/gtk \
-       -I$(top_builddir)/Source/WebKit/gtk \
+       -I$(abs_srcdir)/Source/WebKit/gtk \
+       -I$(abs_builddir)/Source/WebKit/gtk \
        $(global_cppflags) \
        $(global_cflags) \
-       -I$(top_srcdir)/Source \
-       -I$(top_srcdir)/Source/JavaScriptCore \
-       -I$(top_srcdir)/Source/JavaScriptCore/ForwardingHeaders \
-       -I$(top_srcdir)/Source/JavaScriptCore/parser \
-       -I$(top_srcdir)/Source/JavaScriptCore/wtf \
-       -I$(top_builddir)/DerivedSources \
-       -I$(top_srcdir)/Source/WebCore/platform/network/soup/cache \
+       -I$(abs_srcdir)/Source \
+       -I$(abs_srcdir)/Source/JavaScriptCore \
+       -I$(abs_srcdir)/Source/JavaScriptCore/ForwardingHeaders \
+       -I$(abs_srcdir)/Source/JavaScriptCore/parser \
+       -I$(abs_srcdir)/Source/JavaScriptCore/wtf \
+       -I$(abs_builddir)/DerivedSources \
+       -I$(abs_srcdir)/Source/WebCore/platform/network/soup/cache \
        $(GLOBALDEPS_CFLAGS) \
        $(CAIRO_CFLAGS) \
        $(GLIB_CFLAGS) \
        $(GTK_CFLAGS) \
        $(LIBSOUP_CFLAGS)
 GTKDOC_LIBS= \
-       $(top_builddir)/libjavascriptcoregtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \
-       $(top_builddir)/libwebkitgtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \
+       $(abs_builddir)/libjavascriptcoregtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \
+       $(abs_builddir)/libwebkitgtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \
        $(GLIB_LIBS) \
        $(GTK_LIBS) \
        $(LIBSOUP_LIBS)
 
-# This includes the standard gtk-doc make rules, copied by gtkdocize.
-include $(top_srcdir)/gtk-doc.make
+# This includes our custom gtk-doc make rules.
+include $(top_srcdir)/Source/WebKit/gtk/GNUmakefile.gtk-doc.am
 
 # Other files to distribute
 # e.g. EXTRA_DIST += version.xml.in
-EXTRA_DIST +=
+EXTRA_DIST += \
+       $(WebKit)/docs/webkitenvironment.xml \
+       $(WebKit)/docs/webkitgtk-docs.sgml \
+       $(WebKit)/docs/webkitgtk-sections.txt \
+       $(WebKit)/docs/version.xml.in
 
 # Files not to distribute
 # for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
 # for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
-#DISTCLEANFILES +=
+DISTCLEANFILES += \
+       $(top_builddir)/Source/WebKit/gtk/docs/version.xml
 
 # Comment this out if you want your docs-status tested during 'make check'
 #TESTS = $(GTKDOC_CHECK)
index 23639e8..bb7779d 100755 (executable)
@@ -12,7 +12,6 @@ rm -f $top_srcdir/autom4te.cache
 
 touch README INSTALL
 
-gtkdocize --copy > /dev/null 2>&1 || echo "Warning: not running gtk-docize."
 if test -z `which autoreconf`; then
     echo "Error: autoreconf not found, please install it."
     exit 1
index 2538e39..23a6691 100644 (file)
@@ -1194,10 +1194,7 @@ GNUmakefile
 
 AC_CONFIG_FILES([
 Source/WebKit/gtk/webkit/webkitversion.h
-Source/WebKit/gtk/docs/GNUmakefile
-Source/WebKit/gtk/docs/version.xml
-Source/WebKit2/UIProcess/API/gtk/docs/GNUmakefile
-Source/WebKit2/UIProcess/API/gtk/docs/version.xml
+Documentation/version.xml:Source/WebKit/gtk/docs/version.xml.in
 ])
 
 AC_CONFIG_FILES([
@@ -1213,6 +1210,8 @@ Source/JavaScriptCore/javascriptcoregtk-${WEBKITGTK_API_VERSION}.pc:Source/JavaS
 if test "$enable_webkit2" = "yes"; then
     AC_CONFIG_FILES([
     Source/WebKit2/webkit2gtk-${WEBKITGTK_API_VERSION}.pc:Source/WebKit2/webkit2gtk.pc.in
+    Source/WebKit2/UIProcess/API/gtk/docs/version.xml
+    Source/WebKit2/UIProcess/API/gtk/docs/GNUmakefile
     ]
     ,[WEBKITGTK_API_VERSION=$WEBKITGTK_API_VERSION,WEBKITGTK_PC_NAME=$WEBKITGTK_PC_NAME]
     )