logging: add back support for GTKDOC_TRACE
[gtk-doc.git] / tests / gtk-doc.make
blobfdccfa06c60449485ba090c0827c04915512fead
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) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
9 GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
10 GTKDOC_RUN = $(LIBTOOL) --mode=execute
11 else
12 GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
13 GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(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 # we don't install anything in tests
25 #TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
27 SETUP_FILES = \
28 $(content_files) \
29 $(DOC_MAIN_SGML_FILE) \
30 $(DOC_MODULE)-sections.txt \
31 $(DOC_MODULE)-overrides.txt
33 EXTRA_DIST = \
34 $(HTML_IMAGES) \
35 $(SETUP_FILES)
37 DOC_STAMPS=setup-build.stamp scan-build.stamp sgml-build.stamp \
38 html-build.stamp pdf-build.stamp \
39 sgml.stamp html.stamp pdf.stamp
41 SCANOBJ_FILES = \
42 $(DOC_MODULE).args \
43 $(DOC_MODULE).hierarchy \
44 $(DOC_MODULE).interfaces \
45 $(DOC_MODULE).prerequisites \
46 $(DOC_MODULE).signals
48 REPORT_FILES = \
49 $(DOC_MODULE)-undocumented.txt \
50 $(DOC_MODULE)-undeclared.txt \
51 $(DOC_MODULE)-unused.txt
53 CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) \
54 $(DOC_MODULE).pdf \
55 ts \
56 gtkdoc-scan.log \
57 gtkdoc-scangobj.log \
58 gtkdoc-mkdb.log \
59 gtkdoc-mkhtml.log \
60 gtkdoc-mkpdf.log \
61 gtkdoc-fixxref.log
63 GITIGNOREFILES = \
64 html.ref xml.ref
66 check-local: html-build.stamp pdf-build.stamp
67 @ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
68 echo " DOC `$(DATE_FMT_CMD)$$tsd`: All done"
70 docs: html-build.stamp pdf-build.stamp
71 @ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
72 echo " DOC `$(DATE_FMT_CMD)$$tsd`: All done"
74 $(REPORT_FILES): sgml-build.stamp
76 ts:
77 @echo >ts `date $(TS_FMT)`;
79 #### setup ####
81 setup-build.stamp: ts
82 -@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
83 echo ' DOC Preparing build'; \
84 files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \
85 if test "x$$files" != "x" ; then \
86 for file in $$files ; do \
87 test -f $(abs_srcdir)/$$file && \
88 cp -pf $(abs_srcdir)/$$file $(abs_builddir)/ || true; \
89 done; \
90 fi; \
92 @touch setup-build.stamp
94 #### scan ####
96 scan-build.stamp: ts setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
97 @ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
98 echo " DOC `$(DATE_FMT_CMD)$$tsd`: Scanning header files"
99 @_source_dir='' ; \
100 for i in $(DOC_SOURCE_DIR) ; do \
101 _source_dir="$${_source_dir} --source-dir=$$i" ; \
102 done ; \
103 echo "gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES)" >gtkdoc-scan.log; \
104 PATH=$(abs_top_builddir):$(PATH) PERL5LIB=$(abs_top_builddir):$(PERL5LIB) \
105 gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) 2>&1 | tee -a gtkdoc-scan.log
106 @if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
107 ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
108 echo " DOC `$(DATE_FMT_CMD)$$tsd`: Introspecting gobjects"; \
109 scanobj_options=""; \
110 if test "x$(V)" = "x1"; then \
111 scanobj_options="--verbose"; \
112 fi; \
113 echo "gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) $$scanobj_options" >gtkdoc-scangobj.log; \
114 PATH=$(abs_top_builddir):$(PATH) PERL5LIB=$(abs_top_builddir):$(PERL5LIB) \
115 CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \
116 gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) $$scanobj_options 2>&1 | tee -a gtkdoc-scangobj.log; \
117 else \
118 for i in $(SCANOBJ_FILES) ; do \
119 test -f $$i || touch $$i ; \
120 done \
122 @touch scan-build.stamp
124 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
125 @true
127 #### xml ####
129 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
130 @ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
131 echo " DOC `$(DATE_FMT_CMD)$$tsd`: Building XML"
132 @_source_dir='' ; \
133 for i in $(DOC_SOURCE_DIR) ; do \
134 _source_dir="$${_source_dir} --source-dir=$$i" ; \
135 done ; \
136 echo "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)" >gtkdoc-mkdb.log; \
137 PATH=$(abs_top_builddir):$(PATH) PERL5LIB=$(abs_top_builddir):$(PERL5LIB) \
138 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) 2>&1 | tee -a gtkdoc-mkdb.log
139 @touch sgml-build.stamp
141 sgml.stamp: sgml-build.stamp
142 @true
144 xml/gtkdocentities.ent: Makefile
145 @$(MKDIR_P) $(@D) && ( \
146 echo "<!ENTITY package \"$(PACKAGE)\">"; \
147 echo "<!ENTITY package_bugreport \"$(PACKAGE_BUGREPORT)\">"; \
148 echo "<!ENTITY package_name \"$(PACKAGE_NAME)\">"; \
149 echo "<!ENTITY package_string \"$(PACKAGE_STRING)\">"; \
150 echo "<!ENTITY package_tarname \"$(PACKAGE_TARNAME)\">"; \
151 echo "<!ENTITY package_url \"$(PACKAGE_URL)\">"; \
152 echo "<!ENTITY package_version \"$(PACKAGE_VERSION)\">"; \
153 ) > $@
155 #### html ####
157 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
158 @ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
159 echo " DOC `$(DATE_FMT_CMD)$$tsd`: Building HTML"
160 @rm -rf html
161 @mkdir html
162 @mkhtml_options=""; \
163 if test "x$(V)" = "x1"; then \
164 mkhtml_options="$$mkhtml_options --verbose"; \
165 fi; \
166 echo "gtkdoc-mkhtml --uninstalled --path="$(abs_srcdir)" $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)" >gtkdoc-mkhtml.log; \
167 cd html && PATH=$(abs_top_builddir):$(PATH) PERL5LIB=$(abs_top_builddir):$(PERL5LIB) ABS_TOP_SRCDIR=$(abs_top_srcdir) \
168 gtkdoc-mkhtml --uninstalled --path="$(abs_srcdir)" $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) 2>&1 | tee -a ../gtkdoc-mkhtml.log
169 -@test "x$(HTML_IMAGES)" = "x" || \
170 for file in $(HTML_IMAGES) ; do \
171 if test -f $(abs_srcdir)/$$file ; then \
172 cp $(abs_srcdir)/$$file $(abs_builddir)/html; \
173 fi; \
174 if test -f $(abs_builddir)/$$file ; then \
175 cp $(abs_builddir)/$$file $(abs_builddir)/html; \
176 fi; \
177 done;
178 @ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
179 echo " DOC `$(DATE_FMT_CMD)$$tsd`: Fixing cross-references"
180 @echo "gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)" >gtkdoc-fixxref.log; \
181 PATH=$(abs_top_builddir):$(PATH) PERL5LIB=$(abs_top_builddir):$(PERL5LIB) \
182 gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) 2>&1 | tee -a gtkdoc-fixxref.log
183 @touch html-build.stamp
185 #### pdf ####
187 pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
188 @ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
189 echo " DOC `$(DATE_FMT_CMD)$$tsd`: Building PDF"
190 @rm -f $(DOC_MODULE).pdf
191 @mkpdf_options=""; \
192 if test "x$(V)" = "x1"; then \
193 mkpdf_options="$$mkpdf_options --verbose"; \
194 fi; \
195 if test "x$(HTML_IMAGES)" != "x"; then \
196 for img in $(HTML_IMAGES); do \
197 part=`dirname $$img`; \
198 echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \
199 if test $$? != 0; then \
200 mkpdf_options="$$mkpdf_options --imgdir=$$part"; \
201 fi; \
202 done; \
203 fi; \
204 echo "gtkdoc-mkpdf --uninstalled --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS)" >gtkdoc-mkpdf.log; \
205 PATH=$(abs_top_builddir):$(PATH) PERL5LIB=$(abs_top_builddir):$(PERL5LIB) ABS_TOP_SRCDIR=$(abs_top_srcdir) \
206 gtkdoc-mkpdf --uninstalled --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS) 2>&1 | tee -a gtkdoc-mkpdf.log
207 @touch pdf-build.stamp
209 ##############
211 # we need to enforce a rebuild for the tests
212 clean-local:
213 @rm -f *~ *.bak ts gtkdoc-*.log
214 @rm -rf .libs
215 @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \
216 rm -f $(DOC_MODULE).types; \
218 $(MAKE) distclean-local
220 distclean-local:
221 @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \
222 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
223 @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
224 rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \
227 maintainer-clean-local:
228 @rm -rf xml html
230 .PHONY : dist-hook-local docs