# $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 $(