gtk-doc.mak 8.16 KB
Newer Older
1 2 3 4 5
###########################################################################
# Everything below here is generic and you shouldn't need to change it.
###########################################################################
# thomas: except of course that we did

6 7 8 9 10 11 12 13 14 15
if GTK_DOC_USE_LIBTOOL
GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
GTKDOC_RUN = $(LIBTOOL) --mode=execute
else
GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
GTKDOC_RUN =
endif

16 17 18 19 20 21 22 23
# We set GPATH here; this gives us semantics for GNU make
# which are more like other make's VPATH, when it comes to
# whether a source that is a target of one rule is then
# searched for in VPATH/GPATH.
#
GPATH = $(srcdir)

# thomas: make docs parallel installable
24
TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)-@GST_API_VERSION@
25 26 27 28 29 30 31 32 33 34 35

EXTRA_DIST = 				\
	$(content_files)		\
	$(extra_files)			\
	$(HTML_IMAGES)			\
	$(DOC_MAIN_SGML_FILE)		\
	$(DOC_MODULE).types		\
	$(DOC_OVERRIDES)		\
	$(DOC_MODULE)-sections.txt

DOC_STAMPS =				\
36
	setup-build.stamp		\
37 38 39
	scan-build.stamp		\
	sgml-build.stamp		\
	html-build.stamp		\
40 41
	sgml.stamp		\
	html.stamp
42 43 44 45

SCANOBJ_FILES =				\
	$(DOC_MODULE).args		\
	$(DOC_MODULE).hierarchy		\
46
	$(DOC_MODULE).interfaces		\
47
	$(DOC_MODULE).prerequisites	\
48 49
	$(DOC_MODULE).signals		\
	.libs/$(DOC_MODULE)-scan.o
50

51 52 53 54 55
REPORT_FILES = \
	$(DOC_MODULE)-undocumented.txt \
	$(DOC_MODULE)-undeclared.txt \
	$(DOC_MODULE)-unused.txt

56
CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) doc-registry.xml
57

58
if ENABLE_GTK_DOC
59 60
all-local: html-build.stamp

61 62
#### setup ####

63
setup-build.stamp: $(content_files)
64
	-@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
65
	    echo '  DOC   Preparing build'; \
66 67 68 69 70 71 72
	    files=`echo $(DOC_MAIN_SGML_FILE) $(DOC_OVERRIDES) $(DOC_MODULE)-sections.txt $(DOC_MODULE).types $(content_files)`; \
	    if test "x$$files" != "x" ; then \
	        for file in $$files ; do \
	            test -f $(abs_srcdir)/$$file && \
	                cp -pu $(abs_srcdir)/$$file $(abs_builddir)/ || true; \
	        done; \
	    fi; \
73
	fi
74
	@touch setup-build.stamp
75

76 77 78 79
#### scan ####

# in the case of non-srcdir builds, the built gst directory gets added
# to gtk-doc scanning; but only then, to avoid duplicates
80
scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
81
	@echo '  DOC   Scanning header files'
82 83 84 85
	@_source_dir='' ;						\
	for i in $(DOC_SOURCE_DIR) ; do					\
	    _source_dir="$${_source_dir} --source-dir=$$i" ;	        \
	done ;							        \
86 87 88
	gtkdoc-scan							\
		$(SCAN_OPTIONS) $(EXTRA_HFILES)				\
		--module=$(DOC_MODULE)					\
89
		$${_source_dir}         				\
90 91 92
		--ignore-headers="$(IGNORE_HFILES)"
	@if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null; then	\
	    echo "  DOC   Introspecting gobjects"; \
93 94 95 96 97 98 99
	    scanobj_options=""; \
	    gtkdoc-scangobj 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
	    if test "$$?" = "0"; then \
	        if test "x$(V)" = "x1"; then \
	            scanobj_options="--verbose"; \
	        fi; \
	    fi; \
100 101
	    GST_PLUGIN_SYSTEM_PATH_1_0=`cd $(top_builddir) && pwd`	\
	    GST_PLUGIN_PATH_1_0=					\
102
	    GST_REGISTRY_1_0=doc-registry.xml				\
103
	    $(GTKDOC_EXTRA_ENVIRONMENT)					\
104
	    CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)"	\
105 106
	    CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)"				\
	    LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)"				\
107
	    gtkdoc-scangobj --type-init-func="gst_init(NULL,NULL)"	\
108
	        $$scanobj_options --module=$(DOC_MODULE) ;		\
109 110
	else								\
	    for i in $(SCANOBJ_FILES) ; do				\
111
	       $(MKDIR_P) $(dirname $$i) ;				\
112
	       test -f $$i || touch $$i ;				\
113 114
	    done							\
	fi
115
	@touch scan-build.stamp
116

117
$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
118 119 120 121
	@true

#### xml ####

122
sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(expand_content_files)
123
	@echo '  DOC   Building XML'
