Makefile revision 291794
1254225Speter# $Id: Makefile,v 9.0 2012/10/19 15:13:11 zy Exp $ 2254225Speter# $FreeBSD: stable/10/usr.bin/vi/catalog/Makefile 291794 2015-12-04 18:21:05Z bdrewery $ 3254225Speter 4254225Speter.include <bsd.own.mk> 5254225Speter 6254225SpeterV= ${.CURDIR}/../../../contrib/nvi 7254225Speter 8254225SpeterCAT= dutch english french german polish ru_RU.KOI8-R spanish swedish \ 9254225Speter uk_UA.KOI8-U zh_CN.GB2312 10254225Speter 11254225SpeterSCAN= ${V}/cl/*.c ${V}/common/*.c ${V}/ex/*.c ${V}/vi/*.c 12254225Speter 13254225Speter.PATH: ${V}/catalog 14254225Speter 15254225Speterall: dump 16254225Speter 17254225Speterbuild-tools: dump 18254225Speter 19254244Speter# Helper since iconv is non trivial to make a build tool 20254244Speterutf8convert: 21254244Speter.for c in dutch french german spanish swedish 22254244Speter iconv -f ISO8859-1 -t UTF-8 $V/catalog/$c.base > $c.UTF-8.base 23254225Speter.endfor 24254244Speter iconv -f ISO8859-2 -t UTF-8 $V/catalog/polish.base > polish.UTF-8.base 25254244Speter iconv -f GB2312 -t UTF-8 $V/catalog/zh_CN.GB2312.base > zh_CN.UTF-8.base 26254244Speter iconv -f KOI8-R -t UTF-8 $V/catalog/ru_RU.KOI8-R.base > ru_RU.UTF-8.base 27254244Speter iconv -f KOI8-U -t UTF-8 $V/catalog/uk_UA.KOI8-U.base > uk_UA.UTF-8.base 28254244Speter 29254244Speter.for c in dutch french german polish spanish swedish zh_CN ru_RU uk_UA 30254244SpeterCAT+= $c.UTF-8 31254244Speter.endfor 32254225Speter 33254225Speter.for c in ${CAT} 34254225Speter${c}: ${c}.base 35254225Speter @echo "... $c"; \ 36254225Speter rm -f $c; \ 37254225Speter sort -u ${.ALLSRC} | \ 38254225Speter awk '{ \ 39254225Speter if ($$1 == 1) { \ 40254225Speter print "\nMESSAGE NUMBER 1 IS NOT LEGAL"; \ 41254225Speter exit 1; \ 42254225Speter } \ 43254225Speter if (++nline > $$1) { \ 44254225Speter print "DUPLICATE MESSAGE NUMBER " $$1; \ 45254225Speter exit 1; \ 46254225Speter } \ 47254225Speter print $0; \ 48254225Speter }' | \ 49254225Speter sed -e '1s/^/$$set 1~$$quote "~/; 1y/~/\n/' | \ 50254225Speter gencat $c /dev/stdin; \ 51254225Speter chmod 444 $c; \ 52254225Speter if grep DUPLICATE $c > /dev/null; then \ 53254225Speter grep DUPLICATE $@; \ 54254225Speter fi; \ 55254225Speter if grep 'NOT LEGAL' $c > /dev/null; then \ 56254225Speter grep 'NOT LEGAL' $@; \ 57254225Speter fi 58254225Speter.endfor 59254225Speter 60254225SpeterCHK= dutch.check english.check french.check german.check \ 61254225Speter polish.check ru_RU.KOI8-R.check spanish.check swedish.check \ 62254225Speter uk_UA.KOI8-U.check zh_CN.GB2312.check 63254225Spetercheck: ${CHK} 64254225Speter.for c in ${CAT} 65254225Speter${c}.check: ${c}.base 66254225Speter @echo "... $c"; \ 67254225Speter f=${.ALLSRC:S;.base$;;}; \ 68254225Speter (echo "Unused message id's (this is okay):"; \ 69254225Speter awk '{ \ 70254225Speter while (++nline < $$1) \ 71254225Speter printf "%03d\n", nline; \ 72254225Speter }' < $$f.base; \ 73254225Speter echo =========================; \ 74254225Speter echo "MISSING ERROR MESSAGES (Please add!):"; \ 75254225Speter awk '{print $$1}' < $$f.base | sort -u > __ck1; \ 76254225Speter awk '{print $$1}' < english.base | sort -u > __ck2; \ 77254225Speter comm -13 __ck1 __ck2; \ 78254225Speter echo =========================; \ 79254225Speter echo "Extra error messages (just delete them):"; \ 80254225Speter comm -23 __ck1 __ck2; \ 81254225Speter echo =========================; \ 82254225Speter echo "MESSAGES WITH THE SAME MESSAGE ID's (FIX!):"; \ 83254225Speter for j in \ 84254225Speter `sed '/^$$/d' < $$f.base | LANG=C sort -u | \ 85254225Speter awk '{print $$1}' | uniq -d`; do \ 86254225Speter egrep $$j $$f.base; \ 87254225Speter done; \ 88254225Speter echo =========================; \ 89254225Speter echo "Duplicate messages, both id and message (this is okay):"; \ 90254225Speter sed '/^$$/d' < $$f.base | LANG=C sort | uniq -c | \ 91254225Speter awk '$$1 != 1 { print $$0 }' | sort -n; \ 92254225Speter echo =========================) > $c 93254225Speter.endfor 94254225Speter 95254225Speterenglish.base: dump ${SCAN} #Makefile 96254225Speter ./dump ${SCAN} |\ 97254225Speter sed -e '/|/!d' \ 98254225Speter -e 's/|/ "/' \ 99254225Speter -e 's/^"//' |\ 100254225Speter sort -nu > $@ 101254225Speter 102254225Speter 103254225Speterdump: dump.c 104254225Speter ${CC} -o dump ${.ALLSRC} 105254225Speter 106254225SpeterCLEANFILES+= dump ${CAT} english.base *.check __ck1 __ck2 107254225Speter 108254225SpeterCATALOGS= ${CAT} 109254225SpeterNLLINKS= nl_NL 110254225SpeterENLINKS= en_AU en_CA en_GB en_NZ en_US 111254225SpeterFRLINKS= fr_BE fr_CA fr_CH fr_FR 112254225SpeterDELINKS= de_AT de_CH de_DE 113254225SpeterESLINKS= es_ES 114254225SpeterSVLINKS= sv_SE 115254225SpeterPLLINKS= pl_PL 116254225Speter 117254225SpeterFILES= ${CATALOGS} 118291794SbdreweryFILESDIR= ${SHAREDIR}/vi/catalog 119254225SpeterSYMLINKS= 120254225Speter.for l in ${NLLINKS} 121254225SpeterSYMLINKS+= dutch ${FILESDIR}/$l.ISO8859-1 122254225SpeterSYMLINKS+= dutch ${FILESDIR}/$l.ISO8859-15 123254244SpeterSYMLINKS+= dutch.UTF-8 ${FILESDIR}/$l.UTF-8 124254225Speter.endfor 125254225Speter.for l in ${ENLINKS} 126254225SpeterSYMLINKS+= english ${FILESDIR}/$l.ISO8859-1 127254225SpeterSYMLINKS+= english ${FILESDIR}/$l.ISO8859-15 128254225SpeterSYMLINKS+= english ${FILESDIR}/$l.US-ASCII 129254244SpeterSYMLINKS+= english ${FILESDIR}/$l.UTF-8 130254225Speter.endfor 131254225SpeterSYMLINKS+= english ${FILESDIR}/POSIX 132254225SpeterSYMLINKS+= english ${FILESDIR}/C 133254225Speter.for l in ${FRLINKS} 134254225SpeterSYMLINKS+= french ${FILESDIR}/$l.ISO8859-1 135254225SpeterSYMLINKS+= french ${FILESDIR}/$l.ISO8859-15 136254244SpeterSYMLINKS+= french.UTF-8 ${FILESDIR}/$l.UTF-8 137254225Speter.endfor 138254225Speter.for l in ${DELINKS} 139254225SpeterSYMLINKS+= german ${FILESDIR}/$l.ISO8859-1 140254225SpeterSYMLINKS+= german ${FILESDIR}/$l.ISO8859-15 141254244SpeterSYMLINKS+= german.UTF-8 ${FILESDIR}/$l.UTF-8 142254225Speter.endfor 143254225Speter.for l in ${ESLINKS} 144254225SpeterSYMLINKS+= spanish ${FILESDIR}/$l.ISO8859-1 145254225SpeterSYMLINKS+= spanish ${FILESDIR}/$l.ISO8859-15 146254244SpeterSYMLINKS+= spanish.UTF-8 ${FILESDIR}/$l.UTF-8 147254225Speter.endfor 148254225Speter.for l in ${SVLINKS} 149254225SpeterSYMLINKS+= swedish ${FILESDIR}/$l.ISO8859-1 150254225SpeterSYMLINKS+= swedish ${FILESDIR}/$l.ISO8859-15 151254244SpeterSYMLINKS+= swedish.UTF-8 ${FILESDIR}/$l.UTF-8 152254225Speter.endfor 153254225Speter.for l in ${PLLINKS} 154254225SpeterSYMLINKS+= polish ${FILESDIR}/$l.ISO8859-2 155254244SpeterSYMLINKS+= polish.UTF-8 ${FILESDIR}/$l.UTF-8 156254225Speter.endfor 157254225SpeterSYMLINKS+= zh_CN.GB2312 ${FILESDIR}/zh_CN.GB18030 158254225SpeterSYMLINKS+= zh_CN.GB2312 ${FILESDIR}/zh_CN.GBK 159254225SpeterSYMLINKS+= zh_CN.GB2312 ${FILESDIR}/zh_CN.eucCN 160254225Speter 161254225Speter.include <bsd.prog.mk> 162