Blame gtk-doc.make

Packit 1e8aac
# -*- mode: makefile -*-
Packit 1e8aac
#
Packit 1e8aac
# gtk-doc.make - make rules for gtk-doc
Packit 1e8aac
# Copyright (C) 2003 James Henstridge
Packit 1e8aac
#               2004-2007 Damon Chaplin
Packit 1e8aac
#               2007-2017 Stefan Sauer
Packit 1e8aac
#
Packit 1e8aac
# This program is free software: you can redistribute it and/or modify
Packit 1e8aac
# it under the terms of the GNU General Public License as published by
Packit 1e8aac
# the Free Software Foundation, either version 3 of the License, or
Packit 1e8aac
# (at your option) any later version.
Packit 1e8aac
#
Packit 1e8aac
# This program is distributed in the hope that it will be useful,
Packit 1e8aac
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 1e8aac
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 1e8aac
# GNU General Public License for more details.
Packit 1e8aac
#
Packit 1e8aac
# You should have received a copy of the GNU General Public License
Packit 1e8aac
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 1e8aac
Packit 1e8aac
####################################
Packit 1e8aac
# Everything below here is generic #
Packit 1e8aac
####################################
Packit 1e8aac
Packit 1e8aac
if GTK_DOC_USE_LIBTOOL
Packit 1e8aac
GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
Packit 1e8aac
GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
Packit 1e8aac
GTKDOC_RUN = $(LIBTOOL) --mode=execute
Packit 1e8aac
else
Packit 1e8aac
GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
Packit 1e8aac
GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
Packit 1e8aac
GTKDOC_RUN =
Packit 1e8aac
endif
Packit 1e8aac
Packit 1e8aac
# We set GPATH here; this gives us semantics for GNU make
Packit 1e8aac
# which are more like other make's VPATH, when it comes to
Packit 1e8aac
# whether a source that is a target of one rule is then
Packit 1e8aac
# searched for in VPATH/GPATH.
Packit 1e8aac
#
Packit 1e8aac
GPATH = $(srcdir)
Packit 1e8aac
Packit 1e8aac
TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
Packit 1e8aac
Packit 1e8aac
SETUP_FILES = \
Packit 1e8aac
	$(content_files)		\
Packit 1e8aac
	$(expand_content_files)		\
Packit 1e8aac
	$(DOC_MAIN_SGML_FILE)		\
Packit 1e8aac
	$(DOC_MODULE)-sections.txt	\
Packit 1e8aac
	$(DOC_MODULE)-overrides.txt
Packit 1e8aac
Packit 1e8aac
EXTRA_DIST = 				\
Packit 1e8aac
	$(HTML_IMAGES)			\
Packit 1e8aac
	$(SETUP_FILES)
Packit 1e8aac
Packit 1e8aac
DOC_STAMPS=setup-build.stamp scan-build.stamp sgml-build.stamp \
Packit 1e8aac
	html-build.stamp pdf-build.stamp \
Packit 1e8aac
	sgml.stamp html.stamp pdf.stamp
Packit 1e8aac
Packit 1e8aac
SCANOBJ_FILES = 		 \
Packit 1e8aac
	$(DOC_MODULE).args 	 \
Packit 1e8aac
	$(DOC_MODULE).hierarchy  \
Packit 1e8aac
	$(DOC_MODULE).interfaces \
Packit 1e8aac
	$(DOC_MODULE).prerequisites \
Packit 1e8aac
	$(DOC_MODULE).signals
Packit 1e8aac
Packit 1e8aac
REPORT_FILES = \
Packit 1e8aac
	$(DOC_MODULE)-undocumented.txt \
Packit 1e8aac
	$(DOC_MODULE)-undeclared.txt \
Packit 1e8aac
	$(DOC_MODULE)-unused.txt
