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