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