Packit 1e8aac
Packit 1e8aac
gtkdoc-check.test: Makefile
Packit 1e8aac
	$(AM_V_GEN)echo "#!/bin/sh -e" > $@; \
Packit 1e8aac
		echo "$(GTKDOC_CHECK_PATH) || exit 1" >> $@; \
Packit 1e8aac
		chmod +x $@
Packit 1e8aac
Packit 1e8aac
CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) gtkdoc-check.test
Packit 1e8aac
Packit 1e8aac
if GTK_DOC_BUILD_HTML
Packit 1e8aac
HTML_BUILD_STAMP=html-build.stamp
Packit 1e8aac
else
Packit 1e8aac
HTML_BUILD_STAMP=
Packit 1e8aac
endif
Packit 1e8aac
if GTK_DOC_BUILD_PDF
Packit 1e8aac
PDF_BUILD_STAMP=pdf-build.stamp
Packit 1e8aac
else
Packit 1e8aac
PDF_BUILD_STAMP=
Packit 1e8aac
endif
Packit 1e8aac
Packit 1e8aac
all-gtk-doc: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
Packit 1e8aac
.PHONY: all-gtk-doc
Packit 1e8aac
Packit 1e8aac
if ENABLE_GTK_DOC
Packit 1e8aac
all-local: all-gtk-doc
Packit 1e8aac
endif
Packit 1e8aac
Packit 1e8aac
docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
Packit 1e8aac
Packit 1e8aac
$(REPORT_FILES): sgml-build.stamp
Packit 1e8aac
Packit 1e8aac
#### setup ####
Packit 1e8aac
Packit 1e8aac
GTK_DOC_V_SETUP=$(GTK_DOC_V_SETUP_@AM_V@)
Packit 1e8aac
GTK_DOC_V_SETUP_=$(GTK_DOC_V_SETUP_@AM_DEFAULT_V@)
Packit 1e8aac
GTK_DOC_V_SETUP_0=@echo "  DOC   Preparing build";
Packit 1e8aac
Packit 1e8aac
setup-build.stamp:
Packit 1e8aac
	-$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
Packit 1e8aac
	  files=`echo $(SETUP_FILES) $(DOC_MODULE).types`; \
Packit 1e8aac
	  if test "x$$files" != "x" ; then \
Packit 1e8aac
	    for file in $$files ; do \
Packit 1e8aac
	      destdir=`dirname $(abs_builddir)/$$file`; \
Packit 1e8aac
	      test -d "$$destdir" || mkdir -p "$$destdir"; \
Packit 1e8aac
	      test -f $(abs_srcdir)/$$file && \
Packit 1e8aac
	        cp -pf $(abs_srcdir)/$$file $(abs_builddir)/$$file || true; \
Packit 1e8aac
	    done; \
Packit 1e8aac
	  fi; \
Packit 1e8aac
	fi
Packit 1e8aac
	$(AM_V_at)touch setup-build.stamp
Packit 1e8aac
Packit 1e8aac
#### scan ####
Packit 1e8aac
Packit 1e8aac
GTK_DOC_V_SCAN=$(GTK_DOC_V_SCAN_@AM_V@)
Packit 1e8aac
GTK_DOC_V_SCAN_=$(GTK_DOC_V_SCAN_@AM_DEFAULT_V@)
Packit 1e8aac
GTK_DOC_V_SCAN_0=@echo "  DOC   Scanning header files";
Packit 1e8aac
Packit 1e8aac
GTK_DOC_V_INTROSPECT=$(GTK_DOC_V_INTROSPECT_@AM_V@)
Packit 1e8aac
GTK_DOC_V_INTROSPECT_=$(GTK_DOC_V_INTROSPECT_@AM_DEFAULT_V@)
Packit 1e8aac
GTK_DOC_V_INTROSPECT_0=@echo "  DOC   Introspecting gobjects";
Packit 1e8aac
Packit 1e8aac
scan-build.stamp: setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
Packit 1e8aac
	$(GTK_DOC_V_SCAN)_source_dir='' ; \
