*.mak: more spaces/tabs clean-ups
[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         scan-build.stamp                \
28         tmpl-build.stamp                \
29         sgml-build.stamp                \
30         html-build.stamp                \
31         $(srcdir)/tmpl.stamp            \
32         $(srcdir)/sgml.stamp            \
33         $(srcdir)/html.stamp
34
35 SCANOBJ_FILES =                         \
36         $(DOC_MODULE).args              \
37         $(DOC_MODULE).hierarchy         \
38         $(DOC_MODULE).interfaces                \
39         $(DOC_MODULE).prerequisites     \
40         $(DOC_MODULE).signals           \
41         .libs/$(DOC_MODULE)-scan.o
42
43 REPORT_FILES = \
44         $(DOC_MODULE)-undocumented.txt \
45         $(DOC_MODULE)-undeclared.txt \
46         $(DOC_MODULE)-unused.txt
47
48 CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) doc-registry.xml
49
50 if ENABLE_GTK_DOC
51 all-local: html-build.stamp
52
53 #### scan ####
54
55 # in the case of non-srcdir builds, the built gst directory gets added
56 # to gtk-doc scanning; but only then, to avoid duplicates
57 scan-build.stamp: $(HFILE_GLOB) $(SCANOBJ_DEPS) $(basefiles)
58         @echo '*** Scanning header files ***'
59         if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null;  \
60         then                                                            \
61             if test x"$(srcdir)" != x. ; then                           \
62                 cp $(srcdir)/$(DOC_MODULE).types . ;                    \
63                 chmod u+w $(DOC_MODULE).types ;                         \
64             fi ;                                                        \
65             GST_PLUGIN_SYSTEM_PATH=`cd $(top_builddir) && pwd`          \
66             GST_PLUGIN_PATH=                                            \
67             GST_REGISTRY=doc-registry.xml                               \
68             $(GTKDOC_EXTRA_ENVIRONMENT)                                 \
69             CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)"                         \
70             CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)"                         \
71             LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)"                         \
72             gtkdoc-scangobj --type-init-func="gst_init(NULL,NULL)"      \
73                 --module=$(DOC_MODULE) ;                                \
74         else                                                            \
75             cd $(srcdir) ;                                              \
76             for i in $(SCANOBJ_FILES) ; do                              \
77                test -f $$i || touch $$i ;                               \
78             done                                                        \
79         fi
80         if test "x$(top_srcdir)" != "x$(top_builddir)";                 \
81         then                                                            \
82           export BUILT_OPTIONS="--source-dir=$(DOC_BUILD_DIR)";         \
83         fi;                                                             \
84         gtkdoc-scan                                                     \
85                 $(SCAN_OPTIONS) $(EXTRA_HFILES)                         \
86                 --module=$(DOC_MODULE)                                  \
87                 --source-dir=$(DOC_SOURCE_DIR)                          \
88                 $$BUILT_OPTIONS                                         \
89                 --ignore-headers="$(IGNORE_HFILES)"
90         touch scan-build.stamp
91
92 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp
93         @true
94
95 #### templates ####
96
97 tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_OVERRIDES)
98         @echo '*** Rebuilding template files ***'
99         if test x"$(srcdir)" != x. ; then \
100             cp $(srcdir)/$(DOC_MODULE)-sections.txt . ; \
101             touch $(DOC_MODULE)-decl.txt ; \
102         fi
103         gtkdoc-mktmpl --module=$(DOC_MODULE) | tee tmpl-build.log
104         @if test -s $(DOC_MODULE)-unused.txt; then \
105           echo "============================================================"; \
106           echo "Please add the following to $(DOC_MODULE)-sections.txt:     "; \
107           cat $(DOC_MODULE)-unused.txt;                                        \
108           echo "============================================================"; \
109         fi
110         rm -f tmpl-build.log
111         touch tmpl-build.stamp
112
113 tmpl.stamp: tmpl-build.stamp
114         @true
115
116 #### xml ####
117
118 ### FIXME: make this error out again when docs are complete
119 sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(expand_content_files)
120         @echo '*** Building XML ***'
121         gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR)  --expand-content-files="$(expand_content_files)" --main-sgml-file=$(srcdir)/$(DOC_MAIN_SGML_FILE) --output-format=xml $(MKDB_OPTIONS) | tee sgml-build.log
122         @if grep "WARNING:" sgml-build.log > /dev/null; then true; fi # exit 1; fi
123         cp ../version.entities xml
124         rm sgml-build.log
125         touch sgml-build.stamp
126
127 sgml.stamp: sgml-build.stamp
128         @true
129
130 #### html ####
131
132 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
133         @echo '*** Building HTML ***'
134         if test -d html; then rm -rf html; fi
135         mkdir html
136         cp $(srcdir)/$(DOC_MAIN_SGML_FILE) html
137         @for f in $(content_files); do cp $(srcdir)/$$f html; done
138         cp -pr xml html
139         cp ../version.entities html
140         cd html && gtkdoc-mkhtml $(DOC_MODULE) $(DOC_MAIN_SGML_FILE)
141         mv html/index.sgml html/index.sgml.bak
142         $(SED) "s/ href=\"$(DOC_MODULE)\// href=\"$(DOC_MODULE)-@GST_MAJORMINOR@\//g" html/index.sgml.bak >html/index.sgml
143         rm -f html/index.sgml.bak
144         rm -f html/$(DOC_MAIN_SGML_FILE)
145         rm -rf html/xml
146         rm -f html/version.entities
147         test "x$(HTML_IMAGES)" = "x" || for i in "" $(HTML_IMAGES) ; do \
148             if test "$$i" != ""; then cp $(srcdir)/$$i html ; fi; done
149         @echo '-- Fixing Crossreferences'
150         gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
151         touch html-build.stamp
152
153 clean-local-gtkdoc:
154         rm -rf xml tmpl html
155 # clean files copied for nonsrcdir templates build
156         if test x"$(srcdir)" != x. ; then \
157                 rm -rf $(DOC_MODULE).types; \
158         fi
159 else
160 all-local:
161 clean-local-gtkdoc:
162 endif
163
164 clean-local: clean-local-gtkdoc
165         rm -f *~ *.bak
166         rm -rf .libs
167
168 # company: don't delete .sgml and -sections.txt as they're in git
169 # FIXME : thomas added all sgml files and some other things to make
170 # make distcheck work
171 distclean-local:
172         rm -f $(REPORT_FILES) \
173                 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
174         rm -rf tmpl/*.sgml.bak
175         rm -f $(DOC_MODULE).hierarchy
176         rm -f *.stamp || true
177         if test x"$(srcdir)" != x. ; then \
178             rm -f $(DOC_MODULE)-docs.sgml ; \
179             rm -f $(DOC_MODULE).types ; \
180             rm -f $(DOC_MODULE).interfaces ; \
181             rm -f $(DOC_MODULE)-overrides.txt ; \
182             rm -f $(DOC_MODULE).prerequisites ; \
183             rm -f $(DOC_MODULE)-sections.txt ; \
184             rm -rf tmpl/*.sgml ; \
185         fi
186         rm -rf *.o
187
188 maintainer-clean-local: clean
189         cd $(srcdir) && rm -rf html \
190                 xml $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
191
192 # thomas: make docs parallel installable; devhelp requires majorminor too
193 install-data-local:
194         (installfiles=`echo $(srcdir)/html/*.sgml $(srcdir)/html/*.html $(srcdir)/html/*.png $(srcdir)/html/*.css`; \
195         if test "$$installfiles" = '$(srcdir)/html/*.sgml $(srcdir)/html/*.html $(srcdir)/html/*.png $(srcdir)/html/*.css'; \
196         then echo '-- Nothing to install' ; \
197         else \
198           $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \
199           for i in $$installfiles; do \
200             echo '-- Installing '$$i ; \
201             $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
202           done; \
203           echo '-- Installing $(srcdir)/html/$(DOC_MODULE).devhelp' ; \
204           $(INSTALL_DATA) $(srcdir)/html/$(DOC_MODULE).devhelp \
205             $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp; \
206           if test -e $(srcdir)/html/$(DOC_MODULE).devhelp2; then \
207                     $(INSTALL_DATA) $(srcdir)/html/$(DOC_MODULE).devhelp2 \
208                     $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; \
209           fi; \
210           (which gtkdoc-rebase >/dev/null && \
211             gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$(DESTDIR)$(TARGET_DIR)) || true ; \
212         fi)
213 uninstall-local:
214         if test -d $(DESTDIR)$(TARGET_DIR); then \
215           rm -rf $(DESTDIR)$(TARGET_DIR)/*; \
216           rmdir -p $(DESTDIR)$(TARGET_DIR) 2>/dev/null || true; \
217         else \
218           echo '-- Nothing to uninstall' ; \
219         fi;
220
221
222 #
223 # Require gtk-doc when making dist
224 #
225 if ENABLE_GTK_DOC
226 dist-check-gtkdoc:
227 else
228 dist-check-gtkdoc:
229         @echo "*** gtk-doc must be installed and enabled in order to make dist"
230         @false
231 endif
232
233 dist-hook: dist-check-gtkdoc dist-hook-local
234         mkdir $(distdir)/html
235         cp html/* $(distdir)/html
236         -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
237         -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
238         cd $(distdir) && rm -f $(DISTCLEANFILES)
239         -gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
240
241 .PHONY : dist-hook-local docs