summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/cjk/Makefile
blob: 3ff57b867d9b2098347d56ef080a8f13147e2cc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# Copyright (C) 1994-2008  Werner Lemberg <wl@gnu.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program in doc/COPYING; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301 USA

# You need GNU make to run this Makefile.
#
# Some issues:
#
# o This Makefile is intended to build the distribution tarballs only,
#   not to compile binaries.
#
# o Binaries of the CJK utility programs (and the standard tex stuff,
#   including dvipdfmx) must work.
#
# o GNU extensions of various utility programs are used.
#
# o emacs 22 and the `cweave' program from the `c2cweb' package,
#   renamed to `cweavex', are needed.
#
# o The TeXLive version of some font definition files are used (in the
#   `texlive' subdirectory).

version=4.8.2

distdir=cjk-$(version)
abs-distdir=$(shell pwd)/$(distdir)

DISTDIRS=$(shell find . -type d | grep -v .git | grep -v $(distdir))

# expected: subdirs `dvi' and `cjk'
CJK2DVI=\
  (cd dvi; \
   TEXINPUTS=$(abs-distdir)/{texlive,texinput//,contrib/wadalab,utils/pyhyphen}: \
     texi2dvi -l latex ../cjk/$@.cjk; \
   rm -f $@.aux $@.log $@.toc)

# LATEX2DVI srcdir targetdir
# expected: targetdir/dvi
LATEX2DVI=\
  cp $(1)/$@.tex $(2)/dvi; \
  (cd $(2)/dvi; \
   TEXINPUTS=$(abs-distdir)/{texlive,texinput//,contrib/wadalab,utils/pyhyphen}: \
     texi2dvi -l latex $@.tex; \
   rm -f $@.tex $@.aux $@.log $@.toc)

# DVI2PDF paper-format
# expected: subdir `pdf' and `dvi'
DVI2PDF=\
  dvipdfmx -v -p $(1) -o pdf/$@.pdf dvi/$@.dvi
  

# CONVERT converter srcdir targetdir [paper-format]
CONVERT=\
  cd $(distdir); \
  $(1) < $(2)/$@.tex > $(3)/cjk/$@.cjk; \
  cd $(3); \
  $(CJK2DVI); \
  $(if $(4),$(call DVI2PDF,$(4)),$(call DVI2PDF,letter))

# MULE srcdir targetdir [paper-format]
MULE=\
  cd $(distdir); \
  emacs --batch \
        --load utils/lisp/emacs/cjk-enc.el \
        --funcall batch-cjk-write-file \
        $(1)/$@.tex; \
  mv $(1)/$@.cjk $(2)/cjk; \
  cd $(2); \
  $(CJK2DVI); \
  $(if $(3),$(call DVI2PDF,$(3)),$(call DVI2PDF,letter))

# LATEX srcdir targetdir [paper-format]
LATEX=\
  cd $(distdir); \
  $(call LATEX2DVI,$(1),$(2)); \
  cd $(2); \
  $(if $(3),$(call DVI2PDF,$(3)),$(call DVI2PDF,letter))

# XELATEX srcdir targetdir
XELATEX=\
  cd $(distdir); \
  cp $(1)/$@.tex $(2)/pdf; \
  (cd $(2)/pdf; \
   TEXINPUTS=$(abs-distdir)/{texlive,texinput//,contrib/wadalab,utils/pyhyphen}: \
     xelatex $@.tex; \
   TEXINPUTS=$(abs-distdir)/{texlive,texinput//,contrib/wadalab,utils/pyhyphen}: \
     xelatex $@.tex; \
   rm -f $@.tex $@.aux $@.log $@.toc $@.out $@.ovt)


DISTTARGETS=\
  READMEb5 \
  READMEgb \
  Big5 \
  Big5vert \
  CEF_test \
  CJKbabel \
  CJKfntef \
  CJKutf8 \
  CJKspace \
  CJKmixed \
  xCJK \
  GB \
  JIS \
  KS \
  SJIS \
  UTF8 \
  muletest \
  pytest \
  py_test \
  rubytest \
  thai \
  c90


all:
	@echo
	@echo "    Say \`make dist' to build the tarballs."
	@echo


READMEb5:
	$(call CONVERT,bg5conv,doc/chinese,doc,a4)
READMEgb:
	$(call LATEX,doc/chinese,doc)
Big5 Big5vert:
	$(call CONVERT,bg5conv,examples,examples)
CEF_test:
	$(call CONVERT,cefconv,examples,examples)
SJIS:
	$(call CONVERT,sjisconv,examples,examples)
CJKbabel muletest rubytest thai:
	$(call MULE,examples,examples)
GB JIS KS UTF8 py_test CJKfntef CJKutf8 CJKspace CJKmixed:
	$(call LATEX,examples,examples)
xCJK:
	$(call XELATEX,examples,examples)
pytest:
	$(call LATEX,utils/pyhyphen,examples)
c90:
	(cd $(abs-distdir)/utils/thaifont/tools; \
	 ln -s c90.etx c90.tex)
	$(call LATEX,utils/thaifont/tools,doc)


dist: distsrc predistdoc distdoc

distsrc:
	-rm -rf $(distdir)
	rm -f $(distdir).tar.gz
	rm -f $(distdir)-doc.tar.gz
	mkdir $(distdir)
	srcdir=`pwd`; \
	for d in $(DISTDIRS); do \
	  mkdir -p $(distdir)/$$d; \
	  (cd $(distdir)/$$d; \
	   f=`find $$srcdir/$$d -maxdepth 1 -type f`; \
	   test -z "$$f" || ln -s $$f . || true); \
	done
	for f in `find $(abs-distdir)/utils -name '*.w'`; do \
	  ctangle $$f - `echo $$f | sed s/w$$/c/`; \
	done
	tar cfh - $(distdir) | gzip -c > $(distdir).tar.gz

predistdoc:
	mkdir -p $(distdir)/doc/{cjk,dvi,pdf}
	mkdir -p $(distdir)/examples/{cjk,dvi,pdf}
	mkdir -p $(distdir)/doc/man/{dvi,html,pdf,txt}
	echo "This directory contains files which are \`preprocessed' with" \
	  > $(distdir)/doc/cjk/README
	echo "cjk-enc.el, bg5conv, etc." \
	  >> $(distdir)/doc/cjk/README
	echo \
	  >> $(distdir)/doc/cjk/README
	echo "You can feed them directly into LaTeX." \
	  >> $(distdir)/doc/cjk/README

distdoc: $(DISTTARGETS) manpages cweb
	for f in `find $(distdir) -type l`; do \
	  rm $$f; \
	done
	for f in `find $(distdir) -name '*.c'`; do \
	  rm $$f; \
	done
	-for d in `find $(distdir) -depth -type d`; do \
	  rmdir --ignore-fail-on-non-empty $$d; \
	done
	tar cfh - $(distdir) | gzip -c > $(distdir)-doc.tar.gz
	rm -rf $(distdir)

manpages:
	for f in `find utils -type f -name '*.1'`; do \
	  groff -ww -Tdvi -dpaper=letter -P-pletter -mec -man -rS11 $$f > \
	    $(abs-distdir)/doc/man/dvi/`basename $$f .1`.dvi; \
	  groff -ww -Tps -dpaper=letter -P-pletter -man -rS11 $$f | \
	    ps2pdf - $(abs-distdir)/doc/man/pdf/`basename $$f .1`.pdf; \
	  groff -ww -Tlatin1 -man -P-bcu $$f > \
	    $(abs-distdir)/doc/man/txt/`basename $$f .1`.txt; \
	  groff -ww -Thtml -man $$f > \
	    $(abs-distdir)/doc/man/html/`basename $$f .1`.html; \
	done

cweb:
	for f in `find utils -type f -name '*.w'`; do \
	  cp $$f $(abs-distdir)/doc/dvi; \
	  (cd $(abs-distdir)/doc/dvi; \
	   F=`basename $$f .w`; \
	   cweavex +a $$F.w; \
	   tex $$F; \
	   rm -rf $$F.idx $$F.log $$F.scn $$F.tex $$F.toc $$F.w; \
	   dvipdfmx -v -p letter -o ../pdf/$$F.pdf $$F); \
	done

# EOF