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