124 125 126 127
	@_source_dir='' ;						\
	for i in $(DOC_SOURCE_DIR) ; do					\
	    _source_dir="$${_source_dir} --source-dir=$$i" ;	        \
	done ;							        \
128
	gtkdoc-mkdb --module=$(DOC_MODULE) $${_source_dir}  --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) --output-format=xml $(MKDB_OPTIONS)
129 130
	@cp ../version.entities xml
	@touch sgml-build.stamp
131 132 133 134 135 136 137

sgml.stamp: sgml-build.stamp
	@true

#### html ####

html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
138
	@echo '  DOC   Building HTML'
139 140
	@rm -rf html
	@mkdir html
141 142
	@cp -pr xml html
	@cp ../version.entities ./
143
	@mkhtml_options=""; \
144 145 146 147 148 149
	gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
	if test "$(?)" = "0"; then \
	  if test "x$(V)" = "x1"; then \
	    mkhtml_options="$$mkhtml_options --verbose"; \
	  fi; \
	fi; \
150
	@gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-path"; \
151 152 153
	if test "$(?)" = "0"; then \
	  mkhtml_options=--path="$(abs_srcdir)"; \
	fi; \
154
	cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE)-@GST_API_VERSION@ ../$(DOC_MAIN_SGML_FILE)
155 156 157
	@rm -rf html/xml
	@rm -f version.entities
	@test "x$(HTML_IMAGES)" = "x" ||  ( cd $(srcdir) && cp $(HTML_IMAGES) $(abs_builddir)/html )
158
	@echo '  DOC   Fixing cross-references'
159 160
	@gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
	@touch html-build.stamp
161 162

clean-local-gtkdoc:
163
	@rm -rf xml tmpl html
164
# clean files copied for nonsrcdir templates build
165
	@if test x"$(srcdir)" != x. ; then \
166 167
	        rm -rf $(DOC_MODULE).types; \
	fi
168 169
else
all-local:
170
clean-local-gtkdoc:
171 172
endif

173
clean-local: clean-local-gtkdoc
174 175
	@rm -f *~ *.bak
	@rm -rf .libs
176

177
distclean-local:
178
	@rm -f $(REPORT_FILES) \
179
	        $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
180 181 182 183
	@rm -rf tmpl/*.sgml.bak
	@rm -f $(DOC_MODULE).hierarchy
	@rm -f *.stamp || true
	@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
184 185
	    rm -f $(DOC_MAIN_SGML_FILE) ; \
	    rm -f $(DOC_OVERRIDES) ; \
186 187 188 189
	    rm -f $(DOC_MODULE).types ; \
	    rm -f $(DOC_MODULE).interfaces ; \
	    rm -f $(DOC_MODULE).prerequisites ; \
	    rm -f $(DOC_MODULE)-sections.txt ; \
190
	    rm -f $(content_files) ; \
191 192
	    rm -rf tmpl/*.sgml ; \
	fi
193
	@rm -rf *.o
194

195
maintainer-clean-local: clean
196
	@cd $(srcdir) && rm -rf html \
197
		xml $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
198

199 200
# thomas: make docs parallel installable; devhelp requires majorminor too
install-data-local:
201 202
	(installfiles=`echo $(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css`; \
	if test "$$installfiles" = '$(builddir)/html/*.sgml $(builddir)/html/*.html $(builddir)/html/*.png $(builddir)/html/*.css'; \
203 204
	then echo '-- Nothing to install' ; \
	else \
205
	  $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \
206 207 208 209
	  for i in $$installfiles; do \
	    echo '-- Installing '$$i ; \
	    $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
	  done; \
210 211 212
	  echo '-- Installing $(builddir)/html/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2' ; \
	  if test -e $(builddir)/html/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2; then \
	            $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2 \
213
	            $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2; \
214
	  fi; \
215
	  $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$(DESTDIR)$(TARGET_DIR) || true ; \
Felipe Contreras's avatar
Felipe Contreras committed
216
	fi)
217
uninstall-local:
218 219 220
	if test -d $(DESTDIR)$(TARGET_DIR); then \
	  rm -rf $(DESTDIR)$(TARGET_DIR)/*; \
	  rmdir -p $(DESTDIR)$(TARGET_DIR) 2>/dev/null || true; \
221
	else \
222 223 224
	  echo '-- Nothing to uninstall' ; \
	fi;

225 226 227 228

#
# Require gtk-doc when making dist
#
229
if ENABLE_GTK_DOC
230 231 232 233 234 235 236 237 238
dist-check-gtkdoc:
else
dist-check-gtkdoc:
	@echo "*** gtk-doc must be installed and enabled in order to make dist"
	@false
endif

dist-hook: dist-check-gtkdoc dist-hook-local
	mkdir $(distdir)/html
239
	cp html/* $(distdir)/html
240 241 242
	-cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
	-cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
	cd $(distdir) && rm -f $(DISTCLEANFILES)
243
	-gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
244

245
.PHONY : dist-hook-local docs
246 247 248

# avoid spurious build errors when distchecking with -jN
.NOTPARALLEL: