(example): Encoded in utf-8.
[m17n/m17n-docs.git] / Makefile.am
1 # Makefile.am -- Makefile for the m17n library documentation.
2 # Copyright (C) 2003, 2004, 2005, 2006
3 #   National Institute of Advanced Industrial Science and Technology (AIST)
4 #   Registration Number H15PRO112
5
6 # This file is part of the m17n library documentation, a sub-part of
7 # the m17n library.
8
9 # The m17n library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation; either version 2, or (at
12 # your option) any later version.
13
14 # The m17n library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18
19 # You should have received a copy of the GNU General Public License
20 # along with the m17n library; see the file COPYING.  If not, write to
21 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 # Boston, MA 02111-1307, USA.
23
24 ## Process this file with Automake to create Makefile.in
25
26 SUBDIRS = utils
27
28 pkgdata_DATA = \
29         usr/html/index.html \
30         usr/latex/m17n-lib.dvi usr/latex/m17n-lib.ps \
31         man/man1/m17n-config.1 \
32         man/man3/m17nIntro.3m17n \
33         man/man5/mdbGeneral.5
34
35 pkgdatadir = $(datadir)/m17n/docs
36
37 EXTRA_DIST = usr/html usr/latex/m17n-lib.dvi usr/latex/m17n-lib.ps \
38         man/man1 man/man3 man/man5 \
39         ja/html ja/latex/m17n-lib-ja.dvi ja/latex/m17n-lib-ja.ps
40
41 install-pkgdataDATA: $(pkgdata_DATA)
42         $(mkinstalldirs) $(pkgdatadir)/html
43         $(mkinstalldirs) $(mandir)/man1 $(mandir)/man3 $(mandir)/man5
44         $(INSTALL_DATA) usr/latex/m17n-lib.dvi $(pkgdatadir)/m17n-lib.dvi
45         $(INSTALL_DATA) usr/latex/m17n-lib.ps $(pkgdatadir)/m17n-lib.ps
46         cd usr/html; \
47           for f in *.html *.png; do \
48             $(INSTALL_DATA) $$f $(pkgdatadir)/html/$$f; \
49           done
50         cd man/man1; \
51           for f in *.1; do $(INSTALL_DATA) $$f $(mandir)/man1/$$f; done
52         cd man/man3; \
53           for f in *.3m17n; do $(INSTALL_DATA) $$f $(mandir)/man3/$$f; done
54         cd man/man5; \
55           for f in *.5; do $(INSTALL_DATA) $$f $(mandir)/man5/$$f; done
56
57 #
58 # The followings are for maintainers only.
59 #
60 if MAINTAINER_MODE
61
62 PROJECT_NAME_EN = "The m17n Library"
63 PROJECT_NAME_JA = "m17n ¥é¥¤¥Ö¥é¥ê"
64 PROJECT_VERSION = @PACKAGE_VERSION@
65
66 DOXYGEN = doxygen
67
68 EXAMPLE_PROGS = \
69         @M17NLIB@/example/mconv.c \
70         @M17NLIB@/example/mview.c \
71         @M17NLIB@/example/mdate.c \
72         @M17NLIB@/example/mdump.c \
73         @M17NLIB@/example/medit.c \
74         @M17NLIB@/example/mimx-anthy.c \
75         @M17NLIB@/example/mimx-ispell.c
76
77 DBFORMAT = \
78         @M17NDB@/FORMATS
79
80 MAN1 =  data/m17n-config.txt data/m17n-db.txt ${EXAMPLE_PROGS}
81
82 MAN3 =  @M17NLIB@/src/m17n-core.h \
83         @M17NLIB@/src/m17n.h \
84         @M17NLIB@/src/m17n-gui.h \
85         @M17NLIB@/src/m17n-X.h \
86         @M17NLIB@/src/m17n-misc.h \
87         @M17NLIB@/src
88
89 MAN5 = ${DBFORMAT}
90
91 SRCALL = \
92         mainpage.txt \
93         ${MAN3} \
94         data/m17n-config.txt data/m17n-db.txt data/exprog.txt \
95         data/dbformat.txt data/dbdata.txt data/dbtutorial.txt fdl.txt
96
97 DBDATA = $(shell echo @M17NDB@/*.{dir,fst,tbl} @M17NDB@/MIM/*.mim @M17NDB@/FLT/*.flt @M17NDB@/LANGDATA/LANGUAGE.tbl)
98 DBIMAGE = $(shell echo images/*.png images/*.eps)
99
100 HTML_USR_TARGET = usr/html/index.html usr/html/parrot.png
101 HTML_JA_TARGET = ja/html/index.html ja/html/parrot.png
102 HTML_DEV_TARGET = dev/html/index.html dev/html/parrot.png
103 HTML_TARGET = ${HTML_USR_TARGET} ${HTML_JA_TARGET} ${HTML_DEV_TARGET}
104
105 usr-html html-usr: ${HTML_USR_TARGET}
106 ja-html html-ja: ${HTML_JA_TARGET}
107 dev-html html-dev: ${HTML_DEV_TARGET}
108
109 LATEX_USR_TARGET = usr/latex/m17n-lib.dvi usr/latex/m17n-lib.ps
110 LATEX_JA_TARGET = ja/latex/m17n-lib.dvi ja/latex/m17n-lib.ps
111 LATEX_DEV_TARGET = dev/latex/m17n-lib.dvi dev/latex/m17n-lib.ps
112 LATEX_TARGET = ${LATEX_USR_TARGET} ${LATEX_JA_TARGET} ${LATEX_DEV_TARGET}
113
114 usr-latex latex-usr: ${LATEX_USR_TARGET}
115 ja-latex latex-ja: ${LATEX_JA_TARGET}
116 dev-latex latex-dev: ${LATEX_DEV_TARGET}
117
118 MAN_TARGET = \
119         man/man1/m17n-config.1 \
120         man/man1/m17n-db.1 \
121         man/man3/m17nIntro.3m17n \
122         man/man5/mdbGeneral.5
123
124 usr-man man-usr: ${MAN_TARGET}
125
126 TARGET = ${HTML_TARGET} ${LATEX_TARGET} ${MAN_TARGET}
127
128 usr: usr-html usr-latex usr-man
129 ja: ja-html ja-latex
130 dev: dev-html dev-latex
131
132 html: usr-html ja-html dev-html
133 latex: usr-latex ja-latex dev-latex
134 man: usr-man
135
136 doxyfile-html: doxyfile ${SRCALL}
137         sed -e 's|%PROJECT_NUMBER%|@PACKAGE_VERSION@|' \
138             -e 's|%INPUT%|${SRCALL}|' \
139             -e 's|%GENERATE_HTML%|YES|' \
140             -e 's|%GENERATE_LATEX%|NO|' \
141             -e 's|%GENERATE_MAN%|NO|' \
142             -e 's|%ENABLED_SECTIONS%|FOR-HTML|' \
143           < $< >$@
144
145 doxyfile-html.usr: doxyfile-html
146         sed -e 's|%PROJECT_NAME%|${PROJECT_NAME_EN}|' \
147             -e 's/%USR_JA_DEV%/usr/g' \
148             -e 's/%OUTPUT_LANGUAGE%/English/' \
149           < $< >$@
150
151 doxyfile-html.dev: doxyfile-html
152         sed -e 's|%PROJECT_NAME%|${PROJECT_NAME_EN}|' \
153             -e 's/%USR_JA_DEV%/dev/g' \
154             -e 's/%OUTPUT_LANGUAGE%/English/' \
155           < $< >$@
156
157 doxyfile-html.ja: doxyfile-html
158         sed -e 's|%PROJECT_NAME%|${PROJECT_NAME_JA}|' \
159             -e 's/%USR_JA_DEV%/ja/g' \
160             -e 's/%OUTPUT_LANGUAGE%/Japanese/' \
161           < $< >$@
162
163 doxyfile-latex: doxyfile ${SRCALL}
164         sed -e 's|%PROJECT_NUMBER%|@PACKAGE_VERSION@|' \
165             -e 's|%INPUT%|${SRCALL}|' \
166             -e 's|%GENERATE_HTML%|NO|' \
167             -e 's|%GENERATE_LATEX%|YES|' \
168             -e 's|%GENERATE_MAN%|NO|' \
169             -e 's|%ENABLED_SECTIONS%|FOR-LATEX|' \
170           < $< >$@
171
172 doxyfile-latex.usr: doxyfile-latex
173         sed -e 's|%PROJECT_NAME%|${PROJECT_NAME_EN}|' \
174             -e 's/%USR_JA_DEV%/usr/g' \
175             -e 's/%OUTPUT_LANGUAGE%/English/' \
176           < $< >$@
177
178 doxyfile-latex.dev: doxyfile-latex
179         sed -e 's|%PROJECT_NAME%|${PROJECT_NAME_EN}|' \
180             -e 's/%USR_JA_DEV%/dev/g' \
181             -e 's/%OUTPUT_LANGUAGE%/English/' \
182           < $< >$@
183
184 doxyfile-latex.ja: doxyfile-latex
185         sed -e 's|%PROJECT_NAME%|${PROJECT_NAME_JA}|' \
186             -e 's/%USR_JA_DEV%/ja/g' \
187             -e 's/%OUTPUT_LANGUAGE%/Japanese/' \
188           < $< >$@
189
190 doxyfile-man1: doxyfile ${SRCALL}
191         sed -e 's|%PROJECT_NUMBER%|@PACKAGE_VERSION@|' \
192             -e 's|%INPUT%|${MAN1}|' \
193             -e 's|%GENERATE_HTML%|NO|' \
194             -e 's|%GENERATE_LATEX%|NO|' \
195             -e 's|%GENERATE_MAN%|YES|' \
196             -e 's|%MAN_EXTENSION%|.1|' \
197             -e 's|%ENABLED_SECTIONS%|FOR-MAN|' \
198           < $< >$@
199
200 doxyfile-man3: doxyfile ${SRCALL}
201         sed -e 's|%PROJECT_NUMBER%|@PACKAGE_VERSION@|' \
202             -e 's|%INPUT%|${MAN3}|' \
203             -e 's|%GENERATE_HTML%|NO|' \
204             -e 's|%GENERATE_LATEX%|NO|' \
205             -e 's|%GENERATE_MAN%|YES|' \
206             -e 's|%MAN_EXTENSION%|.3m17n|' \
207             -e 's|%ENABLED_SECTIONS%|FOR-MAN|' \
208           < $< >$@
209
210 doxyfile-man5: doxyfile ${SRCALL}
211         sed -e 's|%PROJECT_NUMBER%|@PACKAGE_VERSION@|' \
212             -e 's|%INPUT%|${MAN5}|' \
213             -e 's|%GENERATE_HTML%|NO|' \
214             -e 's|%GENERATE_LATEX%|NO|' \
215             -e 's|%GENERATE_MAN%|YES|' \
216             -e 's|%MAN_EXTENSION%|.5|' \
217             -e 's|%ENABLED_SECTIONS%|FOR-MAN|' \
218           < $< >$@
219
220 doxyfile-man%.usr: doxyfile-man%
221         sed -e 's|%PROJECT_NAME%|${PROJECT_NAME_EN}|' \
222             -e 's/%USR_JA_DEV%/usr/g' \
223             -e 's/%OUTPUT_LANGUAGE%/English/' \
224           < $< >$@
225
226 data/exprog.txt: ${EXAMPLE_PROGS} utils/exprog.sh
227         utils/exprog.sh ${EXAMPLE_PROGS} > $@
228
229 data/dbdata.txt: ${DBDATA} ${DBIMAGE} @M17NDB@/mdb.dir utils/dbdata.awk utils/dbdata.sh utils/imdoc.c
230         (cd utils; make)
231         @AWK@ -f utils/dbdata.awk @M17NDB@/mdb.dir > $@
232
233 data/dbformat.txt: ${DBFORMAT} utils/dbformat.sh
234         utils/dbformat.sh ${DBFORMAT} > $@
235
236 data/dbtutorial.txt: ${DBFORMAT} utils/dbtutorial.sh
237         utils/dbtutorial.sh ${DBFORMAT} > $@
238
239 data/m17n-config.txt: @M17NLIB@/m17n-config.in
240         sed -n -e '/\/\*\*\*/,/\*\// p' < $< > $@
241
242 data/m17n-db.txt: @M17NDB@/m17n-db.in
243         sed -n -e '/\/\*\*\*/,/\*\// p' < $< > $@
244
245 %/html/index.html: doxyfile-html.% header.%.html footer.%.html ${SRCALL} \
246                         utils/%_filter.rb m17n-lib.css
247         rm -f `dirname $@`/*.html
248         ${DOXYGEN} $<
249         cp images/icon-*.png `dirname $@`
250         cd `dirname $@`; rm -f *_8c* *_8h* *_8txt* dirs.html dir_* files.html
251         echo 'code { font-weight: bold }' >> `dirname $@`/doxygen.css
252
253 %/html/parrot.png: parrot.png
254         cp $< $@
255
256 %/latex/refman.tex: doxyfile-latex.% ${SRCALL} utils/%_filter.rb
257         rm -rf `dirname $@`
258         ${DOXYGEN} $<
259         cd `dirname $@`; rm -f *_8c* *_8h* *_8txt* dirs.tex dir_* files.tex
260
261 %/latex/m17n-lib.dvi: %/latex/refman.tex styles/m17n-lib.sty utils/latex.sh
262         -utils/latex.sh `dirname $@` latex
263
264 %/latex/m17n-lib.ps: %/latex/m17n-lib.dvi utils/dvips.sh
265         utils/dvips.sh `dirname $@` dvips
266 #       emacs -batch -q -l utils/mokuji.el -f write-mokuji $@
267
268 %/latex/m17n-lib.pdf: %/latex/m17n-lib.tex data-%/m17n-lib.sty utils/latex.sh
269         utils/latex.sh `dirname $@` pdflatex
270
271 %/man/man1/m17n-config.1: doxyfile-man1.% ${MAN1} utils/%_filter.rb
272         rm -rf `dirname $@`
273         cp doxyfile-man1.usr temp
274         ${DOXYGEN} $<
275         cd `dirname $@`; rm -f _*.1 *.c.1 *.txt.1
276
277 %/man/man3/m17nIntro.3m17n: doxyfile-man3.% ${MAN3} utils/%_filter.rb
278         rm -rf `dirname $@`
279         ${DOXYGEN} $<
280
281 %/man/man5/mdbGeneral.5: doxyfile-man5.% ${MAN5} utils/%_filter.rb
282         rm -rf `dirname $@`
283         ${DOXYGEN} $<
284
285 sample/man3/SampleGroup.3: sample.c
286         [ -d sample ] || mkdir sample
287         [ -d sample/man3 ] || mkdir sample/man3
288         -${DOXYGEN} -g doxytemp
289         echo "INPUT = sample.c" >> doxytemp
290         echo "GENERATE_LATEX = NO" >> doxytemp
291         echo "GENERATE_HTML = NO" >> doxytemp
292         echo "GENERATE_MAN = YES" >> doxytemp
293         echo "MAN_OUTPUT = sample" >> doxytemp
294         echo "OPTIMIZE_OUTPUT_FOR_C  = yes" >> doxytemp
295         ${DOXYGEN} doxytemp
296         rm -rf doxytemp
297
298 man/man1/%: usr/man/man1/% sample/man3/SampleGroup.3 utils/mkman.rb 
299         $(mkinstalldirs) man/man1
300         rm -rf doxywork man/man1/*
301         ruby utils/mkman.rb 1 usr/man/man1 man/man1
302
303 man/man3/%: usr/man/man3/% sample/man3/SampleGroup.3 utils/mkman.rb 
304         $(mkinstalldirs) man/man3
305         rm -rf doxywork man/man3/*
306         ruby utils/mkman.rb 3m17n usr/man/man3m17n man/man3
307
308 man/man5/%: usr/man/man5/% sample/man3/SampleGroup.3 utils/mkman.rb 
309         $(mkinstalldirs) man/man5
310         rm -rf doxywork man/man5/*
311         ruby utils/mkman.rb 5 usr/man/man5 man/man5
312
313 man/ja/man1/%: ja/man/man1/% sample/man3/SampleGroup.3 utils/mkman.rb 
314         $(mkinstalldirs) man/ja/man1
315         rm -rf doxywork man/ja/man1/*
316         ruby utils/mkman.rb 1 ja/man/man1 man/ja/man1
317
318 man/ja/man3/%: ja/man/man3/% sample/man3/SampleGroup.3 utils/mkman.rb 
319         $(mkinstalldirs) man/ja/man3
320         rm -rf doxywork man/ja/man3/*
321         ruby utils/mkman.rb 3m17n ja/man/man3 man/ja/man3
322
323 man/ja/man5/%: ja/man/man5/% sample/man3/SampleGroup.3 utils/mkman.rb 
324         $(mkinstalldirs) man/ja/man5
325         rm -rf doxywork man/ja/man5/*
326         ruby utils/mkman.rb 5 ja/man/man5 man/ja/man5
327
328 CLEANFILES=doxyfile-* ${TARGET} *.tar.gz warning *~
329
330 clean-local:
331         rm -rf usr dev ja man doxywork
332
333 WEBDIR = /project/web/extra/m17n-lib
334
335 release: dist
336         [ -d ${WEBDIR}/m17n-docs ] || mkdir ${WEBDIR}/m17n-docs
337         [ -d ${WEBDIR}/download ] || mkdir ${WEBDIR}/download
338         cd usr/html; for f in *; do \
339           case $$f in *8c*);; *8h*);; *8txt*);; dirs.html);; dir_*);; files.html);; *) cp $$f ${WEBDIR}/m17n-docs;; esac; \
340         done
341         [ -d ${WEBDIR}-ja2/m17n-docs ] || mkdir ${WEBDIR}-ja2/m17n-docs
342         cd ja/html; for f in *; do \
343           case $$f in *8c*);; *8h*);; *8txt*);; dirs.html);; dir_*);; files.html);; *) cp $$f ${WEBDIR}-ja2/m17n-docs;; esac; \
344         done
345         cp ${distdir}.tar.gz ${WEBDIR}/download
346
347
348 .PRECIOUS: %/latex/refman.tex %/man/man3/m17nIntro.3m ${SRCALL}
349
350 endif
351
352 # Local Variables:
353 # coding: euc-jp
354 # End: