File: Makefile

package info (click to toggle)
debian-guide-zh 0.6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 11,428 kB
  • ctags: 50
  • sloc: perl: 169; makefile: 160; sh: 33
file content (135 lines) | stat: -rw-r--r-- 3,721 bytes parent folder | download
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
# Makefile for debian-guide-zh for Debian.
#
# GNU GPL v2, Copyright (C) 2000, Anthony Fok <foka@debian.org>
#
# Software packages required for building the Postscript and HTML files:
#     cjk-latex, latex2html, gs, slice, zh-autoconvert,
#     tfm-arphic-bsmi00lp, tfm-arphic-gbsn00lp

SHELL = /bin/sh

title-zh_CN = Debian GNU/Linux װʹõ
DCP-zh_CN   = Debian ļƻ
title-zh_TW = Debian GNU/Linux wˤΨϥξɽ
DCP-zh_TW   = Debian p

locales = zh_CN zh_TW
frames = frame noframe
comma = ,
dvitargets = $(foreach i,$(locales),debian-guide.$(i).dvi)
pstargets = $(foreach i,$(locales),debian-guide.$(i).ps.gz)
htmltargets = $(foreach i,$(locales),$(addprefix html-$(i)-,$(frames)))

# Primary targets

all: dvi ps html

dvi: $(dvitargets)

ps: $(pstargets) dvi

html: $(htmltargets)

# Common rule

debian-guide.zh_CN.tex debian-guide.zh_TW.tex \
debian-guide-zh_CN-html.tex debian-guide-zh_TW-html.tex: \
	debian-guide.zh.tex.in \
	tocn.pl totw.pl totw_zhe.pl tohtml.pl totw_zhe_html.pl

	slice	-o UNDEFuCN:debian-guide.zh_CN.tex.tmp \
		-o UNDEFuTW:debian-guide.zh_TW.tex.tmp \
		debian-guide.zh.tex.in

	# For LaTeX
	autogb < debian-guide.zh_CN.tex.tmp | ./tocn.pl \
		> debian-guide.zh_CN.tex
	./totw.pl < debian-guide.zh_TW.tex.tmp | ./totw_zhe.pl \
		> debian-guide.zh_TW.tex

	# For LaTeX2HTML
	./tohtml.pl < debian-guide.zh_CN.tex.tmp | autogb | ./tocn.pl \
		> debian-guide-zh_CN-html.tex
	./tohtml.pl < debian-guide.zh_TW.tex.tmp | ./totw.pl \
		| ./totw_zhe_html.pl > debian-guide-zh_TW-html.tex

	# Checking to ensure all <s<????>> and <t<????>> are translated...
	@if grep -q '<[st]<' *.tex; then \
		echo "Error!  Unsubstituted <s<????>> or <t<????>> found!" > /dev/stderr; \
		echo "Please double check $< and the Perl scripts." > /dev/stderr; \
		false; \
	fi

	# Good, it passes the test.

# Rules for building gzip'ed Postscript files.

%.zh_CN.dvi: %.zh_CN.tex GPL GPL.zh_CN
	latex $<
	makeindex $(basename $<).idx
	latex $<
	latex $<

GPL.zh_TW.cjk: GPL.zh_TW
	bg5conv < $< | sed -e 's/^\\def\\CJKpreproc{}//;' > $@

%.zh_TW.dvi: %.zh_TW.tex GPL GPL.zh_TW.cjk
	bg5latex $<
	makeindex $(basename $<).idx
	bg5latex $<
	bg5latex $<

%.ps: %.dvi
	dvips -D 600 -X 600 -Y 600 $< -o

%.ps.gz: %.ps
	gzip -9v $<

%-zh_CN-html.aux: %-zh_CN-html.tex
	latex $<
	latex $<
	rm -f $(<F:tex=dvi)

%-zh_TW-html.aux: %-zh_TW-html.tex
	bg5latex $<
	bg5latex $<
	rm -f $(<F:tex=dvi)

chineseb5.perl chinesegb.perl: chinese.perl.in
	slice	-o UNDEFuCN:chinesegb.perl.tmp \
		-o UNDEFuTW:chineseb5.perl \
		$<
	autogb < chinesegb.perl.tmp > chinesegb.perl
	rm -f chinesegb.perl.tmp

# Rules for building HTML pages.

$(htmltargets): locale = $(strip $(foreach i,$(locales),$(findstring $(i),$@)))
$(htmltargets): frame = $(patsubst html-$(locale)-%,%,$@)
$(htmltargets): frameopt = $(if $(filter-out noframe,$(frame)),$(comma)$(frame))
$(htmltargets): title = $(title-$(locale))
$(htmltargets): DCP = $(DCP-$(locale))
$(htmltargets): debian-guide-zh_CN-html.aux debian-guide-zh_TW-html.aux \
		GPL GPL.zh_CN GPL.zh_TW chineseb5.perl chinesegb.perl
	rm -rf $(locale)/html/$(frame)s
	-mkdir -p $(locale)/html/$(frame)s
	latex2html -html_version 4.0,table$(frameopt) -split 4 \
		-iso_language $(subst zh_,ZH.,$(locale)) \
		-t '$(title)' \
		-toc_stars -local_icons -show_section_numbers \
		-address 'John Goerzen / Ossama Othman / $(DCP)' \
		-dir $(locale)/html/$(frame)s \
		debian-guide-$(locale)-html.tex

# Cleaning up...

clean:
	rm -f *~ DEADJOE *.tex.tmp
	rm -f *.dvi *.ps *.ps.gz

distclean: clean
	rm -rf zh_CN zh_TW
	rm -f *.tex *.cjk *.aux *.idx *.ilg *.ind *.lof *.log *.lot *.toc
	rm -f chineseb5.perl chinesegb.perl GPL.zh_TW.cjk

.PHONY: all dvi ps html clean distclean $(htmltargets)