xref: /titanic_52/usr/src/cmd/localedef/Makefile (revision 6a1af1a67532df169a657cce07140be64bdea084)
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 \
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		ar_EG
70
71ISO8859_7_LOCALES	= \
72		el_GR
73
74ISO8859_9_LOCALES	= \
75		tr_TR
76
77ISO8859_11_LOCALES	= \
78		th_TH
79
80ISO8859_13_LOCALES	= \
81		lt_LT \
82		lv_LV
83
84ISO8859_15_LOCALES	= \
85		ca_ES \
86		da_DK \
87		de_AT de_DE \
88		en_GB en_IE en_US \
89		es_ES \
90		fi_FI \
91		fr_BE fr_FR \
92		it_IT \
93		nl_BE nl_NL \
94		pt_PT \
95		sv_FI sv_SE
96
97KOI8_R_LOCALES		= \
98		ru_RU
99
100#
101# All new locales should be in UTF-8 form.
102#
103UTF_8_LOCALES		= \
104		af_ZA \
105		ar_AE ar_BH ar_DZ ar_EG ar_IQ ar_JO ar_KW ar_LB ar_LY ar_MA \
106		ar_OM ar_QA ar_SA ar_TN ar_YE \
107		as_IN \
108		az_AZ \
109		be_BY \
110		bg_BG \
111		bn_BD bn_IN \
112		bo_CN bo_IN \
113		bs_BA \
114		ca_ES \
115		cs_CZ \
116		da_DK \
117		de_AT de_BE de_CH de_DE de_LI de_LU \
118		el_CY el_GR \
119		en_AU en_BW en_BZ en_CA en_GB en_HK en_IE en_IN en_JM en_MH \
120		en_MT en_NA en_NZ en_PH en_PK en_SG en_TT en_US en_ZA en_ZW \
121		es_AR es_BO es_CL es_CO es_CR es_DO es_EC es_ES es_GQ es_GT \
122		es_HN es_MX es_NI es_PA es_PE es_PR es_PY es_SV es_US es_UY \
123		es_VE \
124		et_EE \
125		fi_FI \
126		fil_PH \
127		fr_BE fr_CA fr_CF fr_CH fr_FR fr_GN fr_LU fr_MC fr_MG fr_ML \
128		fr_NE fr_SN \
129		ga_IE \
130		gu_IN \
131		he_IL \
132		hi_IN \
133		hr_HR \
134		hu_HU \
135		hy_AM \
136		id_ID \
137		ii_CN \
138		is_IS \
139		it_CH it_IT \
140		ja_JP \
141		ka_GE \
142		kk_KZ \
143		km_KH \
144		kn_IN \
145		ko_KR \
146		kok_IN \
147		lt_LT \
148		lv_LV \
149		mk_MK \
150		ml_IN \
151		mn_CN mn_MN \
152		mr_IN \
153		ms_MY \
154		mt_MT \
155		ne_IN ne_NP \
156		nl_BE nl_NL \
157		nb_NO \
158		nn_NO \
159		or_IN \
160		pa_IN pa_PK \
161		pl_PL \
162		pt_BR pt_GW pt_MZ pt_PT \
163		ro_MD ro_RO \
164		ru_MD ru_RU ru_UA \
165		sa_IN \
166		si_LK \
167		sk_SK \
168		sl_SI \
169		sq_AL \
170		sr_BA sr_ME sr_RS \
171		sv_FI sv_SE \
172		ta_IN ta_LK \
173		te_IN \
174		th_TH \
175		tr_TR \
176		uk_UA \
177		ug_CN \
178		ur_IN ur_PK \
179		vi_VN \
180		zh_CN zh_HK zh_MO zh_SG zh_TW
181
182LOCNAMES	= \
183		$(ISO8859_1_LOCALES:%=%.ISO8859-1) \
184		$(ISO8859_2_LOCALES:%=%.ISO8859-2) \
185		$(ISO8859_5_LOCALES:%=%.ISO8859-5) \
186		$(ISO8859_6_LOCALES:%=%.ISO8859-6) \
187		$(ISO8859_7_LOCALES:%=%.ISO8859-7) \
188		$(ISO8859_9_LOCALES:%=%.ISO8859-9) \
189		$(ISO8859_11_LOCALES:%=%.ISO8859-11) \
190		$(ISO8859_13_LOCALES:%=%.ISO8859-13) \
191		$(ISO8859_15_LOCALES:%=%.ISO8859-15) \
192		$(KOI8_R_LOCALES:%=%.KOI8-R) \
193		$(UTF_8_LOCALES:%=%.UTF-8)
194
195LOCDIRS		= $(LOCNAMES:%=locale/%)
196
197STAMPFILES	= $(LOCDIRS:%=%/stamp)
198
199CATDIRS		= \
200		$(LOCDIRS:%=%/LC_COLLATE) \
201		$(LOCDIRS:%=%/LC_CTYPE) \
202		$(LOCDIRS:%=%/LC_MESSAGES) \
203		$(LOCDIRS:%=%/LC_MONETARY) \
204		$(LOCDIRS:%=%/LC_NUMERIC) \
205		$(LOCDIRS:%=%/LC_TIME)
206
207DATA		= $(CATDIRS:%=%/LCL_DATA)
208
209DCOLL		= LC_COLLATE/LCL_DATA
210DCTYPE		= LC_CTYPE/LCL_DATA
211DMSGS		= LC_MESSAGES/LCL_DATA
212DMON		= LC_MONETARY/LCL_DATA
213DNUM		= LC_NUMERIC/LCL_DATA
214DTIME		= LC_TIME/LCL_DATA
215
216ROOTLOCDIRS	= $(LOCDIRS:%=$(ROOTLIB)/%)
217ROOTCATDIRS	= $(CATDIRS:%=$(ROOTLIB)/%)
218ROOTDATA	= $(DATA:%=$(ROOTLIB)/%)
219
220$(ROOTDATA)	:= FILEMODE=0444
221
222all: $(PROG) $(DATA)
223
224install: all $(ROOTPROG) $(ROOTDATA)
225
226$(PROG): $(OBJS)
227	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
228	$(POST_PROCESS)
229
230$(OBJS):	parser.tab.h
231
232parser.tab.c parser.tab.h: parser.y $(HDRS)
233	$(YACC) $(YFLAGS) parser.y
234
235lint:	$(SRCS)
236	$(LINT.c) $(CPPFLAGS) $(SRCS)
237
238clean:
239	$(RM) $(CLEANFILES)
240	$(RM) $(STAMPFILES)
241
242$(POFILE):	$(PIFILES)
243	$(RM) $@
244	$(RM) messages.po
245	$(XGETTEXT) -s $(PIFILES)
246	$(SED) -e '/domain/d' messages.po > $@
247	$(RM) $(PIFILES) messages.po
248
249locale $(ROOTLOCDIRS) $(ROOTCATDIRS):
250	$(INS.dir)
251
252include ../Makefile.targ
253
254locale/%.UTF-8/stamp:		data/%.UTF-8.src UTF-8.cm locale $(PROG)
255	./$(PROG) -U -i $< -f UTF-8.cm $(@D)
256	$(TOUCH) $@
257locale/%.ISO8859-1/stamp:	data/%.UTF-8.src 8859-1.cm locale $(PROG)
258	./$(PROG) -U -i $< -f 8859-1.cm $(@D)
259	$(TOUCH) $@
260locale/%.ISO8859-2/stamp:	data/%.UTF-8.src 8859-2.cm locale $(PROG)
261	./$(PROG) -U -i $< -f 8859-2.cm $(@D)
262	$(TOUCH) $@
263locale/%.ISO8859-5/stamp:	data/%.UTF-8.src 8859-5.cm locale $(PROG)
264	./$(PROG) -U -i $< -f 8859-5.cm $(@D)
265	$(TOUCH) $@
266locale/%.ISO8859-7/stamp:	data/%.UTF-8.src 8859-7.cm locale $(PROG)
267	./$(PROG) -U -i $< -f 8859-7.cm $(@D)
268	$(TOUCH) $@
269locale/%.ISO8859-6/stamp:	data/%.UTF-8.src 8859-6.cm locale $(PROG)
270	./$(PROG) -U -i $< -f 8859-6.cm $(@D)
271	$(TOUCH) $@
272locale/%.ISO8859-9/stamp:	data/%.UTF-8.src 8859-9.cm locale $(PROG)
273	./$(PROG) -U -i $< -f 8859-9.cm $(@D)
274	$(TOUCH) $@
275locale/%.ISO8859-11/stamp:	data/%.UTF-8.src 8859-11.cm locale $(PROG)
276	./$(PROG) -U -i $< -f 8859-11.cm $(@D)
277	$(TOUCH) $@
278locale/%.ISO8859-13/stamp:	data/%.UTF-8.src 8859-13.cm locale $(PROG)
279	./$(PROG) -U -i $< -f 8859-13.cm $(@D)
280	$(TOUCH) $@
281locale/%.ISO8859-15/stamp:	data/%.UTF-8.src 8859-15.cm locale $(PROG)
282	./$(PROG) -U -i $< -f 8859-15.cm $(@D)
283	$(TOUCH) $@
284locale/%.KOI8-R/stamp:		data/%.UTF-8.src KOI8-R.cm locale $(PROG)
285	./$(PROG) -U -i $< -f KOI8-R.cm $(@D)
286	$(TOUCH) $@
287
288locale/%/$(DCOLL):	locale/%/stamp
289locale/%/$(DCTYPE):	locale/%/stamp
290locale/%/$(DMSGS):	locale/%/stamp
291locale/%/$(DMON):	locale/%/stamp
292locale/%/$(DNUM):	locale/%/stamp
293locale/%/$(DTIME):	locale/%/stamp
294
295UTF-8.cm: data/UTF-8.cm
296	$(LN) -sf data/UTF-8.cm  $@
297
298%.cm: data/%.TXT UTF-8.cm
299	$(RM) $@
300	$(PERL) data/convert_map.pl $< > $@
301
302$(ROOTDATA):	$(ROOTLOCDIRS) $(ROOTCATDIRS) $(DATA)
303	$(RM) $@
304	$(CP) $(@:$(ROOTLIB)/%=%) $@
305	$(CHMOD) 0444 $@
306