Packit 1e8aac
	for i in $(DOC_SOURCE_DIR) ; do \
Packit 1e8aac
	  _source_dir="$${_source_dir} --source-dir=$$i" ; \
Packit 1e8aac
	done ; \
Packit 1e8aac
	gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES)
Packit 1e8aac
	$(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
Packit 1e8aac
	  scanobj_options=""; \
Packit 1e8aac
	  gtkdoc-scangobj 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
Packit 1e8aac
	  if test "$$?" = "0"; then \
Packit 1e8aac
	    if test "x$(V)" = "x1"; then \
Packit 1e8aac
	      scanobj_options="--verbose"; \
Packit 1e8aac
	    fi; \
Packit 1e8aac
	  fi; \
Packit 1e8aac
	  CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \
Packit 1e8aac
	  gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \
Packit 1e8aac
	else \
Packit 1e8aac
	  for i in $(SCANOBJ_FILES) ; do \
Packit 1e8aac
	    test -f $$i || touch $$i ; \
Packit 1e8aac
	  done \
Packit 1e8aac
	fi
Packit 1e8aac
	$(AM_V_at)touch scan-build.stamp
Packit 1e8aac
Packit 1e8aac
$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
Packit 1e8aac
	@true
Packit 1e8aac
Packit 1e8aac
#### xml ####
Packit 1e8aac
Packit 1e8aac
GTK_DOC_V_XML=$(GTK_DOC_V_XML_@AM_V@)
Packit 1e8aac
GTK_DOC_V_XML_=$(GTK_DOC_V_XML_@AM_DEFAULT_V@)
Packit 1e8aac
GTK_DOC_V_XML_0=@echo "  DOC   Building XML";
Packit 1e8aac
Packit 1e8aac
sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(HFILE_GLOB) $(CFILE_GLOB) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files) xml/gtkdocentities.ent
Packit 1e8aac
	$(GTK_DOC_V_XML)_source_dir='' ; \
Packit 1e8aac
	for i in $(DOC_SOURCE_DIR) ; do \
Packit 1e8aac
	  _source_dir="$${_source_dir} --source-dir=$$i" ; \
Packit 1e8aac
	done ; \
Packit 1e8aac
	gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS)
Packit 1e8aac
	$(AM_V_at)touch sgml-build.stamp
Packit 1e8aac
Packit 1e8aac
sgml.stamp: sgml-build.stamp
Packit 1e8aac
	@true
Packit 1e8aac
Packit 1e8aac
$(DOC_MAIN_SGML_FILE): sgml-build.stamp
Packit 1e8aac
	@true
Packit 1e8aac
Packit 1e8aac
xml/gtkdocentities.ent: Makefile
Packit 1e8aac
	$(GTK_DOC_V_XML)$(MKDIR_P) $(@D) && ( \
Packit 1e8aac
		echo ""; \
Packit 1e8aac
		echo ""; \
Packit 1e8aac
		echo ""; \
Packit 1e8aac
		echo ""; \
Packit 1e8aac
		echo ""; \
Packit 1e8aac
		echo ""; \
Packit 1e8aac
		echo ""; \
Packit 1e8aac
	) > $@
Packit 1e8aac
Packit 1e8aac
#### html ####
Packit 1e8aac
Packit 1e8aac
GTK_DOC_V_HTML=$(GTK_DOC_V_HTML_@AM_V@)
Packit 1e8aac
GTK_DOC_V_HTML_=$(GTK_DOC_V_HTML_@AM_DEFAULT_V@)
Packit 1e8aac
GTK_DOC_V_HTML_0=@echo "  DOC   Building HTML";
Packit 1e8aac
Packit 1e8aac
GTK_DOC_V_XREF=$(GTK_DOC_V_XREF_@AM_V@)
Packit 1e8aac
GTK_DOC_V_XREF_=$(GTK_DOC_V_XREF_@AM_DEFAULT_V@)
Packit 1e8aac
GTK_DOC_V_XREF_0=@echo "  DOC   Fixing cross-references";
Packit 1e8aac
Packit 1e8aac
html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
Packit 1e8aac
	$(GTK_DOC_V_HTML)rm -rf html && mkdir html && \
