xref: /titanic_51/usr/src/cmd/localedef/Makefile (revision 1fb95e48b0ed76e2ce9a37cb14d82c1ad8e941f6)
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 2010 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		kn_IN \
144		ko_KR \
145		kok_IN \
146		lt_LT \
147		lv_LV \
148		mk_MK \
149		ml_IN \
150		mn_CN mn_MN \
151		mr_IN \
152		ms_MY \
153		mt_MT \
154		ne_IN ne_NP \
155		nl_BE nl_NL \
156		nb_NO \
157		nn_NO \
158		or_IN \
159		pa_IN pa_PK \
160		pl_PL \
161		pt_BR pt_GW pt_MZ pt_PT \
162		ro_MD ro_RO \
163		ru_MD ru_RU ru_UA \
164		sa_IN \
165		si_LK \
166		sk_SK \
167		sl_SI \
168		sq_AL \
169		sv_FI sv_SE \
170		ta_IN ta_LK \
171		te_IN \
172		th_TH \
173		tr_TR \
174		uk_UA \
175		ug_CN \
176		ur_IN ur_PK \
177		vi_VN \
178		zh_CN zh_HK zh_MO zh_SG zh_TW
179
180LOCNAMES	= \
181		$(ISO8859_1_LOCALES:%=%.ISO8859-1) \
182		$(ISO8859_2_LOCALES:%=%.ISO8859-2) \
183		$(ISO8859_5_LOCALES:%=%.ISO8859-5) \
184		$(ISO8859_6_LOCALES:%=%.ISO8859-6) \
185		$(ISO8859_7_LOCALES:%=%.ISO8859-7) \
186		$(ISO8859_9_LOCALES:%=%.ISO8859-9) \
187		$(ISO8859_11_LOCALES:%=%.ISO8859-11) \
188		$(ISO8859_13_LOCALES:%=%.ISO8859-13) \
189		$(ISO8859_15_LOCALES:%=%.ISO8859-15) \
190		$(KOI8_R_LOCALES:%=%.KOI8-R) \
191		$(UTF_8_LOCALES:%=%.UTF-8)
192
193LOCDIRS		= $(LOCNAMES:%=locale/%)
194
195STAMPFILES	= $(LOCDIRS:%=%/stamp)
196
197CATDIRS		= \
198		$(LOCDIRS:%=%/LC_COLLATE) \
199		$(LOCDIRS:%=%/LC_CTYPE) \
200		$(LOCDIRS:%=%/LC_MESSAGES) \
201		$(LOCDIRS:%=%/LC_MONETARY) \
202		$(LOCDIRS:%=%/LC_NUMERIC) \
203		$(LOCDIRS:%=%/LC_TIME)
204
205DATA		= $(CATDIRS:%=%/LCL_DATA)
206
207DCOLL		= LC_COLLATE/LCL_DATA
208DCTYPE		= LC_CTYPE/LCL_DATA
209DMSGS		= LC_MESSAGES/LCL_DATA
210DMON		= LC_MONETARY/LCL_DATA
211DNUM		= LC_NUMERIC/LCL_DATA
212DTIME		= LC_TIME/LCL_DATA
213
214ROOTLOCDIRS	= $(LOCDIRS:%=$(ROOTLIB)/%)
215ROOTCATDIRS	= $(CATDIRS:%=$(ROOTLIB)/%)
216ROOTDATA	= $(DATA:%=$(ROOTLIB)/%)
217
218$(ROOTDATA)	:= FILEMODE=0444
219
220all: $(PROG) $(DATA)
221
222install: all $(ROOTPROG) $(ROOTDATA)
223
224$(PROG): $(OBJS)
225	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
226	$(POST_PROCESS)
227
228$(OBJS):	parser.tab.h
229
230parser.tab.c parser.tab.h: parser.y $(HDRS)
231	$(YACC) $(YFLAGS) parser.y
232
233lint:	$(SRCS)
234	$(LINT.c) $(CPPFLAGS) $(SRCS)
235
236clean:
237	$(RM) $(CLEANFILES)
238	$(RM) $(STAMPFILES)
239
240$(POFILE):	$(PIFILES)
241	$(RM) $@
242	$(RM) messages.po
243	$(XGETTEXT) -s $(PIFILES)
244	$(SED) -e '/domain/d' messages.po > $@
245	$(RM) $(PIFILES) messages.po
246
247locale $(ROOTLOCDIRS) $(ROOTCATDIRS):
248	$(INS.dir)
249
250include ../Makefile.targ
251
252locale/%.UTF-8/stamp:		data/%.UTF-8.src UTF-8.cm locale $(PROG)
253	./$(PROG) -U -i $< -f UTF-8.cm $(@D)
254	$(TOUCH) $@
255locale/%.ISO8859-1/stamp:	data/%.UTF-8.src 8859-1.cm locale $(PROG)
256	./$(PROG) -U -i $< -f 8859-1.cm $(@D)
257	$(TOUCH) $@
258locale/%.ISO8859-2/stamp:	data/%.UTF-8.src 8859-2.cm locale $(PROG)
259	./$(PROG) -U -i $< -f 8859-2.cm $(@D)
260	$(TOUCH) $@
261locale/%.ISO8859-5/stamp:	data/%.UTF-8.src 8859-5.cm locale $(PROG)
262	./$(PROG) -U -i $< -f 8859-5.cm $(@D)
263	$(TOUCH) $@
264locale/%.ISO8859-7/stamp:	data/%.UTF-8.src 8859-7.cm locale $(PROG)
265	./$(PROG) -U -i $< -f 8859-7.cm $(@D)
266	$(TOUCH) $@
267locale/%.ISO8859-6/stamp:	data/%.UTF-8.src 8859-6.cm locale $(PROG)
268	./$(PROG) -U -i $< -f 8859-6.cm $(@D)
269	$(TOUCH) $@
270locale/%.ISO8859-9/stamp:	data/%.UTF-8.src 8859-9.cm locale $(PROG)
271	./$(PROG) -U -i $< -f 8859-9.cm $(@D)
272	$(TOUCH) $@
273locale/%.ISO8859-11/stamp:	data/%.UTF-8.src 8859-11.cm locale $(PROG)
274	./$(PROG) -U -i $< -f 8859-11.cm $(@D)
275	$(TOUCH) $@
276locale/%.ISO8859-13/stamp:	data/%.UTF-8.src 8859-13.cm locale $(PROG)
277	./$(PROG) -U -i $< -f 8859-13.cm $(@D)
278	$(TOUCH) $@
279locale/%.ISO8859-15/stamp:	data/%.UTF-8.src 8859-15.cm locale $(PROG)
280	./$(PROG) -U -i $< -f 8859-15.cm $(@D)
281	$(TOUCH) $@
282locale/%.KOI8-R/stamp:		data/%.UTF-8.src KOI8-R.cm locale $(PROG)
283	./$(PROG) -U -i $< -f KOI8-R.cm $(@D)
284	$(TOUCH) $@
285
286locale/%/$(DCOLL):	locale/%/stamp
287locale/%/$(DCTYPE):	locale/%/stamp
288locale/%/$(DMSGS):	locale/%/stamp
289locale/%/$(DMON):	locale/%/stamp
290locale/%/$(DNUM):	locale/%/stamp
291locale/%/$(DTIME):	locale/%/stamp
292
293UTF-8.cm: data/UTF-8.cm
294	$(LN) -sf data/UTF-8.cm  $@
295
296%.cm: data/%.TXT UTF-8.cm
297	$(RM) $@
298	$(PERL) data/convert_map.pl $< > $@
299
300$(ROOTDATA):	$(ROOTLOCDIRS) $(ROOTCATDIRS) $(DATA)
301	$(RM) $@
302	$(CP) $(@:$(ROOTLIB)/%=%) $@
303	$(CHMOD) 0444 $@
304