xref: /illumos-gate/usr/src/cmd/localedef/Makefile (revision ed22c7109fc5dd9e1b7a5d0333bdc7ad2718e2ab)
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		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
182UTF8SRCS	= $(UTF_8_LOCALES:%=data/%.UTF-8.src)
183
184LOCNAMES	= \
185		$(ISO8859_1_LOCALES:%=%.ISO8859-1) \
186		$(ISO8859_2_LOCALES:%=%.ISO8859-2) \
187		$(ISO8859_5_LOCALES:%=%.ISO8859-5) \
188		$(ISO8859_6_LOCALES:%=%.ISO8859-6) \
189		$(ISO8859_7_LOCALES:%=%.ISO8859-7) \
190		$(ISO8859_9_LOCALES:%=%.ISO8859-9) \
191		$(ISO8859_11_LOCALES:%=%.ISO8859-11) \
192		$(ISO8859_13_LOCALES:%=%.ISO8859-13) \
193		$(ISO8859_15_LOCALES:%=%.ISO8859-15) \
194		$(KOI8_R_LOCALES:%=%.KOI8-R) \
195		$(UTF_8_LOCALES:%=%.UTF-8)
196
197LOCDIRS		= $(LOCNAMES:%=locale/%)
198
199STAMPFILES	= $(LOCDIRS:%=%/stamp)
200
201CATDIRS		= \
202		$(LOCDIRS:%=%/LC_COLLATE) \
203		$(LOCDIRS:%=%/LC_CTYPE) \
204		$(LOCDIRS:%=%/LC_MESSAGES) \
205		$(LOCDIRS:%=%/LC_MONETARY) \
206		$(LOCDIRS:%=%/LC_NUMERIC) \
207		$(LOCDIRS:%=%/LC_TIME)
208
209DATA		= $(CATDIRS:%=%/LCL_DATA)
210
211DCOLL		= LC_COLLATE/LCL_DATA
212DCTYPE		= LC_CTYPE/LCL_DATA
213DMSGS		= LC_MESSAGES/LCL_DATA
214DMON		= LC_MONETARY/LCL_DATA
215DNUM		= LC_NUMERIC/LCL_DATA
216DTIME		= LC_TIME/LCL_DATA
217
218ROOTLOCDIRS	= $(LOCDIRS:%=$(ROOTLIB)/%)
219ROOTCATDIRS	= $(CATDIRS:%=$(ROOTLIB)/%)
220ROOTDATA	= $(DATA:%=$(ROOTLIB)/%)
221
222$(ROOTDATA)	:= FILEMODE=0444
223
224all: $(PROG) $(DATA)
225
226install: all $(ROOTPROG) $(ROOTDATA)
227
228$(PROG): $(OBJS)
229	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
230	$(POST_PROCESS)
231
232$(OBJS):	parser.tab.h
233
234parser.tab.c parser.tab.h: parser.y $(HDRS)
235	$(YACC) $(YFLAGS) parser.y
236
237lint:	$(SRCS)
238	$(LINT.c) $(CPPFLAGS) $(SRCS)
239
240clean:
241	$(RM) $(CLEANFILES)
242	$(RM) $(STAMPFILES)
243
244$(POFILE):	$(PIFILES)
245	$(RM) $@
246	$(RM) messages.po
247	$(XGETTEXT) -s $(PIFILES)
248	$(SED) -e '/domain/d' messages.po > $@
249	$(RM) $(PIFILES) messages.po
250
251locale $(ROOTLOCDIRS) $(ROOTCATDIRS):
252	$(INS.dir)
253
254include ../Makefile.targ
255
256# Strip LC_CTYPE contents for UTF-8 locales and replace them
257# with UTF-8.ct we compiled
258locale/%.UTF-8/stamp:		data/%.UTF-8.src UTF-8.cm \
259				UTF-8.ct locale $(PROG)
260	$(SED) '/^LC_CTYPE/,/^END LC_CTYPE/d;$$r UTF-8.ct' $< | \
261		./$(PROG) -U -f UTF-8.cm $(@D)
262	$(TOUCH) $@
263locale/%.ISO8859-1/stamp:	data/%.UTF-8.src 8859-1.cm locale $(PROG)
264	./$(PROG) -U -i $< -f 8859-1.cm $(@D)
265	$(TOUCH) $@
266locale/%.ISO8859-2/stamp:	data/%.UTF-8.src 8859-2.cm locale $(PROG)
267	./$(PROG) -U -i $< -f 8859-2.cm $(@D)
268	$(TOUCH) $@
269locale/%.ISO8859-5/stamp:	data/%.UTF-8.src 8859-5.cm locale $(PROG)
270	./$(PROG) -U -i $< -f 8859-5.cm $(@D)
271	$(TOUCH) $@
272locale/%.ISO8859-7/stamp:	data/%.UTF-8.src 8859-7.cm locale $(PROG)
273	./$(PROG) -U -i $< -f 8859-7.cm $(@D)
274	$(TOUCH) $@
275locale/%.ISO8859-6/stamp:	data/%.UTF-8.src 8859-6.cm locale $(PROG)
276	./$(PROG) -U -i $< -f 8859-6.cm $(@D)
277	$(TOUCH) $@
278locale/%.ISO8859-9/stamp:	data/%.UTF-8.src 8859-9.cm locale $(PROG)
279	./$(PROG) -U -i $< -f 8859-9.cm $(@D)
280	$(TOUCH) $@
281locale/%.ISO8859-11/stamp:	data/%.UTF-8.src 8859-11.cm locale $(PROG)
282	./$(PROG) -U -i $< -f 8859-11.cm $(@D)
283	$(TOUCH) $@
284locale/%.ISO8859-13/stamp:	data/%.UTF-8.src 8859-13.cm locale $(PROG)
285	./$(PROG) -U -i $< -f 8859-13.cm $(@D)
286	$(TOUCH) $@
287locale/%.ISO8859-15/stamp:	data/%.UTF-8.src 8859-15.cm locale $(PROG)
288	./$(PROG) -U -i $< -f 8859-15.cm $(@D)
289	$(TOUCH) $@
290locale/%.KOI8-R/stamp:		data/%.UTF-8.src KOI8-R.cm locale $(PROG)
291	./$(PROG) -U -i $< -f KOI8-R.cm $(@D)
292	$(TOUCH) $@
293
294locale/%/$(DCOLL):	locale/%/stamp
295locale/%/$(DCTYPE):	locale/%/stamp
296locale/%/$(DMSGS):	locale/%/stamp
297locale/%/$(DMON):	locale/%/stamp
298locale/%/$(DNUM):	locale/%/stamp
299locale/%/$(DTIME):	locale/%/stamp
300
301UTF-8.cm: data/UTF-8.cm
302	$(LN) -sf data/UTF-8.cm  $@
303
304UTF-8.ct: $(UTF8SRCS)
305	$(SH) data/ctype.sh $(UTF8SRCS) > $@
306
307%.cm: data/%.TXT UTF-8.cm
308	$(RM) $@
309	$(PERL) data/convert_map.pl $< > $@
310
311$(ROOTDATA):	$(ROOTLOCDIRS) $(ROOTCATDIRS) $(DATA)
312	$(RM) $@
313	$(CP) $(@:$(ROOTLIB)/%=%) $@
314	$(CHMOD) 0444 $@
315