xsl: don't create extra <link rel> elements
[gtk-doc.git] / gtk-doc.make
blob63adaedd623a2d692773141beec3e4bf67a22885
1 # -*- mode: makefile -*-
3 ####################################
4 # Everything below here is generic #
5 ####################################
7 if GTK_DOC_USE_LIBTOOL
8 GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
9 GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
10 GTKDOC_RUN = $(LIBTOOL) --mode=execute
11 else
12 GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
13 GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
14 GTKDOC_RUN =
15 endif
17 # We set GPATH here; this gives us semantics for GNU make
18 # which are more like other make's VPATH, when it comes to
19 # whether a source that is a target of one rule is then
20 # searched for in VPATH/GPATH.
22 GPATH = $(srcdir)
24 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
26 EXTRA_DIST = \
27 $(content_files) \
28 $(HTML_IMAGES) \
29 $(DOC_MAIN_SGML_FILE) \
30 $(DOC_MODULE)-sections.txt \
31 $(DOC_MODULE)-overrides.txt
33 DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \
34 pdf-build.stamp \
35 $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp \
36 $(srcdir)/pdf.stamp
38 SCANOBJ_FILES = \
39 $(DOC_MODULE).args \
40 $(DOC_MODULE).hierarchy \
41 $(DOC_MODULE).interfaces \
42 $(DOC_MODULE).prerequisites \
43 $(DOC_MODULE).signals
45 REPORT_FILES = \
46 $(DOC_MODULE)-undocumented.txt \
47 $(DOC_MODULE)-undeclared.txt \
48 $(DOC_MODULE)-unused.txt
50 CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
52 if ENABLE_GTK_DOC
53 if GTK_DOC_BUILD_HTML
54 HTML_BUILD_STAMP=html-build.stamp
55 else
56 HTML_BUILD_STAMP=
57 endif
58 if GTK_DOC_BUILD_PDF
59 PDF_BUILD_STAMP=pdf-build.stamp
60 else
61 PDF_BUILD_STAMP=
62 endif
64 all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
65 else
66 all-local:
67 endif
69 docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
71 $(REPORT_FILES): sgml-build.stamp
73 #### scan ####
75 scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
76 @echo 'gtk-doc: Scanning header files'
77 @-chmod -R u+w $(srcdir)
78 @cd $(srcdir) && \
79 gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
80 @if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \
81 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) ; \
82 else \
83 cd $(srcdir) ; \
84 for i in $(SCANOBJ_FILES) ; do \
85 test -f $$i || touch $$i ; \
86 done \
88 @touch scan-build.stamp
90 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
91 @true
93 #### templates ####
95 tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
96 @echo 'gtk-doc: Rebuilding template files'
97 @-chmod -R u+w $(srcdir)
98 @cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS)
99 @touch tmpl-build.stamp
101 tmpl.stamp: tmpl-build.stamp
102 @true
104 $(srcdir)/tmpl/*.sgml:
105 @true
107 #### xml ####
109 sgml-build.stamp: tmpl.stamp $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files)
110 @echo 'gtk-doc: Building XML'
111 @-chmod -R u+w $(srcdir)
112 @cd $(srcdir) && \
113 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)
114 @touch sgml-build.stamp
116 sgml.stamp: sgml-build.stamp
117 @true
119 #### html ####
121 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
122 @echo 'gtk-doc: Building HTML'
123 @-chmod -R u+w $(srcdir)
124 @rm -rf $(srcdir)/html
125 @mkdir $(srcdir)/html
126 @mkhtml_options=""; \
127 gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
128 if test "$(?)" = "0"; then \
129 mkhtml_options=--path="$(srcdir)"; \
130 fi; \
131 cd $(srcdir)/html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
132 @test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
133 @echo 'gtk-doc: Fixing cross-references'
134 @cd $(srcdir) && gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
135 @touch html-build.stamp
137 #### pdf ####
139 pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
140 @echo 'gtk-doc: Building PDF'
141 @-chmod -R u+w $(srcdir)
142 @rm -rf $(srcdir)/$(DOC_MODULE).pdf
143 @mkpdf_imgdirs=""; \
144 if test "x$(HTML_IMAGES)" != "x"; then \
145 for img in $(HTML_IMAGES); do \
146 part=`dirname $$img`; \
147 echo $$mkpdf_imgdirs | grep >/dev/null "\-\-imgdir=$$part "; \
148 if test $$? != 0; then \
149 mkpdf_imgdirs="$$mkpdf_imgdirs --imgdir=$$part"; \
150 fi; \
151 done; \
152 fi; \
153 cd $(srcdir) && gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_imgdirs $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS)
154 @touch pdf-build.stamp
156 ##############
158 clean-local:
159 rm -f *~ *.bak
160 rm -rf .libs
162 distclean-local:
163 cd $(srcdir) && \
164 rm -rf xml $(REPORT_FILES) $(DOC_MODULE).pdf \
165 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
167 maintainer-clean-local: clean
168 cd $(srcdir) && rm -rf xml html
170 install-data-local:
171 @installfiles=`echo $(srcdir)/html/*`; \
172 if test "$$installfiles" = '$(srcdir)/html/*'; \
173 then echo '-- Nothing to install' ; \
174 else \
175 if test -n "$(DOC_MODULE_VERSION)"; then \
176 installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
177 else \
178 installdir="$(DESTDIR)$(TARGET_DIR)"; \
179 fi; \
180 $(mkinstalldirs) $${installdir} ; \
181 for i in $$installfiles; do \
182 echo '-- Installing '$$i ; \
183 $(INSTALL_DATA) $$i $${installdir}; \
184 done; \
185 if test -n "$(DOC_MODULE_VERSION)"; then \
186 mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
187 $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
188 mv -f $${installdir}/$(DOC_MODULE).devhelp \
189 $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp; \
190 fi; \
191 $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \
194 uninstall-local:
195 @if test -n "$(DOC_MODULE_VERSION)"; then \
196 installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
197 else \
198 installdir="$(DESTDIR)$(TARGET_DIR)"; \
199 fi; \
200 rm -rf $${installdir}
203 # Require gtk-doc when making dist
205 if ENABLE_GTK_DOC
206 dist-check-gtkdoc:
207 else
208 dist-check-gtkdoc:
209 @echo "*** gtk-doc must be installed and enabled in order to make dist"
210 @false
211 endif
213 dist-hook: dist-check-gtkdoc dist-hook-local
214 mkdir $(distdir)/tmpl
215 mkdir $(distdir)/html
216 -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
217 cp $(srcdir)/html/* $(distdir)/html
218 -cp $(srcdir)/$(DOC_MODULE).pdf $(distdir)/
219 -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
220 -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
221 cd $(distdir) && rm -f $(DISTCLEANFILES)
222 $(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
224 .PHONY : dist-hook-local docs