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