summaryrefslogtreecommitdiff
path: root/usr/src/cmd/localedef/Makefile
blob: 85889634e0b5b803666aa18cbd24c947f9ec4832 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
# Copyright 2011 EveryCity Ltd. All rights reserved.
# Copyright 2012 Joyent, Inc.  All rights reserved.
#

PROG=localedef

include ../Makefile.cmd

OBJS = 	charmap.o collate.o ctype.o messages.o monetary.o numeric.o time.o \
	scanner.o localedef.o wide.o parser.tab.o

HDRS	= localedef.h

SRCS	= $(OBJS:%.o=%.c)

CPPFLAGS	+= -I $(SRC)/lib/libc/port/locale
LDLIBS		+= -lgen
LDLIBS 		+= -lavl
YFLAGS		= -d -b parser
CLEANFILES	= $(OBJS) parser.tab.c parser.tab.h
CLEANFILES	+= \
		UTF-8.cm UTF-8.ct \
		8859-1.cm 8859-2.cm 8859-3.cm 8859-4.cm \
		8859-5.cm 8859-5.cm 8859-6.cm 8859-7.cm \
		8859-8.cm 8859-9.cm 8859-9.cm 8859-10.cm \
		8859-11.cm 8859-13.cm 8859-14.cm 8859-15.cm \
		8859-16.cm \
		KOI8-R.cm
CLOBBERFILES	= $(PROG) $(POFILE) $(DATA:%=%)
PIFILES		= $(OBJS:%.o=%.i)
POFILE		= localedef_cmd.po

ISO8859_1_LOCALES	= \
		da_DK \
		de_CH de_DE \
		en_AU en_CA en_GB en_NZ en_US \
		es_AR es_BO es_CL es_CO es_EC es_ES es_GT es_MX es_NI es_PA \
		es_PE es_SV es_UY es_VE \
		fr_CA fr_CH fr_FR \
		is_IS \
		it_CH it_IT \
		sv_SE

ISO8859_2_LOCALES	= \
		cs_CZ \
		hr_HR \
		hu_HU \
		pl_PL \
		sq_AL

ISO8859_5_LOCALES	= \
		bg_BG \
		mk_MK \
		ru_RU

ISO8859_6_LOCALES	= 

ISO8859_7_LOCALES	= \
		el_GR

ISO8859_9_LOCALES	= \
		tr_TR

ISO8859_11_LOCALES	= \
		th_TH

ISO8859_13_LOCALES	= \
		lt_LT \
		lv_LV

ISO8859_15_LOCALES	= \
		ca_ES \
		da_DK \
		de_AT de_DE \
		en_GB en_IE en_US \
		es_ES \
		fi_FI \
		fr_BE fr_FR \
		it_IT \
		nl_BE nl_NL \
		pt_PT \
		sv_FI sv_SE

KOI8_R_LOCALES		= \
		ru_RU

GB18030_LOCALES		= \
		zh_CN

#
# All new locales should be in UTF-8 form.
#
UTF_8_LOCALES		= \
		af_ZA \
		ar_AE ar_BH ar_DZ ar_EG ar_IQ ar_JO ar_KW ar_LB ar_LY ar_MA \
		ar_OM ar_QA ar_SA ar_TN ar_YE \
		as_IN \
		az_AZ \
		be_BY \
		bg_BG \
		bn_BD bn_IN \
		bo_CN bo_IN \
		bs_BA \
		ca_ES \
		cs_CZ \
		da_DK \
		de_AT de_BE de_CH de_DE de_LI de_LU \
		el_CY el_GR \
		en_AU en_BW en_BZ en_CA en_GB en_HK en_IE en_IN en_JM en_MH \
		en_MT en_NA en_NZ en_PH en_PK en_SG en_TT en_US en_ZA en_ZW \
		es_AR es_BO es_CL es_CO es_CR es_DO es_EC es_ES es_GQ es_GT \
		es_HN es_MX es_NI es_PA es_PE es_PR es_PY es_SV es_US es_UY \
		es_VE \
		et_EE \
		fi_FI \
		fil_PH \
		fr_BE fr_CA fr_CF fr_CH fr_FR fr_GN fr_LU fr_MC fr_MG fr_ML \
		fr_NE fr_SN \
		ga_IE \
		gu_IN \
		he_IL \
		hi_IN \
		hr_HR \
		hu_HU \
		hy_AM \
		id_ID \
		ii_CN \
		is_IS \
		it_CH it_IT \
		ja_JP \
		ka_GE \
		kk_KZ \
		km_KH \
		kn_IN \
		ko_KR \
		kok_IN \
		lt_LT \
		lv_LV \
		mk_MK \
		ml_IN \
		mn_CN mn_MN \
		mr_IN \
		ms_MY \
		mt_MT \
		ne_IN ne_NP \
		nl_BE nl_NL \
		nb_NO \
		nn_NO \
		or_IN \
		pa_IN pa_PK \
		pl_PL \
		pt_BR pt_GW pt_MZ pt_PT \
		ro_MD ro_RO \
		ru_MD ru_RU ru_UA \
		sa_IN \
		si_LK \
		sk_SK \
		sl_SI \
		sq_AL \
		sr_BA sr_ME sr_RS \
		sv_FI sv_SE \
		ta_IN ta_LK \
		te_IN \
		th_TH \
		tr_TR \
		uk_UA \
		ug_CN \
		ur_IN ur_PK \
		vi_VN \
		zh_CN zh_HK zh_MO zh_SG zh_TW

