Deal with objdir != srcdir builds.
[gnutls.git] / gtk-doc.make
blobc772e7c7f9e6e15ed322b4b98ceeb46087a2972f
1 # -*- mode: makefile -*-
3 ####################################
4 # Everything below here is generic #
5 ####################################
7 if GTK_DOC_USE_LIBTOOL
8 GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS)
9 GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS)
10 else
11 GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS)
12 GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS)
13 endif
15 # We set GPATH here; this gives us semantics for GNU make
16 # which are more like other make's VPATH, when it comes to
17 # whether a source that is a target of one rule is then
18 # searched for in VPATH/GPATH.
20 GPATH = $(srcdir)
22 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
24 EXTRA_DIST = \
25 $(content_files) \
26 $(HTML_IMAGES) \
27 $(DOC_MAIN_SGML_FILE) \
28 $(DOC_MODULE)-sections.txt \
29 $(DOC_MODULE)-overrides.txt
31 DOC_STAMPS=scan-build.stamp sgml-build.stamp html-build.stamp \
32 $(srcdir)/sgml.stamp $(srcdir)/html.stamp
34 SCANOBJ_FILES = \
35 $(DOC_MODULE).args \
36 $(DOC_MODULE).hierarchy \
37 $(DOC_MODULE).interfaces \
38 $(DOC_MODULE).prerequisites \
39 $(DOC_MODULE).signals
41 REPORT_FILES = \
42 $(DOC_MODULE)-undocumented.txt \
43 $(DOC_MODULE)-undeclared.txt \
44 $(DOC_MODULE)-unused.txt
46 CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
48 if ENABLE_GTK_DOC
49 all-local: html-build.stamp
50 else
51 all-local:
52 endif
54 docs: html-build.stamp
56 #### scan ####
58 scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
59 @echo 'gtk-doc: Scanning header files'
60 @-chmod -R u+w $(srcdir)
61 cd $(srcdir) && \
62 gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
63 if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \
64 CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
65 else \
66 cd $(srcdir) ; \
67 for i in $(SCANOBJ_FILES) ; do \
68 test -f $$i || touch $$i ; \
69 done \
71 touch scan-build.stamp
73 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
74 @true
76 #### xml ####
78 sgml-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files)
79 @echo 'gtk-doc: Building XML'
80 @-chmod -R u+w $(srcdir)
81 cd $(srcdir) && \
82 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)
83 touch sgml-build.stamp
85 sgml.stamp: sgml-build.stamp
86 @true
88 #### html ####
90 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
91 @echo 'gtk-doc: Building HTML'
92 @-chmod -R u+w $(srcdir)
93 rm -rf $(srcdir)/html
94 mkdir $(srcdir)/html
95 cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
96 test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
97 @echo 'gtk-doc: Fixing cross-references'
98 cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
99 touch html-build.stamp
101 ##############
103 clean-local:
104 rm -f *~ *.bak
105 rm -rf .libs
107 distclean-local:
108 cd $(srcdir) && \
109 rm -rf xml $(REPORT_FILES) \
110 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
112 maintainer-clean-local: clean
113 cd $(srcdir) && rm -rf html
115 install-data-local:
116 installfiles=`echo $(srcdir)/html/*`; \
117 if test "$$installfiles" = '$(srcdir)/html/*'; \
118 then echo '-- Nothing to install' ; \
119 else \
120 $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \
121 for i in $$installfiles; do \
122 echo '-- Installing '$$i ; \
123 $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
124 done; \
125 echo '-- Installing $(srcdir)/html/index.sgml' ; \
126 $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR) || :; \
127 if test `which gtkdoc-rebase` != ""; then \
128 gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$(DESTDIR)$(TARGET_DIR) ; \
129 fi \
132 uninstall-local:
133 rm -f $(DESTDIR)$(TARGET_DIR)/*
136 # Require gtk-doc when making dist
138 if ENABLE_GTK_DOC
139 dist-check-gtkdoc:
140 else
141 dist-check-gtkdoc:
142 @echo "*** gtk-doc must be installed and enabled in order to make dist"
143 @false
144 endif
146 dist-hook: dist-check-gtkdoc dist-hook-local
147 mkdir $(distdir)/html
148 cp $(srcdir)/html/* $(distdir)/html
149 cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
150 cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
151 cd $(distdir) && rm -f $(DISTCLEANFILES)
152 -gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
154 .PHONY : dist-hook-local docs