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