62 lines
2.3 KiB
Makefile
62 lines
2.3 KiB
Makefile
# $NetBSD: Makefile.common,v 1.2 2020/03/23 13:56:12 kim Exp $
|
||
|
||
all: ${LOCALES:S/$/.out/g}
|
||
realall: ${LOCALES:S/$/.out/g}
|
||
|
||
FILES= ${LOCALES:S/$/.out/g}
|
||
CLEANFILES+= ${LOCALES:S/$/.out/g}
|
||
|
||
.SUFFIXES: .src .out
|
||
.src.out:
|
||
${_MKTARGET_CREATE}
|
||
${TOOL_MKLOCALE} -t ${CATEGORY} -o ${.TARGET} < ${.IMPSRC}
|
||
|
||
.PATH: ${.CURDIR}/converted
|
||
|
||
.for locale in ${LOCALES}
|
||
${locale}.out: ${locale}.src
|
||
.endfor
|
||
|
||
.PHONY: update-converted
|
||
|
||
update-converted:
|
||
@mkdir -p ${.CURDIR}/converted
|
||
.for locale in ${LOCALES:O}
|
||
. for charset in ${locale:C/([^\.]*)\.([^\.]*)/\2/}
|
||
. for locale_name in ${locale:C/([^\.]*)\.([^\.]*)/\1/}
|
||
. if ${locale} == "ja_JP.ct"
|
||
@echo Generating character set ${charset} of ${locale_name}...
|
||
@rm -f ${.CURDIR}/converted/${locale}.src
|
||
@iconv -f UTF-8 -t eucJP < ${.CURDIR}/${locale_name}.UTF-8.src \
|
||
| iconv -f eucJP -t ctext > ${.CURDIR}/converted/${locale}.src.tmp; \
|
||
sed "s,\(Character set:\) UTF-8,\1 COMPOUND_TEXT," \
|
||
< ${.CURDIR}/converted/${locale}.src.tmp \
|
||
> ${.CURDIR}/converted/${locale}.src; \
|
||
rm ${.CURDIR}/converted/${locale}.src.tmp
|
||
. elif !exists(${.CURDIR}/${locale}.src)
|
||
@echo Generating character set ${charset} of ${locale_name}...
|
||
@rm -f ${.CURDIR}/converted/${locale}.src
|
||
@set -e; cat < ${.CURDIR}/${locale_name}.UTF-8.src \
|
||
| (case ${locale} in fi_FI.ISO8859-1) sed 's,€,e,g';; *) cat ;; esac) \
|
||
| (case ${charset} in ISO8859-[125]) sed 's,€,EUR,g';; *) cat ;; esac) \
|
||
| (case ${charset} in ISO8859-9) sed 's,₺,L,g';; *) cat ;; esac) \
|
||
| (case ${charset} in ISO8859*) sed 's,−,-,g';; *) cat ;; esac) \
|
||
| (case ${charset} in ISO8859*) sed 's,–,-,g';; *) cat ;; esac) \
|
||
| (case ${charset} in ISO8859-1) sed 's,’,´,g';; *) cat ;; esac) \
|
||
| (case ${charset} in ISO8859-15) sed 's,’,'\'',g';; *) cat ;; esac) \
|
||
| (case ${charset} in KOI8-U|CP1251|ISO8859-5) sed 's,ʼ,'\'',g';; *) cat ;; esac) \
|
||
| (case ${charset} in ISO8859-2) sed 's,ț,ţ,g';; *) cat ;; esac) \
|
||
| (case ${charset} in ISO8859-5|KOI8-U|CP1251) sed 's,₴,грн.,g';; *) cat ;; esac) \
|
||
| iconv -f UTF-8 -t ${charset} \
|
||
> ${.CURDIR}/converted/${locale}.src.tmp; \
|
||
sed "s,\(Character set:\) UTF-8,\1 ${charset}," \
|
||
< ${.CURDIR}/converted/${locale}.src.tmp \
|
||
> ${.CURDIR}/converted/${locale}.src; \
|
||
rm ${.CURDIR}/converted/${locale}.src.tmp
|
||
. endif
|
||
. endfor
|
||
. endfor
|
||
.endfor
|
||
|
||
.include <bsd.prog.mk>
|