From: Karel Zak Date: Fri, 6 Nov 2009 22:43:46 +0000 (+0100) Subject: build-sys: clean up gtk-doc stuff X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e42b25eb1536697ba283772f5452e7495cb4024b;p=util-linux build-sys: clean up gtk-doc stuff * gtk-doc.make does not care about difference between $srcdir and $builddir and many things are generated into $srcdir. It's pretty difficult to support out-of-source build... * gtk-doc expects that many generated files are stored in repository (we don't use XML templates, all documentation in source code only). * we don't want to distribute generated html files, the docs is attractive for very small group of people... Frankly, it would be nice to found something more robust and better than gtk-doc. Signed-off-by: Karel Zak --- diff --git a/config/gtk-doc.make b/config/gtk-doc.make index 691ac9bd..19cd0e6b 100644 --- a/config/gtk-doc.make +++ b/config/gtk-doc.make @@ -1,4 +1,15 @@ -# -*- mode: makefile -*- +# +# WARNING: this is not gtk-doc.make file from gtk-doc project. This +# file has been modified to match with util-linux-ng requirements: +# +# * install files to $datadir +# * don't maintain generated files in git repository +# * don't distribute the final html files +# * don't require --enable-gtk-doc for "make dist" +# * support out-of-tree build ($srcdir != $builddir) +# +# -- kzak, Nov 2009 +# #################################### # Everything below here is generic # @@ -21,14 +32,14 @@ endif # GPATH = $(srcdir) -TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE) +TARGET_DIR=$(docdir)/$(DOC_MODULE) EXTRA_DIST = \ $(content_files) \ $(HTML_IMAGES) \ $(DOC_MAIN_SGML_FILE) \ - $(DOC_MODULE)-sections.txt \ - $(DOC_MODULE)-overrides.txt + $(DOC_MODULE)-sections.txt +# $(DOC_MODULE)-overrides.txt DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \ $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp @@ -59,30 +70,41 @@ $(REPORT_FILES): sgml-build.stamp #### scan #### -scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) +scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) $(srcdir)/$(DOC_MODULE)-*.txt $(content_files) + + test -f $(DOC_MODULE)-sections.txt || \ + cp $(srcdir)/$(DOC_MODULE)-sections.txt $(builddir) + @echo 'gtk-doc: Scanning header files' - @-chmod -R u+w $(srcdir) - cd $(srcdir) && \ - gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES) + gtkdoc-scan --module=$(DOC_MODULE) \ + --source-dir=$(srcdir)/$(DOC_SOURCE_DIR) \ + --source-dir=$(builddir)/$(DOC_SOURCE_DIR) \ + --ignore-headers="$(IGNORE_HFILES)" \ + --output-dir=$(builddir) \ + $(SCAN_OPTIONS) $(EXTRA_HFILES) + if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \ - CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \ + CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" \ + CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) \ + $(LDFLAGS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) \ + --module=$(DOC_MODULE) --output-dir=$(builddir) ; \ else \ - cd $(srcdir) ; \ for i in $(SCANOBJ_FILES) ; do \ test -f $$i || touch $$i ; \ done \ fi touch scan-build.stamp -$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp +$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(srcdir)/$(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp @true #### templates #### -tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt +tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(srcdir)/$(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt @echo 'gtk-doc: Rebuilding template files' - @-chmod -R u+w $(srcdir) - cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS) + test -z $(builddir)/tmpl || $(MKDIR_P) $(builddir)/tmpl + gtkdoc-mktmpl --module=$(DOC_MODULE) \ + $(MKTMPL_OPTIONS) touch tmpl-build.stamp tmpl.stamp: tmpl-build.stamp @@ -94,11 +116,16 @@ tmpl/*.sgml: #### xml #### -sgml-build.stamp: tmpl.stamp $(HFILE_GLOB) $(CFILE_GLOB) $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files) +sgml-build.stamp: tmpl.stamp $(HFILE_GLOB) $(CFILE_GLOB) $(srcdir)/$(DOC_MODULE)-sections.txt $(builddir)/tmpl/*.sgml $(expand_content_files) @echo 'gtk-doc: Building XML' - @-chmod -R u+w $(srcdir) - cd $(srcdir) && \ - gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS) + gtkdoc-mkdb --module=$(DOC_MODULE) \ + --source-dir=$(srcdir)/$(DOC_SOURCE_DIR) \ + --source-dir=$(builddir)/$(DOC_SOURCE_DIR) \ + --output-format=xml \ + --ignore-files="$(IGNORE_HFILES)" \ + --expand-content-files="$(expand_content_files)" \ + --main-sgml-file=$(srcdir)/$(DOC_MAIN_SGML_FILE) \ + $(MKDB_OPTIONS) touch sgml-build.stamp sgml.stamp: sgml-build.stamp @@ -106,20 +133,23 @@ sgml.stamp: sgml-build.stamp #### html #### -html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) +html-build.stamp: sgml.stamp $(srcdir)/$(DOC_MAIN_SGML_FILE) $(content_files) @echo 'gtk-doc: Building HTML' - @-chmod -R u+w $(srcdir) - rm -rf $(srcdir)/html - mkdir $(srcdir)/html - mkhtml_options=""; \ - gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \ - if test "$(?)" = "0"; then \ - mkhtml_options=--path="$(srcdir)"; \ - fi - cd $(srcdir)/html && gtkdoc-mkhtml $(mkhtml_options) $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) - test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html ) + rm -rf $(builddir)/html + $(MKDIR_P) $(builddir)/html + cd $(builddir)/html && \ + gtkdoc-mkhtml --path="$(abs_builddir):$(abs_builddir)/xml:$(abs_srcdir)" \ + $(MKHTML_OPTIONS) \ + $(DOC_MODULE) \ + $(abs_srcdir)/$(DOC_MAIN_SGML_FILE) + + test "x$(HTML_IMAGES)" = "x" || \ + ( cd $(srcdir) && cp $(HTML_IMAGES) $(abs_builddir)/html ) + @echo 'gtk-doc: Fixing cross-references' - cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) + gtkdoc-fixxref --module-dir=html \ + --html-dir=$(HTML_DIR) \ + $(FIXXREF_OPTIONS) touch html-build.stamp ############## @@ -129,16 +159,15 @@ clean-local: rm -rf .libs distclean-local: - cd $(srcdir) && \ - rm -rf xml $(REPORT_FILES) \ - $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt - -maintainer-clean-local: clean - cd $(srcdir) && rm -rf xml html + rm -rf xml html tmpl $(REPORT_FILES) *.stamp \ + $(DOC_MODULE)-overrides.txt \ + $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt + test $(abs_builddir) == $(abs_srcdir) || \ + rm -f $(DOC_MODULE)-sections.txt install-data-local: - installfiles=`echo $(srcdir)/html/*`; \ - if test "$$installfiles" = '$(srcdir)/html/*'; \ + installfiles=`echo $(builddir)/html/*`; \ + if test "$$installfiles" = '$(builddir)/html/*'; \ then echo '-- Nothing to install' ; \ else \ if test -n "$(DOC_MODULE_VERSION)"; then \ @@ -180,17 +209,17 @@ dist-check-gtkdoc: @false endif -dist-hook: dist-check-gtkdoc dist-hook-local sgml.stamp html-build.stamp - mkdir $(distdir)/tmpl - mkdir $(distdir)/xml - mkdir $(distdir)/html - -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl - -cp $(srcdir)/xml/*.xml $(distdir)/xml - cp $(srcdir)/html/* $(distdir)/html - -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/ - -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/ - cd $(distdir) && rm -f $(DISTCLEANFILES) - ! which gtkdoc-rebase >/dev/null 2>&1 || \ - gtkdoc-rebase --online --relative --html-dir=$(distdir)/html - -.PHONY : dist-hook-local docs +#dist-hook: dist-check-gtkdoc dist-hook-local sgml.stamp html-build.stamp +# mkdir $(distdir)/tmpl +# mkdir $(distdir)/xml +# mkdir $(distdir)/html +# -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl +# -cp $(srcdir)/xml/*.xml $(distdir)/xml +# cp $(srcdir)/html/* $(distdir)/html +# -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/ +# -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/ +# cd $(distdir) && rm -f $(DISTCLEANFILES) +# ! which gtkdoc-rebase >/dev/null 2>&1 || \ +# gtkdoc-rebase --online --relative --html-dir=$(distdir)/html +# +#.PHONY : dist-hook-local docs diff --git a/shlibs/blkid/docs/Makefile.am b/shlibs/blkid/docs/Makefile.am index 6c209a3e..8ef3b239 100644 --- a/shlibs/blkid/docs/Makefile.am +++ b/shlibs/blkid/docs/Makefile.am @@ -41,7 +41,7 @@ MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space blkid MKTMPL_OPTIONS= # Extra options to supply to gtkdoc-mkhtml -MKHTML_OPTIONS=--path=$(abs_srcdir) --path=$(abs_builddir) +MKHTML_OPTIONS= # Extra options to supply to gtkdoc-fixref. Not normally needed. # e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html @@ -51,7 +51,7 @@ FIXXREF_OPTIONS= # e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h # e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c HFILE_GLOB=$(ul_libblkid_incdir)/blkid.h -CFILE_GLOB=$(top_srcdir)/shlibs/blkid/src/*.c +CFILE_GLOB=$(ul_libblkid_srcdir)/*.c # Extra header to include when scanning, which are not under DOC_SOURCE_DIR # e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h @@ -59,7 +59,7 @@ EXTRA_HFILES= # Header files to ignore when scanning. Use base file name, no paths # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h -IGNORE_HFILES=blkidP.h list.h partitions.h sublks.h toplgy.h aix.h dos.h +IGNORE_HFILES=blkidP.h list.h partitions.h superblocks.h topology.h aix.h dos.h # Images to copy into HTML directory. # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png @@ -67,7 +67,7 @@ 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 = version.xml libblkid-config.xml +content_files = $(builddir)/version.xml $(srcdir)/libblkid-config.xml # SGML files where gtk-doc abbrevations (#GtkWidget) are expanded # These files must be listed here *and* in content_files