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