blob: 0647f6677b163f7764eaa0d72654de202f2b586c (
plain) (
blame)
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
|
# $Id$ -*- mode: makefile-gmake -*-
# The two-letter code for the language
LANGUAGE := zh
SUBLANG := cn hk tw
include $(WMLBASE)/../Makefile.common
# If you need to modify that is already defined in ../Makefile.common
# you can put it below
export LANG=C
# Experimental tag by the Debian Chinese Translation Team
SHELL = /bin/bash
BIN = $(WMLBASE)/bin
ICONV = /usr/bin/iconv
TOCN = $(BIN)/tocn.pl
TOTW = $(BIN)/totw.pl
TOHK = $(BIN)/tohk.pl
FORMAT_ZH = $(BIN)/format_zh.pl
GENERATE_ZH_VARIANTS = $(BIN)/generate-zh-variants.sh
STRIP_INITIAL_BLANK_LINE = $(BIN)/strip_initial_blank_line.sh
ZHTEMPLATE = $(WMLBASE)/template/debian-zh/template.tmpl
COMMON_SCRIPTS = $(TOCN) $(TOTW) $(TOHK) $(FORMAT_ZH) $(GENERATE_ZH_VARIANTS)
# ZHMAGIC is obsolete! Don't use it any more.
# Old magic that coped with the co-existence of international/chinese -> zh
ZHMAGIC = @if `echo $(HTMLDIR) | grep -q '^$(WMLBASE)/$(RELHTMLBASE)/international/chinese'`; then \
test -L $(WMLBASE)/$(RELHTMLBASE)/zh && rm -f $(WMLBASE)/$(RELHTMLBASE)/zh ; \
ZHDIR=`echo $(HTMLDIR) | sed -e 's%^\($(WMLBASE)/$(RELHTMLBASE)/\)international/chinese%\1zh%'` ; \
ZHRELDIR=`echo $(WMLBASE) | sed -e 's%^\.\./%%'`/$(CUR_DIR) ; \
test -d $$ZHDIR || mkdir -p $$ZHDIR ; \
shopt -s nullglob ; \
for i in *.{css,gif,jpg,png}; do \
ln -sf $$ZHRELDIR/$$i $$ZHDIR/ ; \
done ; \
sed -e 's%="\.\./\.\./%="\.\.\1/%g' \
-e 's%="\(index\...\.html"\)%="'$$ZHRELDIR'/\1%;' $(@F) \
> $$ZHDIR/$(@F) ; \
echo " and to $$ZHDIR" ; \
if [ ! -f "$(WMLBASE)/../english/$(CUR_DIR)/$(*F).wml" ]; then \
echo "Making a link $$ZHDIR/$(*F).html -> $(@F)"; \
ln -f -s $(@F) $$ZHDIR/$(*F).html; \
fi ; \
fi
# Add "-O1" to wml to be passed to htmlstrip, to avoid malformed UTF-8
# see bug #959474
# This option needs to be kept in Chinese until wml 2.12.2~ds1-3 or higher
# arrives to Debian stable
WMLOPTIONSZH = -O1
WMLOUTPUT = -o UNDEFuZH@uCNuCNHKuCNTW:$(*F).zh-cn.html.tmp@g+w \
-o UNDEFuZH@uHKuCNHKuHKTWuTWHK:$(*F).zh-hk.html.tmp@g+w \
-o UNDEFuZH@uTWuCNTWuHKTWuTWHK:$(*F).zh-tw.html.tmp@g+w
WMLPROLOG = --prolog=$(FORMAT_ZH)
# Remove initial blank line due "[ZH::]" in $(TEMPLDIR)/common_tags.wml,
# an unfortunate but necessary workaround of a bug in slice < 1.3.9
WMLEPILOG = --epilog=$(STRIP_INITIAL_BLANK_LINE)
WML = wml $(WMLOPTIONS) $(WMLOPTIONSZH) $(WMLOUTPUT) $(WMLPROLOG) $(WMLEPILOG)
install::
@rm -f $(HTMLDIR)/*.imgdot-1x1-transp.gif
clean::
rm -f *.$(LANGUAGE)-??.html
rm -f *.$(LANGUAGE)-??.html.tmp
cleandest::
rm -f $(HTMLDIR)/*.$(LANGUAGE)-??.html
$(TOHK): $(TOTW)
ln -sf totw.pl $@
# Is there anyway to combine the following two rules into one?
$(HTMLDIR)/%.zh-cn.html: %.zh-cn.html
@test -d $(HTMLDIR) || mkdir -m g+w -p $(HTMLDIR)
@echo copying $(@F) to $(HTMLDIR)
$(IGNORE)@install -m 664 -p $(@F) $(HTMLDIR)
$(HTMLDIR)/%.zh-hk.html: %.zh-hk.html
@test -d $(HTMLDIR) || mkdir -m g+w -p $(HTMLDIR)
@echo copying $(@F) to $(HTMLDIR)
$(IGNORE)@install -m 664 -p $(@F) $(HTMLDIR)
$(HTMLDIR)/%.zh-tw.html: %.zh-tw.html
@test -d $(HTMLDIR) || mkdir -m g+w -p $(HTMLDIR)
@echo copying $(@F) to $(HTMLDIR)
$(IGNORE)@install -m 664 -p $(@F) $(HTMLDIR)
# Create %.html -> %.zh-tw.html symlink if no English version of %.wml exists
@if [ ! -f "$(WMLBASE)/../english/$(CUR_DIR)/$(*F).wml" ]; then \
echo "Making a link $(@D)/$(*F).html -> $(@F)"; \
ln -f -s $(@F) $(@D)/$(*F).html; \
fi
ifndef NOGENERICDEP
# The "| $(VCSREVCACHE)" here is an order-only prerequisite - always
# check that the prerequisite exists and is up to date, but don't
# rebuild everything whenever it's updated - see
# https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html
%.zh-cn.html %.zh-hk.html %.zh-tw.html: %.wml \
$(TEMPLDIR)/template.wml $(TEMPLDIR)/languages.wml \
$(COMMON_SCRIPTS) $(ZHTEMPLATE) $(GETTEXTDEP) $(TEMPLDIR)/translation-check.wml | $(VCSREVCACHE)
@echo -n "Processing $(<F): "
@$(WML) $(<F)
@$(GENERATE_ZH_VARIANTS) $* html
else
%.zh-cn.html %.zh-hk.html %.zh-tw.html: %.wml \
$(COMMON_SCRIPTS) $(ZHTEMPLATE) $(GETTEXTDEP) | $(VCSREVCACHE)
@echo -n "Processing $(<F): "
@cd $(@D) && $(WML) $(notdir $(<))
@$(GENERATE_ZH_VARIANTS) $* html
endif
# template dependencies
$(ZHTEMPLATE): $(TEMPLDIR)/template.wml \
$(WMLBASE)/template/debian-zh/macros.tmpl \
$(WMLBASE)/template/debian-zh/navbar.tmpl
touch $@
|