xref: /titanic_41/usr/src/cmd/localedef/Makefile (revision 21ad40f5447a73ac8a7ed2b9b66dd73ff1b088c1)
1#
2# This file and its contents are supplied under the terms of the
3# Common Development and Distribution License ("CDDL"), version 1.0.
4# You may only use this file in accordance with the terms of version
5# 1.0 of the CDDL.
6#
7# A full copy of the text of the CDDL should have accompanied this
8# source.  A copy of the CDDL is also available via the Internet at
9# http://www.illumos.org/license/CDDL.
10#
11
12#
13# Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
14# Copyright 2011 EveryCity Ltd. All rights reserved.
15#
16
17PROG=localedef
18
19include ../Makefile.cmd
20
21OBJS = 	charmap.o collate.o ctype.o messages.o monetary.o numeric.o time.o \
22	scanner.o localedef.o wide.o parser.tab.o
23
24HDRS	= localedef.h
25
26SRCS	= $(OBJS:%.o=%.c)
27
28CPPFLAGS	+= -I $(SRC)/lib/libc/port/locale
29LDLIBS		+= -lgen
30LDLIBS 		+= -lavl
31YFLAGS		= -d -b parser
32CLEANFILES	= $(OBJS) parser.tab.c parser.tab.h
33CLEANFILES	+= \
34		UTF-8.cm UTF-8.ct \
35		8859-1.cm 8859-2.cm 8859-3.cm 8859-4.cm \
36		8859-5.cm 8859-5.cm 8859-6.cm 8859-7.cm \
37		8859-8.cm 8859-9.cm 8859-9.cm 8859-10.cm \
38		8859-11.cm 8859-13.cm 8859-14.cm 8859-15.cm \
39		8859-16.cm \
40		KOI8-R.cm
41CLOBBERFILES	= $(PROG) $(POFILE) $(DATA:%=locale/%)
42PIFILES		= $(OBJS:%.o=%.i)
43POFILE		= localedef_cmd.po
44
45ISO8859_1_LOCALES	= \
46		da_DK \
47		de_CH \
48		en_AU en_CA en_GB en_NZ en_US \
49		es_AR es_BO es_CL es_CO es_EC es_GT es_MX es_NI es_PA \
50		es_PE es_SV es_UY es_VE \
51		fr_CA fr_CH \
52		is_IS \
53		it_CH \
54		sv_SE
55
56ISO8859_2_LOCALES	= \
57		cs_CZ \
58		hr_HR \
59		hu_HU \
60		pl_PL \
61		sq_AL
62
63ISO8859_5_LOCALES	= \
64		bg_BG \
65		mk_MK \
66		ru_RU
67
68ISO8859_6_LOCALES	=
69
70ISO8859_7_LOCALES	= \
71		el_GR
72
73ISO8859_9_LOCALES	= \
74		tr_TR
75
76ISO8859_11_LOCALES	= \
77		th_TH
78
79ISO8859_13_LOCALES	= \
80		lt_LT \
81		lv_LV
82
83ISO8859_15_LOCALES	= \
84		ca_ES \
85		da_DK \
86		de_AT de_DE \
87		en_GB en_IE en_US \
88		es_ES \
89		fi_FI \
90		fr_BE fr_FR \
91		it_IT \
92		nl_BE nl_NL \
93		pt_PT \
94		sv_FI sv_SE
95
96KOI8_R_LOCALES		= \
97		ru_RU
98
99GB18030_LOCALES		= \
100		zh_CN
101
102#
103# All new locales should be in UTF-8 form.
104#
105UTF_8_LOCALES		= \
106		af_ZA \
107		ar_AE ar_BH ar_DZ ar_EG ar_IQ ar_JO ar_KW ar_LB ar_LY ar_MA \
108		ar_OM ar_QA ar_SA ar_TN ar_YE \
109		as_IN \
110		az_AZ \
111		be_BY \
112		bg_BG \
113		bn_BD bn_IN \
114		bo_CN bo_IN \
115		bs_BA \
116		ca_ES \
117		cs_CZ \
118		da_DK \
119		de_AT de_BE de_CH de_DE de_LI de_LU \
120		el_CY el_GR \
121		en_AU en_BW en_BZ en_CA en_GB en_HK en_IE en_IN en_JM en_MH \
122		en_MT en_NA en_NZ en_PH en_PK en_SG en_TT en_US en_ZA en_ZW \
123		es_AR es_BO es_CL es_CO es_CR es_DO es_EC es_ES es_GQ es_GT \
124		es_HN es_MX es_NI es_PA es_PE es_PR es_PY es_SV es_US es_UY \
125		es_VE \
126		et_EE \
127		fi_FI \
128		fil_PH \
129		fr_BE fr_CA fr_CF fr_CH fr_FR fr_GN fr_LU fr_MC fr_MG fr_ML \
130		fr_NE fr_SN \
131		ga_IE \
132		gu_IN \
133		he_IL \
134		hi_IN \
135		hr_HR \
136		hu_HU \
137		hy_AM \
138		id_ID \
139		ii_CN \
140		is_IS \
141		it_CH it_IT \
142		ja_JP \
143		ka_GE \
144		kk_KZ \
145		km_KH \
146		kn_IN \
147		ko_KR \
148		kok_IN \
149		lt_LT \
150		lv_LV \
151		mk_MK \
152		ml_IN \
153		mn_CN mn_MN \
154		mr_IN \
155		ms_MY \
156		mt_MT \
157		ne_IN ne_NP \
158		nl_BE nl_NL \
159		nb_NO \
160		nn_NO \
161		or_IN \
162		pa_IN pa_PK \
163		pl_PL \
164		pt_BR pt_GW pt_MZ pt_PT \
165		ro_MD ro_RO \
166		ru_MD ru_RU ru_UA \
167		sa_IN \
168		si_LK \
169		sk_SK \
170		sl_SI \
171		sq_AL \
172		sr_BA sr_ME sr_RS \
173		sv_FI sv_SE \
174		ta_IN ta_LK \
175		te_IN \
176		th_TH \
177		tr_TR \
178		uk_UA \
179		ug_CN \
180		ur_IN ur_PK \
181		vi_VN \
182		zh_CN zh_HK zh_MO zh_SG zh_TW
183
184UTF8SRCS	= $(UTF_8_LOCALES:%=data/%.UTF-8.src)
185
186LOCNAMES	= \
187		$(ISO8859_1_LOCALES:%=%.ISO8859-1) \
188		$(ISO8859_2_LOCALES:%=%.ISO8859-2) \
189		$(ISO8859_5_LOCALES:%=%.ISO8859-5) \
190		$(ISO8859_6_LOCALES:%=%.ISO8859-6) \
191		$(ISO8859_7_LOCALES:%=%.ISO8859-7) \
192		$(ISO8859_9_LOCALES:%=%.ISO8859-9) \
193		$(ISO8859_11_LOCALES:%=%.ISO8859-11) \
194		$(ISO8859_13_LOCALES:%=%.ISO8859-13) \
195		$(ISO8859_15_LOCALES:%=%.ISO8859-15) \
196		$(KOI8_R_LOCALES:%=%.KOI8-R) \
197		$(GB18030_LOCALES:%=%.GB18030) \
198		$(UTF_8_LOCALES:%=%.UTF-8)
199
200LOCDIRS		= $(LOCNAMES:%=locale/%)
201
202STAMPFILES	= $(LOCDIRS:%=%/stamp)
203
204CATDIRS		= \
205		$(LOCDIRS:%=%/LC_COLLATE) \
206		$(LOCDIRS:%=%/LC_CTYPE) \
207		$(LOCDIRS:%=%/LC_MESSAGES) \
208		$(LOCDIRS:%=%/LC_MONETARY) \
209		$(LOCDIRS:%=%/LC_NUMERIC) \
210		$(LOCDIRS:%=%/LC_TIME)
211
212DATA		= $(CATDIRS:%=%/LCL_DATA)
213
214DCOLL		= LC_COLLATE/LCL_DATA
215DCTYPE		= LC_CTYPE/LCL_DATA
216DMSGS		= LC_MESSAGES/LCL_DATA
217DMON		= LC_MONETARY/LCL_DATA
218DNUM		= LC_NUMERIC/LCL_DATA
219DTIME		= LC_TIME/LCL_DATA
220
221ROOTLOCDIRS	= $(LOCDIRS:%=$(ROOTLIB)/%)
222ROOTCATDIRS	= $(CATDIRS:%=$(ROOTLIB)/%)
223ROOTDATA	= $(DATA:%=$(ROOTLIB)/%)
224
225$(ROOTDATA)	:= FILEMODE=0444
226
227all: $(PROG) $(DATA)
228
229install: all $(ROOTPROG) $(ROOTDATA)
230
231$(PROG): $(OBJS)
232	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
233	$(POST_PROCESS)
234
235$(OBJS):	parser.tab.h
236
237parser.tab.c parser.tab.h: parser.y $(HDRS)
238	$(YACC) $(YFLAGS) parser.y
239
240lint:	$(SRCS)
241	$(LINT.c) $(CPPFLAGS) $(SRCS)
242
243clean:
244	$(RM) $(CLEANFILES)
245	$(RM) $(STAMPFILES)
246
247$(POFILE):	$(PIFILES)
248	$(RM) $@
249	$(RM) messages.po
250	$(XGETTEXT) -s $(PIFILES)
251	$(SED) -e '/domain/d' messages.po > $@
252	$(RM) $(PIFILES) messages.po
253
254locale $(ROOTLOCDIRS) $(ROOTCATDIRS):
255	$(INS.dir)
256
257include ../Makefile.targ
258
259# Strip LC_CTYPE contents for UTF-8 locales and replace them
260# with UTF-8.ct we compiled
261locale/%.UTF-8/stamp:		data/%.UTF-8.src UTF-8.cm \
262				UTF-8.ct locale $(PROG)
263	$(SED) '/^LC_CTYPE/,/^END LC_CTYPE/d;$$r UTF-8.ct' $< | \
264		./$(PROG) -U -f UTF-8.cm $(@D)
265	$(TOUCH) $@
266locale/%.ISO8859-1/stamp:	data/%.UTF-8.src 8859-1.cm locale $(PROG)
267	./$(PROG) -U -i $< -f 8859-1.cm $(@D)
268	$(TOUCH) $@
269locale/%.ISO8859-2/stamp:	data/%.UTF-8.src 8859-2.cm locale $(PROG)
270	./$(PROG) -U -i $< -f 8859-2.cm $(@D)
271	$(TOUCH) $@
272locale/%.ISO8859-5/stamp:	data/%.UTF-8.src 8859-5.cm locale $(PROG)
273	./$(PROG) -U -i $< -f 8859-5.cm $(@D)
274	$(TOUCH) $@
275locale/%.ISO8859-7/stamp:	data/%.UTF-8.src 8859-7.cm locale $(PROG)
276	./$(PROG) -U -i $< -f 8859-7.cm $(@D)
277	$(TOUCH) $@
278locale/%.ISO8859-6/stamp:	data/%.UTF-8.src 8859-6.cm locale $(PROG)
279	./$(PROG) -U -i $< -f 8859-6.cm $(@D)
280	$(TOUCH) $@
281locale/%.ISO8859-9/stamp:	data/%.UTF-8.src 8859-9.cm locale $(PROG)
282	./$(PROG) -U -i $< -f 8859-9.cm $(@D)
283	$(TOUCH) $@
284locale/%.ISO8859-11/stamp:	data/%.UTF-8.src 8859-11.cm locale $(PROG)
285	./$(PROG) -U -i $< -f 8859-11.cm $(@D)
286	$(TOUCH) $@
287locale/%.ISO8859-13/stamp:	data/%.UTF-8.src 8859-13.cm locale $(PROG)
288	./$(PROG) -U -i $< -f 8859-13.cm $(@D)
289	$(TOUCH) $@
290locale/%.ISO8859-15/stamp:	data/%.UTF-8.src 8859-15.cm locale $(PROG)
291	./$(PROG) -U -i $< -f 8859-15.cm $(@D)
292	$(TOUCH) $@
293locale/%.KOI8-R/stamp:		data/%.UTF-8.src KOI8-R.cm locale $(PROG)
294	./$(PROG) -U -i $< -f KOI8-R.cm $(@D)
295	$(TOUCH) $@
296locale/%.GB18030/stamp:		data/%.UTF-8.src GB18030.cm locale $(PROG)
297	./$(PROG) -U -i $< -f GB18030.cm $(@D)
298	$(TOUCH) $@
299
300locale/%/$(DCOLL):	locale/%/stamp
301locale/%/$(DCTYPE):	locale/%/stamp
302locale/%/$(DMSGS):	locale/%/stamp
303locale/%/$(DMON):	locale/%/stamp
304locale/%/$(DNUM):	locale/%/stamp
305locale/%/$(DTIME):	locale/%/stamp
306
307UTF-8.cm: data/UTF-8.cm
308	$(LN) -sf data/UTF-8.cm  $@
309
310UTF-8.ct: $(UTF8SRCS)
311	$(SH) data/ctype.sh $(UTF8SRCS) > $@
312
313GB18030.cm: data/GB18030.cm
314	$(LN) -sf data/GB18030.cm  $@
315
316%.cm: data/%.TXT UTF-8.cm
317	$(RM) $@
318	$(PERL) data/convert_map.pl $< > $@
319
320$(ROOTDATA):	$(ROOTLOCDIRS) $(ROOTCATDIRS) $(DATA)
321	$(RM) $@
322	$(CP) $(@:$(ROOTLIB)/%=%) $@
323	$(CHMOD) 0444 $@
324