1# $Id: Makefile,v 9.0 2012/10/19 15:13:11 zy Exp $ 2# $FreeBSD: head/usr.bin/vi/catalog/Makefile 254244 2013-08-12 09:56:52Z peter $ 3 4.include <bsd.own.mk> 5 6V= ${.CURDIR}/../../../contrib/nvi2 7 8CAT= dutch english french german polish ru_RU.KOI8-R spanish swedish \ 9 uk_UA.KOI8-U zh_CN.GB2312 10 11SCAN= ${V}/cl/*.c ${V}/common/*.c ${V}/ex/*.c ${V}/vi/*.c 12 13.PATH: ${V}/catalog 14 15buildfiles: 16 17# Helper since iconv is non trivial to make a build tool 18utf8convert: .PHONY 19.for c in dutch french german spanish swedish 20 iconv -f ISO8859-1 -t UTF-8 $V/catalog/$c.base > $c.UTF-8.base 21.endfor 22 iconv -f ISO8859-2 -t UTF-8 $V/catalog/polish.base > polish.UTF-8.base 23 iconv -f GB2312 -t UTF-8 $V/catalog/zh_CN.GB2312.base > zh_CN.UTF-8.base 24 iconv -f KOI8-R -t UTF-8 $V/catalog/ru_RU.KOI8-R.base > ru_RU.UTF-8.base 25 iconv -f KOI8-U -t UTF-8 $V/catalog/uk_UA.KOI8-U.base > uk_UA.UTF-8.base 26 27.for c in dutch french german polish spanish swedish zh_CN ru_RU uk_UA 28CAT+= $c.UTF-8 29.endfor 30 31all: ${CAT} 32 33.for c in ${CAT} 34${c}: ${c}.base 35 @echo "... $c"; \ 36 rm -f $c; \ 37 env LANG=C sort -u ${.ALLSRC} | \ 38 awk '{ \ 39 if ($$1 == 1) { \ 40 print "\nMESSAGE NUMBER 1 IS NOT LEGAL"; \ 41 exit 1; \ 42 } \ 43 if (++nline > $$1) { \ 44 print "DUPLICATE MESSAGE NUMBER " $$1; \ 45 exit 1; \ 46 } \ 47 print $$0; \ 48 }' | \ 49 sed -e '1s/^/$$set 1~$$quote "~/; 1y/~/\n/' | \ 50 gencat $c /dev/stdin; \ 51 chmod 444 $c; \ 52 if grep DUPLICATE $c > /dev/null; then \ 53 grep DUPLICATE $@; \ 54 fi; \ 55 if grep 'NOT LEGAL' $c > /dev/null; then \ 56 grep 'NOT LEGAL' $@; \ 57 fi 58.endfor 59 60CHK= dutch.check english.check french.check german.check \ 61 polish.check ru_RU.KOI8-R.check spanish.check swedish.check \ 62 uk_UA.KOI8-U.check zh_CN.GB2312.check 63check: ${CHK} 64.for c in ${CAT} 65${c}.check: ${c}.base 66 @echo "... $c"; \ 67 f=${.ALLSRC:S;.base$;;}; \ 68 (echo "Unused message id's (this is okay):"; \ 69 awk '{ \ 70 while (++nline < $$1) \ 71 printf "%03d\n", nline; \ 72 }' < $$f.base; \ 73 echo =========================; \ 74 echo "MISSING ERROR MESSAGES (Please add!):"; \ 75 awk '{print $$1}' < $$f.base | sort -u > __ck1; \ 76 awk '{print $$1}' < english.base | sort -u > __ck2; \ 77 comm -13 __ck1 __ck2; \ 78 echo =========================; \ 79 echo "Extra error messages (just delete them):"; \ 80 comm -23 __ck1 __ck2; \ 81 echo =========================; \ 82 echo "MESSAGES WITH THE SAME MESSAGE ID's (FIX!):"; \ 83 for j in \ 84 `sed '/^$$/d' < $$f.base | LANG=C sort -u | \ 85 awk '{print $$1}' | uniq -d`; do \ 86 egrep $$j $$f.base; \ 87 done; \ 88 echo =========================; \ 89 echo "Duplicate messages, both id and message (this is okay):"; \ 90 sed '/^$$/d' < $$f.base | LANG=C sort | uniq -c | \ 91 awk '$$1 != 1 { print $$0 }' | sort -n; \ 92 echo =========================) > $c 93.endfor 94 95english.base: ${SCAN} 96 ${.OBJDIR}/../vidump/vidump.nx ${SCAN} | \ 97 sed -e '/|/!d' -e 's/|/ "/' -e 's/^"//' | sort -nu > $@ 98 99CLEANFILES+= ${CAT} english.base *.check __ck1 __ck2 100 101CATALOGS= ${CAT} 102NLLINKS= nl_NL 103ENLINKS= en_AU en_CA en_GB en_NZ en_US 104FRLINKS= fr_BE fr_CA fr_CH fr_FR 105DELINKS= de_AT de_CH de_DE 106ESLINKS= es_ES 107SVLINKS= sv_SE 108PLLINKS= pl_PL 109 110FILES= ${CATALOGS} 111FILESFROUPS= FILES 112FILESDIR= ${SHAREDIR}/vi/catalog 113SYMLINKS= 114.for l in ${NLLINKS} 115SYMLINKS+= dutch ${FILESDIR}/$l.ISO8859-1 116SYMLINKS+= dutch ${FILESDIR}/$l.ISO8859-15 117SYMLINKS+= dutch.UTF-8 ${FILESDIR}/$l.UTF-8 118.endfor 119.for l in ${ENLINKS} 120SYMLINKS+= english ${FILESDIR}/$l.ISO8859-1 121SYMLINKS+= english ${FILESDIR}/$l.ISO8859-15 122SYMLINKS+= english ${FILESDIR}/$l.US-ASCII 123SYMLINKS+= english ${FILESDIR}/$l.UTF-8 124.endfor 125SYMLINKS+= english ${FILESDIR}/POSIX 126SYMLINKS+= english ${FILESDIR}/C 127.for l in ${FRLINKS} 128SYMLINKS+= french ${FILESDIR}/$l.ISO8859-1 129SYMLINKS+= french ${FILESDIR}/$l.ISO8859-15 130SYMLINKS+= french.UTF-8 ${FILESDIR}/$l.UTF-8 131.endfor 132.for l in ${DELINKS} 133SYMLINKS+= german ${FILESDIR}/$l.ISO8859-1 134SYMLINKS+= german ${FILESDIR}/$l.ISO8859-15 135SYMLINKS+= german.UTF-8 ${FILESDIR}/$l.UTF-8 136.endfor 137.for l in ${ESLINKS} 138SYMLINKS+= spanish ${FILESDIR}/$l.ISO8859-1 139SYMLINKS+= spanish ${FILESDIR}/$l.ISO8859-15 140SYMLINKS+= spanish.UTF-8 ${FILESDIR}/$l.UTF-8 141.endfor 142.for l in ${SVLINKS} 143SYMLINKS+= swedish ${FILESDIR}/$l.ISO8859-1 144SYMLINKS+= swedish ${FILESDIR}/$l.ISO8859-15 145SYMLINKS+= swedish.UTF-8 ${FILESDIR}/$l.UTF-8 146.endfor 147.for l in ${PLLINKS} 148SYMLINKS+= polish ${FILESDIR}/$l.ISO8859-2 149SYMLINKS+= polish.UTF-8 ${FILESDIR}/$l.UTF-8 150.endfor 151SYMLINKS+= zh_CN.GB2312 ${FILESDIR}/zh_CN.GB18030 152SYMLINKS+= zh_CN.GB2312 ${FILESDIR}/zh_CN.GBK 153SYMLINKS+= zh_CN.GB2312 ${FILESDIR}/zh_CN.eucCN 154 155.include <bsd.prog.mk> 156