UTF8SRCS	= $(UTF_8_LOCALES:%=data/%.UTF-8.src)

LOCNAMES	= \
		$(ISO8859_1_LOCALES:%=%.ISO8859-1) \
		$(ISO8859_2_LOCALES:%=%.ISO8859-2) \
		$(ISO8859_5_LOCALES:%=%.ISO8859-5) \
		$(ISO8859_6_LOCALES:%=%.ISO8859-6) \
		$(ISO8859_7_LOCALES:%=%.ISO8859-7) \
		$(ISO8859_9_LOCALES:%=%.ISO8859-9) \
		$(ISO8859_11_LOCALES:%=%.ISO8859-11) \
		$(ISO8859_13_LOCALES:%=%.ISO8859-13) \
		$(ISO8859_15_LOCALES:%=%.ISO8859-15) \
		$(KOI8_R_LOCALES:%=%.KOI8-R) \
		$(GB18030_LOCALES:%=%.GB18030) \
		$(UTF_8_LOCALES:%=%.UTF-8)

LOCDIRS		= $(LOCNAMES:%=locale/%)

STAMPFILES	= $(LOCDIRS:%=%/stamp)

CATDIRS		= \
		$(LOCDIRS:%=%/LC_COLLATE) \
		$(LOCDIRS:%=%/LC_CTYPE) \
		$(LOCDIRS:%=%/LC_MESSAGES) \
		$(LOCDIRS:%=%/LC_MONETARY) \
		$(LOCDIRS:%=%/LC_NUMERIC) \
		$(LOCDIRS:%=%/LC_TIME)

DATA		= $(CATDIRS:%=%/LCL_DATA)

DCOLL		= LC_COLLATE/LCL_DATA
DCTYPE		= LC_CTYPE/LCL_DATA
DMSGS		= LC_MESSAGES/LCL_DATA
DMON		= LC_MONETARY/LCL_DATA
DNUM		= LC_NUMERIC/LCL_DATA
DTIME		= LC_TIME/LCL_DATA

ROOTLOCDIRS	= $(LOCDIRS:%=$(ROOTLIB)/%)
ROOTCATDIRS	= $(CATDIRS:%=$(ROOTLIB)/%)
ROOTDATA	= $(DATA:%=$(ROOTLIB)/%)

$(ROOTDATA)	:= FILEMODE=0444

all: $(PROG) $(DATA)

install: all $(ROOTPROG) $(ROOTDATA)

$(PROG): $(OBJS)
	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
	$(POST_PROCESS)

$(OBJS):	parser.tab.h

parser.tab.c parser.tab.h: parser.y $(HDRS)
	$(YACC) $(YFLAGS) parser.y

lint:	$(SRCS)
	$(LINT.c) $(CPPFLAGS) $(SRCS)

clean:	
	$(RM) $(CLEANFILES)
	$(RM) $(STAMPFILES)

$(POFILE):	$(PIFILES)
	$(RM) $@
	$(RM) messages.po
	$(XGETTEXT) -s $(PIFILES)
	$(SED) -e '/domain/d' messages.po > $@
	$(RM) $(PIFILES) messages.po

