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