docs: don't install devhelp (1) files anymore
[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             echo '  DOC   Preparing build'; \
57             files=`echo $(DOC_MAIN_SGML_FILE) $(DOC_OVERRIDES) $(DOC_MODULE)-sections.txt $(DOC_MODULE).types $(content_files)`; \
58             if test "x$$files" != "x" ; then \
59                 for file in $$files ; do \
60                     test -f $(abs_srcdir)/$$file && \
61                         cp -pu $(abs_srcdir)/$$file $(abs_builddir)/ || true; \
62                 done; \
63             fi; \
64         fi
65         @touch setup-build.stamp
66
67 #### scan ####
68
69 # in the case of non-srcdir builds, the built gst directory gets added
70 # to gtk-doc scanning; but only then, to avoid duplicates
71 scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
72         @echo '  DOC   Scanning header files'
73         @if test "x$(top_srcdir)" != "x$(top_builddir)";                        \
74         then                                                            \
75           export BUILT_OPTIONS="--source-dir=$(DOC_BUILD_DIR)";         \
76         fi;                                                             \
77         gtkdoc-scan                                                     \
78                 $(SCAN_OPTIONS) $(EXTRA_HFILES)                         \
79                 --module=$(DOC_MODULE)                                  \
80                 --source-dir=$(DOC_SOURCE_DIR)                          \
81                 $$BUILT_OPTIONS                                         \
82                 --ignore-headers="$(IGNORE_HFILES)"
83         @if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null; then      \
84             echo "  DOC   Introspecting gobjects"; \
85             GST_PLUGIN_SYSTEM_PATH=`cd $(top_builddir) && pwd`          \
86             GST_PLUGIN_PATH=                                            \
87             GST_REGISTRY=doc-registry.xml                               \
88             $(GTKDOC_EXTRA_ENVIRONMENT)                                 \
89             CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)"                         \
90             CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)"                         \
91             LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)"                         \
92             gtkdoc-scangobj --type-init-func="gst_init(NULL,NULL)"      \
93                 --module=$(DOC_MODULE) ;                                \
94         else                                                            \
95             for i in $(SCANOBJ_FILES) ; do                              \
96                test -f $$i || touch $$i ;                               \
97             done                                                        \
98         fi
99         @touch scan-build.stamp
100
101 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
102         @true
103
104 #### xml ####
105
106 ### FIXME: make this error out again when docs are complete
107 sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(expand_content_files)
108         @echo '  DOC   Building XML'
109         @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)
110         @cp ../version.entities xml
111         @touch sgml-build.stamp
112
113 sgml.stamp: sgml-build.stamp
114         @true
115
116 #### html ####
117
118 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
119         @echo '  DOC   Building HTML'
120         @rm -rf html
121         @mkdir html
122         @cp -pr xml html
123         @cp ../version.entities ./
124         @mkhtml_options=""; \
125         @gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-path"; \
126         if test "$(?)" = "0"; then \
127           mkhtml_options=--path="$(abs_srcdir)"; \
128         fi; \
129         cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
130         @mv html/index.sgml html/index.sgml.bak
131         @$(SED) "s/ href=\"$(DOC_MODULE)\// href=\"$(DOC_MODULE)-@GST_MAJORMINOR@\//g" html/index.sgml.bak >html/index.sgml
132         @rm -f html/index.sgml.bak
133         @rm -rf html/xml
134         @rm -f version.entities
135         @test "x$(HTML_IMAGES)" = "x" ||  ( cd $(srcdir) && cp $(HTML_IMAGES) $(abs_builddir)/html )
136         @echo '  DOC   Fixing cross-references'
137         @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
138         @touch html-build.stamp
139
140 clean-local-gtkdoc:
141         @rm -rf xml tmpl html
142 # clean files copied for nonsrcdir templates build
143         @if test x"$(srcdir)" != x. ; then \
144                 rm -rf $(DOC_MODULE).types; \
145         fi
146 else
147 all-local:
148 clean-local-gtkdoc:
149 endif
150
151 clean-local: clean-local-gtkdoc
152         @rm -f *~ *.bak
153         @rm -rf .libs
154
155 distclean-local:
156         @rm -f $(REPORT_FILES) \
157                 $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
158         @rm -rf tmpl/*.sgml.bak
159         @rm -f $(DOC_MODULE).hierarchy
160         @rm -f *.stamp || true
161         @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
162             rm -f $(DOC_MAIN_SGML_FILE) ; \
163             rm -f $(DOC_OVERRIDES) ; \
164             rm -f $(DOC_MODULE).types ; \
165             rm -f $(DOC_MODULE).interfaces ; \
166             rm -f $(DOC_MODULE).prerequisites ; \
167             rm -f $(DOC_MODULE)-sections.txt ; \
168             rm -rf tmpl/*.sgml ; \
169         fi
170         @rm -rf *.o
171
172 maintainer-clean-local: clean
173         @cd $(srcdir) && rm -rf html \
174                 xml $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
175
176 # thomas: make docs parallel installable; devhelp requires majorminor too
177 install-data-local:
178         (installfiles=`echo $(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css`; \
179         if test "$$installfiles" = '$(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css'; \
180         then echo '-- Nothing to install' ; \
181         else \
182           $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \
183           for i in $$installfiles; do \
184             echo '-- Installing '$$i ; \
185             $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
186           done; \
187           echo '-- Installing $(builddir)/html/$(DOC_MODULE).devhelp2' ; \
188           if test -e $(builddir)/html/$(DOC_MODULE).devhelp2; then \
189                     $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE).devhelp2 \
190                     $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; \
191           fi; \
192           (which gtkdoc-rebase >/dev/null && \
193             gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$(DESTDIR)$(TARGET_DIR)) || true ; \
194         fi)
195 uninstall-local:
196         if test -d $(DESTDIR)$(TARGET_DIR); then \
197           rm -rf $(DESTDIR)$(TARGET_DIR)/*; \
198           rmdir -p $(DESTDIR)$(TARGET_DIR) 2>/dev/null || true; \
199         else \
200           echo '-- Nothing to uninstall' ; \
201         fi;
202
203
204 #
205 # Require gtk-doc when making dist
206 #
207 if ENABLE_GTK_DOC
208 dist-check-gtkdoc:
209 else
210 dist-check-gtkdoc:
211         @echo "*** gtk-doc must be installed and enabled in order to make dist"
212         @false
213 endif
214
215 dist-hook: dist-check-gtkdoc dist-hook-local
216         mkdir $(distdir)/html
217         cp html/* $(distdir)/html
218         -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
219         -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
220         cd $(distdir) && rm -f $(DISTCLEANFILES)
221         -gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
222
223 .PHONY : dist-hook-local docs
224
225 # avoid spurious build errors when distchecking with -jN
226 .NOTPARALLEL: