2006-02-27 Gabor Kelemen <kelemeng@gnome.hu>
[beagle.git] / gtk-doc.make
blob91cdd34d2ff92069ab1f0f2272a6e04848acb346
1 # -*- mode: makefile -*-
3 ####################################
4 # Everything below here is generic #
5 ####################################
7 if GTK_DOC_USE_LIBTOOL
8 GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS)
9 GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS)
10 else
11 GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS)
12 GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS)
13 endif
15 # We set GPATH here; this gives us semantics for GNU make
16 # which are more like other make's VPATH, when it comes to
17 # whether a source that is a target of one rule is then
18 # searched for in VPATH/GPATH.
20 GPATH = $(srcdir)
22 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
24 EXTRA_DIST = \
25 $(content_files) \
26 $(HTML_IMAGES) \
27 $(DOC_MAIN_SGML_FILE) \
28 $(DOC_MODULE)-sections.txt \
29 $(DOC_MODULE)-overrides.txt
31 DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \
32 $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp
34 SCANOBJ_FILES = \
35 $(DOC_MODULE).args \
36 $(DOC_MODULE).hierarchy \
37 $(DOC_MODULE).interfaces \
38 $(DOC_MODULE).prerequisites \
39 $(DOC_MODULE).signals
41 CLEANFILES = $(SCANOBJ_FILES) $(DOC_MODULE)-unused.txt $(DOC_STAMPS)
43 if ENABLE_GTK_DOC
44 all-local: html-build.stamp
46 #### scan ####
48 scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
49 @echo '*** Scanning header files ***'
50 @-chmod -R u+w $(srcdir)
51 if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \
52 CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
53 else \
54 cd $(srcdir) ; \
55 for i in $(SCANOBJ_FILES) ; do \
56 test -f $$i || touch $$i ; \
57 done \
59 cd $(srcdir) && \
60 gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
61 touch scan-build.stamp
63 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp
64 @true
66 #### templates ####
68 tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
69 @echo '*** Rebuilding template files ***'
70 @-chmod -R u+w $(srcdir)
71 cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS)
72 touch tmpl-build.stamp
74 tmpl.stamp: tmpl-build.stamp
75 @true
77 #### xml ####
79 sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml $(expand_content_files)
80 @echo '*** Building XML ***'
81 @-chmod -R u+w $(srcdir)
82 cd $(srcdir) && \
83 gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --expand-content-files="$(expand_content_files)" $(MKDB_OPTIONS)
84 touch sgml-build.stamp
86 sgml.stamp: sgml-build.stamp
87 @true
89 #### html ####
91 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
92 @echo '*** Building HTML ***'
93 @-chmod -R u+w $(srcdir)
94 rm -rf $(srcdir)/html
95 mkdir $(srcdir)/html
96 cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
97 test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
98 @echo '-- Fixing Crossreferences'
99 cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
100 touch html-build.stamp
101 else
102 all-local:
103 endif
105 ##############
107 clean-local:
108 rm -f *~ *.bak
109 rm -rf .libs
111 maintainer-clean-local: clean
112 cd $(srcdir) && rm -rf xml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
114 install-data-local:
115 installfiles=`echo $(srcdir)/html/*`; \
116 if test "$$installfiles" = '$(srcdir)/html/*'; \
117 then echo '-- Nothing to install' ; \
118 else \
119 $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \
120 for i in $$installfiles; do \
121 echo '-- Installing '$$i ; \
122 $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
123 done; \
124 echo '-- Installing $(srcdir)/html/index.sgml' ; \
125 $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR) || :; \
128 uninstall-local:
129 rm -f $(DESTDIR)$(TARGET_DIR)/*
132 # Require gtk-doc when making dist
134 if ENABLE_GTK_DOC
135 dist-check-gtkdoc:
136 else
137 dist-check-gtkdoc:
138 @echo "*** gtk-doc must be installed and enabled in order to make dist"
139 @false
140 endif
142 dist-hook: dist-check-gtkdoc dist-hook-local
143 mkdir $(distdir)/tmpl
144 mkdir $(distdir)/xml
145 mkdir $(distdir)/html
146 -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
147 -cp $(srcdir)/xml/*.xml $(distdir)/xml
148 -cp $(srcdir)/html/* $(distdir)/html
149 if test -f $(srcdir)/$(DOC_MODULE).types; then \
150 cp $(srcdir)/$(DOC_MODULE).types $(distdir)/$(DOC_MODULE).types; \
153 .PHONY : dist-hook-local