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