todo: update
[gtk-doc.git] / gtk-doc.notmpl.make
blob55746451a0b5ed9088ed197124c67d2aeba27d45
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 sgml-build.stamp html-build.stamp pdf-build.stamp \
34 $(srcdir)/sgml.stamp $(srcdir)/html.stamp \
35 $(srcdir)/pdf.stamp
37 SCANOBJ_FILES = \
38 $(DOC_MODULE).args \
39 $(DOC_MODULE).hierarchy \
40 $(DOC_MODULE).interfaces \
41 $(DOC_MODULE).prerequisites \
42 $(DOC_MODULE).signals
44 REPORT_FILES = \
45 $(DOC_MODULE)-undocumented.txt \
46 $(DOC_MODULE)-undeclared.txt \
47 $(DOC_MODULE)-unused.txt
49 CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
51 if ENABLE_GTK_DOC
52 if GTK_DOC_BUILD_HTML
53 HTML_BUILD_STAMP=html-build.stamp
54 else
55 HTML_BUILD_STAMP=
56 endif
57 if GTK_DOC_BUILD_PDF
58 PDF_BUILD_STAMP=pdf-build.stamp
59 else
60 PDF_BUILD_STAMP=
61 endif
63 all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
64 else
65 all-local:
66 endif
68 docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
70 $(REPORT_FILES): sgml-build.stamp
72 #### scan ####
74 scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
75 @echo 'gtk-doc: Scanning header files'
76 @-chmod -R u+w $(srcdir)
77 @_source_dir='' ; for i in $(DOC_SOURCE_DIR) ; do \
78 _source_dir="$${_source_dir} --source-dir=$$i" ; \
79 done ; \
80 cd $(srcdir) && \
81 gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES)
82 @if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \
83 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) ; \
84 else \
85 cd $(srcdir) ; \
86 for i in $(SCANOBJ_FILES) ; do \
87 test -f $$i || touch $$i ; \
88 done \
90 @touch scan-build.stamp
92 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
93 @true
95 #### xml ####
97 sgml-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files)
98 @echo 'gtk-doc: Building XML'
99 @-chmod -R u+w $(srcdir)
100 @_source_dir='' ; for i in $(DOC_SOURCE_DIR) ; do \
101 _source_dir="$${_source_dir} --source-dir=$$i" ; \
102 done ; \
103 cd $(srcdir) && \
104 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)
105 @touch sgml-build.stamp
107 sgml.stamp: sgml-build.stamp
108 @true
110 #### html ####
112 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
113 @echo 'gtk-doc: Building HTML'
114 @-chmod -R u+w $(srcdir)
115 @rm -rf $(srcdir)/html
116 @mkdir $(srcdir)/html
117 @mkhtml_options=""; \
118 gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
119 if test "$(?)" = "0"; then \
120 mkhtml_options=--path="$(srcdir)"; \
121 fi; \
122 cd $(srcdir)/html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
123 @test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
124 @echo 'gtk-doc: Fixing cross-references'
125 @cd $(srcdir) && gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
126 @touch html-build.stamp
128 #### pdf ####
130 pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
131 @echo 'gtk-doc: Building PDF'
132 @-chmod -R u+w $(srcdir)
133 @rm -rf $(srcdir)/$(DOC_MODULE).pdf
134 @mkpdf_imgdirs=""; \
135 if test "x$(HTML_IMAGES)" != "x"; then \
136 for img in $(HTML_IMAGES); do \
137 part=`dirname $$img`; \
138 echo $$mkpdf_imgdirs | grep >/dev/null "\-\-imgdir=$$part "; \
139 if test $$? != 0; then \
140 mkpdf_imgdirs="$$mkpdf_imgdirs --imgdir=$$part"; \
141 fi; \
142 done; \
143 fi; \
144 cd $(srcdir) && gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_imgdirs $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS)
145 @touch pdf-build.stamp
147 ##############
149 clean-local:
150 rm -f *~ *.bak
151 rm -rf .libs
153 distclean-local:
154 cd $(srcdir) && \
155 rm -rf xml $(REPORT_FILES) $(DOC_MODULE).pdf \
156 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
158 maintainer-clean-local: clean
159 cd $(srcdir) && rm -rf html
161 install-data-local:
162 @installfiles=`echo $(srcdir)/html/*`; \
163 if test "$$installfiles" = '$(srcdir)/html/*'; \
164 then echo '-- Nothing to install' ; \
165 else \
166 if test -n "$(DOC_MODULE_VERSION)"; then \
167 installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
168 else \
169 installdir="$(DESTDIR)$(TARGET_DIR)"; \
170 fi; \
171 $(mkinstalldirs) $${installdir} ; \
172 for i in $$installfiles; do \
173 echo '-- Installing '$$i ; \
174 $(INSTALL_DATA) $$i $${installdir}; \
175 done; \
176 if test -n "$(DOC_MODULE_VERSION)"; then \
177 mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
178 $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
179 mv -f $${installdir}/$(DOC_MODULE).devhelp \
180 $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp; \
181 fi; \
182 $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \
185 uninstall-local:
186 @if test -n "$(DOC_MODULE_VERSION)"; then \
187 installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
188 else \
189 installdir="$(DESTDIR)$(TARGET_DIR)"; \
190 fi; \
191 rm -rf $${installdir}
194 # Require gtk-doc when making dist
196 if ENABLE_GTK_DOC
197 dist-check-gtkdoc:
198 else
199 dist-check-gtkdoc:
200 @echo "*** gtk-doc must be installed and enabled in order to make dist"
201 @false
202 endif
204 dist-hook: dist-check-gtkdoc dist-hook-local
205 mkdir $(distdir)/html
206 cp $(srcdir)/html/* $(distdir)/html
207 -cp $(srcdir)/$(DOC_MODULE).pdf $(distdir)/
208 -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
209 -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
210 cd $(distdir) && rm -f $(DISTCLEANFILES)
211 $(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
213 .PHONY : dist-hook-local docs