locale $(ROOTLOCDIRS) $(ROOTCATDIRS):
	$(INS.dir)

include ../Makefile.targ

# Strip LC_CTYPE contents for UTF-8 locales and replace them
# with UTF-8.ct we compiled
locale/%.UTF-8/stamp:		data/%.UTF-8.src UTF-8.cm \
				UTF-8.ct locale $(PROG)
	$(SED) '/^LC_CTYPE/,/^END LC_CTYPE/d;$$r UTF-8.ct' $< | \
		./$(PROG) -U -f UTF-8.cm $(@D)
	$(TOUCH) $@
# Convert EURO_SIGN to CURRENCY_SIGN for the ISO8859-1 locales
locale/%.ISO8859-1/stamp:	data/%.UTF-8.src 8859-1.cm locale $(PROG)
	sed 's/EURO_SIGN/CURRENCY_SIGN/' $< > $<.tmp
	./$(PROG) -U -i $<.tmp -f 8859-1.cm $(@D)
	rm -f $<.tmp
	$(TOUCH) $@
locale/%.ISO8859-2/stamp:	data/%.UTF-8.src 8859-2.cm locale $(PROG)
	./$(PROG) -U -i $< -f 8859-2.cm $(@D)
	$(TOUCH) $@
locale/%.ISO8859-5/stamp:	data/%.UTF-8.src 8859-5.cm locale $(PROG)
	./$(PROG) -U -i $< -f 8859-5.cm $(@D)
	$(TOUCH) $@
locale/%.ISO8859-7/stamp:	data/%.UTF-8.src 8859-7.cm locale $(PROG)
	./$(PROG) -U -i $< -f 8859-7.cm $(@D)
	$(TOUCH) $@
locale/%.ISO8859-6/stamp:	data/%.UTF-8.src 8859-6.cm locale $(PROG)
	./$(PROG) -U -i $< -f 8859-6.cm $(@D)
	$(TOUCH) $@
locale/%.ISO8859-9/stamp:	data/%.UTF-8.src 8859-9.cm locale $(PROG)
	./$(PROG) -U -i $< -f 8859-9.cm $(@D)
	$(TOUCH) $@
locale/%.ISO8859-11/stamp:	data/%.UTF-8.src 8859-11.cm locale $(PROG)
	./$(PROG) -U -i $< -f 8859-11.cm $(@D)
	$(TOUCH) $@
locale/%.ISO8859-13/stamp:	data/%.UTF-8.src 8859-13.cm locale $(PROG)
	./$(PROG) -U -i $< -f 8859-13.cm $(@D)
	$(TOUCH) $@
locale/%.ISO8859-15/stamp:	data/%.UTF-8.src 8859-15.cm locale $(PROG)
	./$(PROG) -U -i $< -f 8859-15.cm $(@D)
	$(TOUCH) $@
locale/%.KOI8-R/stamp:		data/%.UTF-8.src KOI8-R.cm locale $(PROG)
	./$(PROG) -U -i $< -f KOI8-R.cm $(@D)
	$(TOUCH) $@
locale/%.GB18030/stamp:		data/%.UTF-8.src GB18030.cm locale $(PROG)
	./$(PROG) -U -i $< -f GB18030.cm $(@D)
	$(TOUCH) $@

locale/%/$(DCOLL):	locale/%/stamp
locale/%/$(DCTYPE):	locale/%/stamp
locale/%/$(DMSGS):	locale/%/stamp
locale/%/$(DMON):	locale/%/stamp
locale/%/$(DNUM):	locale/%/stamp
locale/%/$(DTIME):	locale/%/stamp

UTF-8.cm: data/UTF-8.cm
	$(LN) -sf data/UTF-8.cm  $@

UTF-8.ct: $(UTF8SRCS)
	$(SH) data/ctype.sh $(UTF8SRCS) > $@

GB18030.cm: data/GB18030.cm
	$(LN) -sf data/GB18030.cm  $@

%.cm: data/%.TXT UTF-8.cm
	$(RM) $@
	$(PERL) data/convert_map.pl $< > $@

$(ROOTDATA):	$(ROOTLOCDIRS) $(ROOTCATDIRS) $(DATA)
	$(RM) $@
	$(CP) $(@:$(ROOTLIB)/%=%) $@
	$(CHMOD) 0444 $@