Packit 1e8aac
	mkhtml_options=""; \
Packit 1e8aac
	gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
Packit 1e8aac
	if test "$$?" = "0"; then \
Packit 1e8aac
	  if test "x$(V)" = "x1"; then \
Packit 1e8aac
	    mkhtml_options="$$mkhtml_options --verbose"; \
Packit 1e8aac
	  fi; \
Packit 1e8aac
	fi; \
Packit 1e8aac
	gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-path"; \
Packit 1e8aac
	if test "$$?" = "0"; then \
Packit 1e8aac
	  mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \
Packit 1e8aac
	fi; \
Packit 1e8aac
	cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
Packit 1e8aac
	-@test "x$(HTML_IMAGES)" = "x" || \
Packit 1e8aac
	for file in $(HTML_IMAGES) ; do \
Packit 1e8aac
	  test -f $(abs_srcdir)/$$file && cp $(abs_srcdir)/$$file $(abs_builddir)/html; \
Packit 1e8aac
	  test -f $(abs_builddir)/$$file && cp $(abs_builddir)/$$file $(abs_builddir)/html; \
Packit 1e8aac
	  test -f $$file && cp $$file $(abs_builddir)/html; \
Packit 1e8aac
	done;
Packit 1e8aac
	$(GTK_DOC_V_XREF)gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
Packit 1e8aac
	$(AM_V_at)touch html-build.stamp
Packit 1e8aac
Packit 1e8aac
#### pdf ####
Packit 1e8aac
Packit 1e8aac
GTK_DOC_V_PDF=$(GTK_DOC_V_PDF_@AM_V@)
Packit 1e8aac
GTK_DOC_V_PDF_=$(GTK_DOC_V_PDF_@AM_DEFAULT_V@)
Packit 1e8aac
GTK_DOC_V_PDF_0=@echo "  DOC   Building PDF";
Packit 1e8aac
Packit 1e8aac
pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
Packit 1e8aac
	$(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \
Packit 1e8aac
	mkpdf_options=""; \
Packit 1e8aac
	gtkdoc-mkpdf 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
Packit 1e8aac
	if test "$$?" = "0"; then \
Packit 1e8aac
	  if test "x$(V)" = "x1"; then \
Packit 1e8aac
	    mkpdf_options="$$mkpdf_options --verbose"; \
Packit 1e8aac
	  fi; \
Packit 1e8aac
	fi; \
Packit 1e8aac
	if test "x$(HTML_IMAGES)" != "x"; then \
Packit 1e8aac
	  for img in $(HTML_IMAGES); do \
Packit 1e8aac
	    part=`dirname $$img`; \
Packit 1e8aac
	    echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \
Packit 1e8aac
	    if test $$? != 0; then \
Packit 1e8aac
	      mkpdf_options="$$mkpdf_options --imgdir=$$part"; \
Packit 1e8aac
	    fi; \
Packit 1e8aac
	  done; \
Packit 1e8aac
	fi; \
Packit 1e8aac
	gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS)
Packit 1e8aac
	$(AM_V_at)touch pdf-build.stamp
Packit 1e8aac
Packit 1e8aac
##############
Packit 1e8aac
Packit 1e8aac
clean-local:
Packit 1e8aac
	@rm -f *~ *.bak
Packit 1e8aac
	@rm -rf .libs
Packit 1e8aac
	@if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \
Packit 1e8aac
	  rm -f $(DOC_MODULE).types; \
Packit 1e8aac
	fi
