gtk-doc*.mak: don't tee build log output to files
[platform/upstream/gst-common.git] / gtk-doc.mak
1 ###########################################################################
2 # Everything below here is generic and you shouldn't need to change it.
3 ###########################################################################
4 # thomas: except of course that we did
5
6 # thomas: copied from glib-2
7 # We set GPATH here; this gives us semantics for GNU make
8 # which are more like other make's VPATH, when it comes to
9 # whether a source that is a target of one rule is then
10 # searched for in VPATH/GPATH.
11 #
12 GPATH = $(srcdir)
13
14 # thomas: make docs parallel installable
15 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@
16
17 EXTRA_DIST =                            \
18         $(content_files)                \
19         $(extra_files)                  \
20         $(HTML_IMAGES)                  \
21         $(DOC_MAIN_SGML_FILE)           \
22         $(DOC_MODULE).types             \
23         $(DOC_OVERRIDES)                \
24         $(DOC_MODULE)-sections.txt
25
26 DOC_STAMPS =                            \
27         setup-build.stamp               \
28         scan-build.stamp                \
29         sgml-build.stamp                \
30         html-build.stamp                \
31         sgml.stamp              \
32         html.stamp
33
34 SCANOBJ_FILES =                         \
35         $(DOC_MODULE).args              \
36         $(DOC_MODULE).hierarchy         \
37         $(DOC_MODULE).interfaces                \
38         $(DOC_MODULE).prerequisites     \
39         $(DOC_MODULE).signals           \
40         .libs/$(DOC_MODULE)-scan.o
41
42 REPORT_FILES = \
43         $(DOC_MODULE)-undocumented.txt \
44         $(DOC_MODULE)-undeclared.txt \
45         $(DOC_MODULE)-unused.txt
46
47 CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) doc-registry.xml
48
49 if ENABLE_GTK_DOC
50 all-local: html-build.stamp
51
52 #### setup ####
53
54 setup-build.stamp: $(content_files)
55         -@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
56            cp -p $(abs_srcdir)/$(DOC_MAIN_SGML_FILE) \
57              $(abs_srcdir)/$(DOC_MODULE)-overrides.txt \
58              $(abs_srcdir)/$(DOC_MODULE)-sections.txt \
59              $(abs_srcdir)/$(DOC_MODULE).types \
60              $(abs_builddir)/; \
61            if test "x$(content_files)" != "x" ; then \
62                for file in $(content_files) ; do \
63                    test -f $(abs_srcdir)/$$file || \
64                        cp -p $(abs_srcdir)/$$file $(abs_builddir)/; \
65                done \
66            fi \
67         fi
68         @touch setup-build.stamp
69
70 #### scan ####
71
72 # in the case of non-srcdir builds, the built gst directory gets added
73 # to gtk-doc scanning; but only then, to avoid duplicates
74 scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
75         @echo '*** Scanning header files ***'
76         @if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null;   \
77         then                                                            \
78             GST_PLUGIN_SYSTEM_PATH=`cd $(top_builddir) && pwd`          \
79             GST_PLUGIN_PATH=                                            \
80             GST_REGISTRY=doc-registry.xml                               \
81             $(GTKDOC_EXTRA_ENVIRONMENT)                                 \
82             CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)"                         \
83             CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)"                         \
84             LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)"                         \
85             gtkdoc-scangobj --type-init-func="gst_init(NULL,NULL)"      \
86                 --module=$(DOC_MODULE) ;                                \
87         else                                                            \
88             for i in $(SCANOBJ_FILES) ; do                              \
89                test -f $$i || touch $$i ;                               \
90             done                                                        \
91         fi
92         @if test "x$(top_srcdir)" != "x$(top_builddir)";                        \
93         then                                                            \
94           export BUILT_OPTIONS="--source-dir=$(DOC_BUILD_DIR)";         \
95         fi;                                                             \
96         gtkdoc-scan                                                     \
97                 $(SCAN_OPTIONS) $(EXTRA_HFILES)                         \
98                 --module=$(DOC_MODULE)                                  \
99                 --source-dir=$(DOC_SOURCE_DIR)                          \
100                 $$BUILT_OPTIONS                                         \
101                 --ignore-headers="$(IGNORE_HFILES)"
102         @touch scan-build.stamp
103
104 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
105         @true
106
107 #### xml ####
108
109 ### FIXME: make this error out again when docs are complete
110 sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(expand_content_files)
111         @echo '*** Building XML ***'
112         @gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR)  --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) --output-format=xml $(MKDB_OPTIONS)
113         @cp ../version.entities xml
114         @touch sgml-build.stamp
115
116 sgml.stamp: sgml-build.stamp
117         @true
118
119 #### html ####
120
121 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
122         @echo '*** Building HTML ***'
123         @rm -rf html
124         @mkdir html
125         @cp -pr xml html
126         @cp ../version.entities ./
127         @mkhtml_options=""; \
128         @gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-path"; \
129         if test "$(?)" = "0"; then \
130           mkhtml_options=--path="$(abs_srcdir)"; \
131         fi; \
132         cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
133         @mv html/index.sgml html/index.sgml.bak
134         @$(SED) "s/ href=\"$(DOC_MODULE)\// href=\"$(DOC_MODULE)-@GST_MAJORMINOR@\//g" html/index.sgml.bak >html/index.sgml
135         @rm -f html/index.sgml.bak
136         @rm -rf html/xml
137         @rm -f version.entities
138         @test "x$(HTML_IMAGES)" = "x" ||  ( cd $(srcdir) && cp $(HTML_IMAGES) $(abs_builddir)/html )
139         @echo '-- Fixing Crossreferences'
140         @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
141         @touch html-build.stamp
142
143 clean-local-gtkdoc:
144         @rm -rf xml tmpl html
145 # clean files copied for nonsrcdir templates build
146         @if test x"$(srcdir)" != x. ; then \
147                 rm -rf $(DOC_MODULE).types; \
148         fi
149 else
150 all-local:
151 clean-local-gtkdoc:
152 endif
153
154 clean-local: clean-local-gtkdoc
155         @rm -f *~ *.bak
156         @rm -rf .libs
157
158 distclean-local:
159         @rm -f $(REPORT_FILES) \
160                 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
161         @rm -rf tmpl/*.sgml.bak
162         @rm -f $(DOC_MODULE).hierarchy
163         @rm -f *.stamp || true
164         @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
165             rm -f $(DOC_MODULE)-docs.sgml ; \
166             rm -f $(DOC_MODULE).types ; \
167             rm -f $(DOC_MODULE).interfaces ; \
168             rm -f $(DOC_MODULE)-overrides.txt ; \
169             rm -f $(DOC_MODULE).prerequisites ; \
170             rm -f $(DOC_MODULE)-sections.txt ; \
171             rm -rf tmpl/*.sgml ; \
172         fi
173         @rm -rf *.o
174
175 maintainer-clean-local: clean
176         @cd $(srcdir) && rm -rf html \
177                 xml $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
178
179 # thomas: make docs parallel installable; devhelp requires majorminor too
180 install-data-local:
181         (installfiles=`echo $(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css`; \
182         if test "$$installfiles" = '$(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css'; \
183         then echo '-- Nothing to install' ; \
184         else \
185           $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \
186           for i in $$installfiles; do \
187             echo '-- Installing '$$i ; \
188             $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
189           done; \
190           echo '-- Installing $(builddir)/html/$(DOC_MODULE).devhelp' ; \
191           $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE).devhelp \
192             $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp; \
193           if test -e $(builddir)/html/$(DOC_MODULE).devhelp2; then \
194                     $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE).devhelp2 \
195                     $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; \
196           fi; \
197           (which gtkdoc-rebase >/dev/null && \
198             gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$(DESTDIR)$(TARGET_DIR)) || true ; \
199         fi)
200 uninstall-local:
201         if test -d $(DESTDIR)$(TARGET_DIR); then \
202           rm -rf $(DESTDIR)$(TARGET_DIR)/*; \
203           rmdir -p $(DESTDIR)$(TARGET_DIR) 2>/dev/null || true; \
204         else \
205           echo '-- Nothing to uninstall' ; \
206         fi;
207
208
209 #
210 # Require gtk-doc when making dist
211 #
212 if ENABLE_GTK_DOC
213 dist-check-gtkdoc:
214 else
215 dist-check-gtkdoc:
216         @echo "*** gtk-doc must be installed and enabled in order to make dist"
217         @false
218 endif
219
220 dist-hook: dist-check-gtkdoc dist-hook-local
221         mkdir $(distdir)/html
222         cp html/* $(distdir)/html
223         -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
224         -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
225         cd $(distdir) && rm -f $(DISTCLEANFILES)
226         -gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
227
228 .PHONY : dist-hook-local docs
229
230 # avoid spurious build errors when distchecking with -jN
231 .NOTPARALLEL: