xref: /illumos-gate/usr/src/data/locale/Makefile (revision 10243bb069053a813aa803c1bbd2620ef4f0deab)
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 2017 Nexenta Systems, Inc.
14# Copyright 2011 EveryCity Ltd. All rights reserved.
15# Copyright 2013 DEY Storage Systems, Inc.
16# Copyright 2016 Joyent, Inc.
17#
18
19include		$(SRC)/data/Makefile.data
20
21CLEANFILES += \
22		data/8859-1.cm data/8859-2.cm data/8859-3.cm data/8859-4.cm \
23		data/8859-5.cm data/8859-5.cm data/8859-6.cm data/8859-7.cm \
24		data/8859-8.cm data/8859-9.cm data/8859-9.cm data/8859-10.cm \
25		data/8859-11.cm data/8859-13.cm data/8859-14.cm \
26		data/8859-15.cm data/8859-16.cm data/KOI8-R.cm \
27		data/UTF-8.ct
28
29include		Makefile.locales
30
31UTF8SRCS=	$(UTF_8_LOCALES:%=data/%.UTF-8.src)
32
33LOCNAMES= \
34		$(ISO8859_1_LOCALES:%=%.ISO8859-1) \
35		$(ISO8859_2_LOCALES:%=%.ISO8859-2) \
36		$(ISO8859_5_LOCALES:%=%.ISO8859-5) \
37		$(ISO8859_6_LOCALES:%=%.ISO8859-6) \
38		$(ISO8859_7_LOCALES:%=%.ISO8859-7) \
39		$(ISO8859_9_LOCALES:%=%.ISO8859-9) \
40		$(ISO8859_11_LOCALES:%=%.ISO8859-11) \
41		$(ISO8859_13_LOCALES:%=%.ISO8859-13) \
42		$(ISO8859_15_LOCALES:%=%.ISO8859-15) \
43		$(KOI8_R_LOCALES:%=%.KOI8-R) \
44		$(GB18030_LOCALES:%=%.GB18030) \
45		$(UTF_8_LOCALES:%=%.UTF-8)
46
47LOCDIRS=	$(LOCNAMES:%=locale/%)
48
49STAMPFILES=	$(LOCDIRS:%=%/stamp)
50
51CATDIRS= \
52		$(LOCDIRS:%=%/LC_COLLATE) \
53		$(LOCDIRS:%=%/LC_CTYPE) \
54		$(LOCDIRS:%=%/LC_MESSAGES) \
55		$(LOCDIRS:%=%/LC_MONETARY) \
56		$(LOCDIRS:%=%/LC_NUMERIC) \
57		$(LOCDIRS:%=%/LC_TIME)
58
59DATA=		$(CATDIRS:%=%/LCL_DATA)
60
61.PARALLEL:
62
63DCOLL=		LC_COLLATE/LCL_DATA
64DCTYPE=		LC_CTYPE/LCL_DATA
65DMSGS=		LC_MESSAGES/LCL_DATA
66DMON=		LC_MONETARY/LCL_DATA
67DNUM=		LC_NUMERIC/LCL_DATA
68DTIME=		LC_TIME/LCL_DATA
69
70ROOTLOCDIRS=	$(LOCDIRS:%=$(ROOTLIB)/%)
71ROOTCATDIRS=	$(CATDIRS:%=$(ROOTLIB)/%)
72ROOTDATA=	$(DATA:%=$(ROOTLIB)/%)
73
74# This is a list of locales that happen to have translations for them
75# present in the gate.
76TRANSLOCS= \
77		zz_AA.UTF-8
78
79PRIVTRANSLOCS= \
80		zz_AA.UTF-8
81
82TRANSDIR=	translations
83TRANSMOS=	$(TRANSLOCS:%=$(TRANSDIR)/%.mo)
84OSTMOFILE=	LC_MESSAGES/SUNW_OST_OSLIB.mo
85PRIVFILE=	LC_MESSAGES/priv_names
86
87ROOTTRANSLATIONS=$(TRANSLOCS:%=$(ROOTLIB)/locale/%/$(OSTMOFILE))
88ROOTPRIVTRANS=	$(PRIVTRANSLOCS:%=$(ROOTLIB)/locale/%/$(PRIVFILE))
89
90$(ROOTDATA):=	FILEMODE=0444
91
92.KEEP_STATE:
93
94all:		$(DATA)
95
96clean:
97		$(RM) $(CLEANFILES) $(STAMPFILES)
98
99clobber:	clean
100		$(RM) -r $(LOCDIRS)
101		$(RM) $(TRANSMOS)
102
103install:	all $(ROOTDATA) $(ROOTTRANSLATIONS) $(ROOTPRIVTRANS)
104
105translate:	$(ROOTTRANSLATIONS) $(ROOTPRIVTRANS)
106
107locale $(ROOTLOCDIRS) $(ROOTCATDIRS):
108		$(INS.dir)
109
110$(STAMPFILES):	locale
111
112# Strip LC_CTYPE contents for UTF-8 locales and replace them
113# with UTF-8.ct we compiled.
114locale/%.UTF-8/stamp: data/%.UTF-8.src data/UTF-8.cm data/UTF-8.ct
115		$(SED) '/^LC_CTYPE/,/^END LC_CTYPE/d;$$r data/UTF-8.ct' $< | \
116		$(LCDEF) -U -w data/widths.txt -f data/UTF-8.cm $(@D)
117		$(TOUCH) $@
118# Convert EURO_SIGN to CURRENCY_SIGN for the ISO8859-1 locales
119locale/%.ISO8859-1/stamp: data/%.UTF-8.src data/8859-1.cm
120		$(SED) 's/EURO_SIGN/CURRENCY_SIGN/' $< | \
121		$(LCDEF) -U -w data/widths.txt -f data/8859-1.cm $(@D)
122		$(TOUCH) $@
123locale/%.ISO8859-2/stamp: data/%.UTF-8.src data/8859-2.cm
124		$(LCDEF) -U -w data/widths.txt -i $< -f data/8859-2.cm $(@D)
125		$(TOUCH) $@
126locale/%.ISO8859-5/stamp: data/%.UTF-8.src data/8859-5.cm
127		$(LCDEF) -U -w data/widths.txt -i $< -f data/8859-5.cm $(@D)
128		$(TOUCH) $@
129locale/%.ISO8859-7/stamp: data/%.UTF-8.src data/8859-7.cm
130		$(LCDEF) -U -w data/widths.txt -i $< -f data/8859-7.cm $(@D)
131		$(TOUCH) $@
132locale/%.ISO8859-6/stamp: data/%.UTF-8.src data/8859-6.cm
133		$(LCDEF) -U -w data/widths.txt -i $< -f data/8859-6.cm $(@D)
134		$(TOUCH) $@
135locale/%.ISO8859-9/stamp: data/%.UTF-8.src data/8859-9.cm
136		$(LCDEF) -U -w data/widths.txt -i $< -f data/8859-9.cm $(@D)
137		$(TOUCH) $@
138locale/%.ISO8859-11/stamp: data/%.UTF-8.src data/8859-11.cm
139		$(LCDEF) -U -w data/widths.txt -i $< -f data/8859-11.cm $(@D)
140		$(TOUCH) $@
141locale/%.ISO8859-13/stamp: data/%.UTF-8.src data/8859-13.cm
142		$(LCDEF) -U -w data/widths.txt -i $< -f data/8859-13.cm $(@D)
143		$(TOUCH) $@
144locale/%.ISO8859-15/stamp: data/%.UTF-8.src data/8859-15.cm
145		$(LCDEF) -U -w data/widths.txt -i $< -f data/8859-15.cm $(@D)
146		$(TOUCH) $@
147locale/%.KOI8-R/stamp:	data/%.UTF-8.src data/KOI8-R.cm
148		$(LCDEF) -U -w data/widths.txt -i $< -f data/KOI8-R.cm $(@D)
149		$(TOUCH) $@
150locale/%.GB18030/stamp:	data/%.UTF-8.src data/GB18030.cm
151		$(LCDEF) -U -w data/widths.txt -i $< -f data/GB18030.cm $(@D)
152		$(TOUCH) $@
153
154locale/%/$(DCOLL): locale/%/stamp
155locale/%/$(DCTYPE): locale/%/stamp
156locale/%/$(DMSGS): locale/%/stamp
157locale/%/$(DMON): locale/%/stamp
158locale/%/$(DNUM): locale/%/stamp
159locale/%/$(DTIME): locale/%/stamp
160
161data/UTF-8.ct:	ctype.sh data/manual-input.UTF-8 $(UTF8SRCS)
162		@/bin/sh ctype.sh $(UTF8SRCS) > $@
163
164data/%.cm:	convert_map.pl data/%.TXT data/UTF-8.cm
165		$(RM) $@
166		$(PERL) convert_map.pl $< > $@
167
168$(ROOTDATA):	$(ROOTLOCDIRS) $(ROOTCATDIRS) $(DATA)
169		$(RM) $@
170		$(CP) $(@:$(ROOTLIB)/%=%) $@
171		$(CHMOD) 0444 $@
172
173%.mo:		%.po
174		$(MSGFMT) -o $@ $<
175
176$(ROOTLIB)/locale/%/$(OSTMOFILE): $(TRANSDIR)/%.mo
177		$(INS.rename)
178		$(CHMOD) 0444 $@
179
180$(ROOTLIB)/locale/%/$(PRIVFILE): $(TRANSDIR)/%.priv
181		$(INS.rename)
182		$(CHMOD) 0444 $@
183