Packit 1e8aac
	@if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-sections" ; then \
Packit 1e8aac
	  rm -f $(DOC_MODULE)-sections.txt; \
Packit 1e8aac
	fi
Packit 1e8aac
Packit 1e8aac
distclean-local:
Packit 1e8aac
	@rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \
Packit 1e8aac
	    $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
Packit 1e8aac
	@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
Packit 1e8aac
	    rm -f $(SETUP_FILES) $(DOC_MODULE).types; \
Packit 1e8aac
	fi
Packit 1e8aac
Packit 1e8aac
maintainer-clean-local:
Packit 1e8aac
	@rm -rf xml html
Packit 1e8aac
Packit 1e8aac
install-data-local:
Packit 1e8aac
	@installfiles=`echo $(builddir)/html/*`; \
Packit 1e8aac
	if test "$$installfiles" = '$(builddir)/html/*'; \
Packit 1e8aac
	then echo 1>&2 'Nothing to install' ; \
Packit 1e8aac
	else \
Packit 1e8aac
	  if test -n "$(DOC_MODULE_VERSION)"; then \
Packit 1e8aac
	    installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
Packit 1e8aac
	  else \
Packit 1e8aac
	    installdir="$(DESTDIR)$(TARGET_DIR)"; \
Packit 1e8aac
	  fi; \
Packit 1e8aac
	  $(mkinstalldirs) $${installdir} ; \
Packit 1e8aac
	  for i in $$installfiles; do \
Packit 1e8aac
	    echo ' $(INSTALL_DATA) '$$i ; \
Packit 1e8aac
	    $(INSTALL_DATA) $$i $${installdir}; \
Packit 1e8aac
	  done; \
Packit 1e8aac
	  if test -n "$(DOC_MODULE_VERSION)"; then \
Packit 1e8aac
	    mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
Packit 1e8aac
	      $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
Packit 1e8aac
	  fi; \
Packit 1e8aac
	  $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \
Packit 1e8aac
	fi
Packit 1e8aac
Packit 1e8aac
uninstall-local:
Packit 1e8aac
	@if test -n "$(DOC_MODULE_VERSION)"; then \
Packit 1e8aac
	  installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
Packit 1e8aac
	else \
Packit 1e8aac
	  installdir="$(DESTDIR)$(TARGET_DIR)"; \
Packit 1e8aac
	fi; \
Packit 1e8aac
	rm -rf $${installdir}
Packit 1e8aac
Packit 1e8aac
#
Packit 1e8aac
# Require gtk-doc when making dist
Packit 1e8aac
#
Packit 1e8aac
if HAVE_GTK_DOC
Packit 1e8aac
dist-check-gtkdoc: docs
Packit 1e8aac
else
Packit 1e8aac
dist-check-gtkdoc:
Packit 1e8aac
	@echo "*** gtk-doc is needed to run 'make dist'.         ***"
Packit 1e8aac
	@echo "*** gtk-doc was not found when 'configure' ran.   ***"
Packit 1e8aac
	@echo "*** please install gtk-doc and rerun 'configure'. ***"
Packit 1e8aac
	@false
Packit 1e8aac
endif
Packit 1e8aac
Packit 1e8aac
dist-hook: dist-check-gtkdoc all-gtk-doc dist-hook-local
Packit 1e8aac
	@mkdir $(distdir)/html
Packit 1e8aac
	@cp ./html/* $(distdir)/html
Packit 1e8aac
	@-cp ./$(DOC_MODULE).pdf $(distdir)/
Packit 1e8aac
	@-cp ./$(DOC_MODULE).types $(distdir)/
Packit 1e8aac
	@-cp ./$(DOC_MODULE)-sections.txt $(distdir)/
Packit 1e8aac
	@cd $(distdir) && rm -f $(DISTCLEANFILES)
Packit 1e8aac
	@$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
Packit 1e8aac
Packit 1e8aac
.PHONY : dist-hook-local docs