b0ec50a76aa0c48fb0beef725bbae9cc8bcbf939
[platform/upstream/glib.git] / docs / reference / glib / Makefile.am
1 ## Process this file with automake to produce Makefile.in
2
3 # The name of the module.
4 DOC_MODULE=glib
5
6 # The top-level SGML file.
7 DOC_MAIN_SGML_FILE=glib-docs.sgml
8
9 # The directory containing the source code. Relative to $(srcdir)
10 DOC_SOURCE_DIR=../../..
11
12 # Extra options to supply to gtkdoc-scan
13 SCAN_OPTIONS=
14
15 # Extra options to supply to gtkdoc-mkdb
16 MKDB_OPTIONS=
17
18 # Extra options to supply to gtkdoc-fixref
19 FIXXREF_OPTIONS=
20
21 # Used for dependencies
22 HFILE_GLOB=$(top_srcdir)/*.h $(top_srcdir)/gmodule/*.h
23 CFILE_GLOB=$(top_srcdir)/*.c $(top_srcdir)/gmodule/*.c
24
25 # Headers to ignore
26 IGNORE_HFILES=                  \
27         gobject                 \
28         config.h                \
29         gmoduleconf.h           \
30         gunibreak.h             \
31         gunidecomp.h            \
32         gunichartables.h        \
33         glibconfig-sysdefs.h
34
35 # Extra files to add when scanning
36 EXTRA_HFILES=
37
38 # Images to copy into HTML directory
39 HTML_IMAGES =                           \
40         mainloop-states.gif
41
42 # Extra SGML files that are included by $(DOC_MAIN_SGML_FILE)
43 content_files =
44
45 # Other files to distribute
46 extra_files =                           \
47         mainloop-states.fig             \
48         mainloop-states.png             \
49         mainloop-states.eps
50
51 # CFLAGS and LDFLAGS for compiling scan program. Only needed
52 # if $(DOC_MODULE).types is non-empty.
53 GTKDOC_CFLAGS =
54 GTKDOC_LIBS =
55
56 # Commands for compiling and linking 
57 GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC)
58 GTKDOC_LD=$(LIBTOOL) --mode=link $(CC)
59
60
61 ####################################
62 # Everything below here is generic #
63 ####################################
64
65 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
66
67 EXTRA_DIST =                            \
68         $(content_files)                \
69         $(extra_files)                  \
70         $(HTML_IMAGES)                  \
71         $(DOC_MAIN_SGML_FILE)           \
72         $(DOC_MODULE).types             \
73         $(DOC_MODULE)-sections.txt      \
74         $(DOC_MODULE)-overrides.txt
75
76 DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp
77
78 if ENABLE_GTK_DOC
79 all-local: html-build.stamp
80
81 SCANOBJ_FILES =                 \
82         $(DOC_MODULE).args      \
83         $(DOC_MODULE).hierarchy \
84         $(DOC_MODULE).signal
85
86 scan-build.stamp: $(HFILE_GLOB)
87         @echo '*** Scanning header files ***'
88         cd $(srcdir) && ( \
89         if grep -l '^.+$$' $(DOC_MODULE).types > /dev/null ; then \
90             CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj --module=$(DOC_MODULE) ; \
91         else \
92             for i in $(SCANOBJ_FILES) ; do \
93                test -f $$i || touch $$i ; \
94             done \
95         fi )
96         cd $(srcdir) && \
97           gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
98         touch scan-build.stamp
99
100 check_scan:
101         $(MAKE) scan-build.stamp
102
103 $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): check_scan
104
105 tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
106         @echo '*** Rebuilding template files ***'
107         cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE)
108         touch tmpl-build.stamp
109
110 check_templates: 
111         $(MAKE) tmpl-build.stamp
112
113 tmpl.stamp: check_templates
114
115 sgml-build.stamp: tmpl.stamp $(CFILE_GLOB)
116         @echo '*** Building SGML ***'
117         cd $(srcdir) && \
118         gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) $(MKDB_OPTIONS)
119         touch sgml-build.stamp
120
121 check_sgml:
122         $(MAKE) sgml-build.stamp
123
124 sgml.stamp: check_sgml
125
126 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE)
127         @echo '*** Building HTML ***'
128         test -d $(srcdir)/html || mkdir $(srcdir)/html
129         cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
130         test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
131         @echo '-- Fixing Crossreferences' 
132         cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
133         touch html-build.stamp
134 endif
135
136 clean-local:
137         rm -f *~ *.bak $(SCANOBJ_FILES) *-unused.txt $(DOC_STAMPS) $(srcdir)/sgml.stamp 
138
139 maintainer-clean-local: clean
140         cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
141
142 install-data-local:
143         $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)
144         (installfiles=`echo $(srcdir)/html/*.html`; \
145         if test "$$installfiles" = '$(srcdir)/html/*.html'; \
146         then echo '-- Nothing to install' ; \
147         else \
148           for i in $$installfiles; do \
149             echo '-- Installing '$$i ; \
150             $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
151           done; \
152           echo '-- Installing $(srcdir)/html/index.sgml' ; \
153           $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); \
154         fi)
155
156 #
157 # Require gtk-doc when making dist
158 #
159 if ENABLE_GTK_DOC
160 dist-check-gtkdoc:
161 else
162 dist-check-gtkdoc:
163         @echo "*** gtk-doc must be installed and enabled in order to make dist"
164         @false
165 endif
166
167 dist-hook: dist-check-gtkdoc dist-hook-local
168         mkdir $(distdir)/tmpl
169         mkdir $(distdir)/sgml
170         mkdir $(distdir)/html
171         -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
172         -cp $(srcdir)/sgml/*.sgml $(distdir)/sgml
173         -cp $(srcdir)/sgml/*.bottom $(srcdir)/sgml/*.top $(distdir)/sgml
174         -cp $(srcdir)/html/index.sgml $(distdir)/html
175         -cp $(srcdir)/html/*.html $(srcdir)/html/*.css $(distdir)/html
176         for i in $(HTML_IMAGES) ; do          \
177           cp $(srcdir)/$$i $(distdir)/html ;  \
178         done
179
180 .PHONY : check_sgml check_templates check_scan dist-hook-local