1 # $NetBSD: Makefile.common,v 1.1 2013/08/11 22:09:40 joerg Exp $
3 all: ${LOCALES:S/$/.out/g}
4 realall: ${LOCALES:S/$/.out/g}
6 FILES= ${LOCALES:S/$/.out/g}
7 CLEANFILES+= ${LOCALES:S/$/.out/g}
12 ${TOOL_MKLOCALE} -t ${CATEGORY} -o ${.TARGET} < ${.IMPSRC}
14 .PATH: ${.CURDIR}/converted
16 .for locale in ${LOCALES}
17 ${locale}.out: ${locale}.src
20 .PHONY: update-converted
23 @mkdir -p ${.CURDIR}/converted
24 .for locale in ${LOCALES:O}
25 . for charset in ${locale:C/([^\.]*)\.([^\.]*)/\2/}
26 . for locale_name in ${locale:C/([^\.]*)\.([^\.]*)/\1/}
27 . if ${locale} == "ja_JP.ct"
28 @echo Generating character set ${charset} of ${locale_name}...
29 @rm -f ${.CURDIR}/converted/${locale}.src
30 @iconv -f UTF-8 -t eucJP < ${.CURDIR}/${locale_name}.UTF-8.src \
31 | iconv -f eucJP -t ctext > ${.CURDIR}/converted/${locale}.src.tmp; \
32 sed "s,\(Character set:\) UTF-8,\1 COMPOUND_TEXT," \
33 < ${.CURDIR}/converted/${locale}.src.tmp \
34 > ${.CURDIR}/converted/${locale}.src; \
35 rm ${.CURDIR}/converted/${locale}.src.tmp
36 . elif !exists(${.CURDIR}/${locale}.src)
37 @echo Generating character set ${charset} of ${locale_name}...
38 @rm -f ${.CURDIR}/converted/${locale}.src
39 @set -e; cat < ${.CURDIR}/${locale_name}.UTF-8.src \
40 | (case ${charset} in ISO8859-[125]) sed 's,€,EUR,g';; *) cat ;; esac) \
41 | (case ${charset} in ISO8859-9) sed 's,₺,L,g';; *) cat ;; esac) \
42 | (case ${charset} in ISO8859*) sed 's,−,-,g';; *) cat ;; esac) \
43 | (case ${charset} in ISO8859*) sed 's,–,-,g';; *) cat ;; esac) \
44 | (case ${charset} in ISO8859-1) sed 's,’,´,g';; *) cat ;; esac) \
45 | (case ${charset} in ISO8859-15) sed 's,’,'\'',g';; *) cat ;; esac) \
46 | (case ${charset} in KOI8-U|CP1251|ISO8859-5) sed 's,ʼ,'\'',g';; *) cat ;; esac) \
47 | (case ${charset} in ISO8859-2) sed 's,ț,ţ,g';; *) cat ;; esac) \
48 | (case ${charset} in ISO8859-5|KOI8-U|CP1251) sed 's,₴,грн.,g';; *) cat ;; esac) \
49 | iconv -f UTF-8 -t ${charset} \
50 > ${.CURDIR}/converted/${locale}.src.tmp; \
51 sed "s,\(Character set:\) UTF-8,\1 ${charset}," \
52 < ${.CURDIR}/converted/${locale}.src.tmp \
53 > ${.CURDIR}/converted/${locale}.src; \
54 rm ${.CURDIR}/converted/${locale}.src.tmp
60 .include <bsd.prog.mk>