xref: /illumos-gate/usr/src/data/locale/Makefile (revision ac2f5fbefc05314fcd97b03f2338b39e6efe643f)
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# Copyright 2019 Garrett D'Amore <garrett@damore.org>
18#
19
20include		$(SRC)/data/Makefile.data
21include		Makefile.com
22
23LOCNAMES=	$(ISO8859_1_LOCALES:%=%.ISO8859-1) \
24		$(ISO8859_2_LOCALES:%=%.ISO8859-2) \
25		$(ISO8859_5_LOCALES:%=%.ISO8859-5) \
26		$(ISO8859_6_LOCALES:%=%.ISO8859-6) \
27		$(ISO8859_7_LOCALES:%=%.ISO8859-7) \
28		$(ISO8859_9_LOCALES:%=%.ISO8859-9) \
29		$(ISO8859_11_LOCALES:%=%.ISO8859-11) \
30		$(ISO8859_13_LOCALES:%=%.ISO8859-13) \
31		$(ISO8859_15_LOCALES:%=%.ISO8859-15) \
32		$(KOI8_R_LOCALES:%=%.KOI8-R) \
33		$(GB18030_LOCALES:%=%.GB18030) \
34		$(UTF_8_LOCALES:%=%.UTF-8)
35LOCDIRS=	$(LOCNAMES:%=locale/%)
36
37STAMPFILES=	$(LOCDIRS:%=%/stamp)
38
39CATDIRS=	$(LOCDIRS:%=%/LC_COLLATE) \
40		$(LOCDIRS:%=%/LC_CTYPE) \
41		$(LOCDIRS:%=%/LC_MESSAGES) \
42		$(LOCDIRS:%=%/LC_MONETARY) \
43		$(LOCDIRS:%=%/LC_NUMERIC) \
44		$(LOCDIRS:%=%/LC_TIME)
45DATA=		$(CATDIRS:%=%/LCL_DATA)
46
47.PARALLEL:
48
49DCOLL=		LC_COLLATE/LCL_DATA
50DCTYPE=		LC_CTYPE/LCL_DATA
51DMSGS=		LC_MESSAGES/LCL_DATA
52DMON=		LC_MONETARY/LCL_DATA
53DNUM=		LC_NUMERIC/LCL_DATA
54DTIME=		LC_TIME/LCL_DATA
55
56ROOTLOCDIRS=	$(LOCDIRS:%=$(ROOTLIB)/%)
57ROOTCATDIRS=	$(CATDIRS:%=$(ROOTLIB)/%)
58ROOTDATA=	$(DATA:%=$(ROOTLIB)/%)
59$(ROOTDATA):=	FILEMODE=0444
60
61TRANSDIR=	translations
62TRANSMOS=	$(TRANSLOCS:%=$(TRANSDIR)/%.mo)
63OSTMOFILE=	LC_MESSAGES/SUNW_OST_OSLIB.mo
64PRIVFILE=	LC_MESSAGES/priv_names
65ROOTTRANSLATIONS=$(TRANSLOCS:%=$(ROOTLIB)/locale/%/$(OSTMOFILE))
66ROOTPRIVTRANS=	$(PRIVTRANSLOCS:%=$(ROOTLIB)/locale/%/$(PRIVFILE))
67
68.KEEP_STATE:
69
70all:		$(DATA)
71
72clean:
73		$(RM) $(CLEANFILES) $(STAMPFILES)
74
75clobber:	clean
76		$(RM) -r $(LOCDIRS)
77		$(RM) $(TRANSMOS)
78
79install:	all $(ROOTDATA) $(ROOTTRANSLATIONS) $(ROOTPRIVTRANS)
80
81translate:	$(ROOTTRANSLATIONS) $(ROOTPRIVTRANS)
82
83locale $(ROOTLOCDIRS) $(ROOTCATDIRS):
84		$(INS.dir)
85
86$(STAMPFILES):	locale
87
88locale/%.GB18030/stamp:	data/%.GB18030.src data/GB18030.cm
89		$(LCDEF) -U -w data/widths.txt -i $< -f data/GB18030.cm $(@D)
90		$(TOUCH) $@
91locale/%.ISO8859-1/stamp: data/%.ISO8859-1.src data/ISO8859-1.cm
92		$(LCDEF) -U -w data/widths.txt -i $< -f data/ISO8859-1.cm $(@D)
93		$(TOUCH) $@
94locale/%.ISO8859-2/stamp: data/%.ISO8859-2.src data/ISO8859-2.cm
95		$(LCDEF) -U -w data/widths.txt -i $< -f data/ISO8859-2.cm $(@D)
96		$(TOUCH) $@
97locale/%.ISO8859-5/stamp: data/%.ISO8859-5.src data/ISO8859-5.cm
98		$(LCDEF) -U -w data/widths.txt -i $< -f data/ISO8859-5.cm $(@D)
99		$(TOUCH) $@
100locale/%.ISO8859-6/stamp: data/%.ISO8859-6.src data/ISO8859-6.cm
101		$(LCDEF) -U -w data/widths.txt -i $< -f data/ISO8859-6.cm $(@D)
102		$(TOUCH) $@
103locale/%.ISO8859-7/stamp: data/%.ISO8859-7.src data/ISO8859-7.cm
104		$(LCDEF) -U -w data/widths.txt -i $< -f data/ISO8859-7.cm $(@D)
105		$(TOUCH) $@
106locale/%.ISO8859-9/stamp: data/%.ISO8859-9.src data/ISO8859-9.cm
107		$(LCDEF) -U -w data/widths.txt -i $< -f data/ISO8859-9.cm $(@D)
108		$(TOUCH) $@
109# The only locale here is th_TH.ISO8859-11, missing from current CLDR release -
110# use UTF-8 source file.
111locale/%.ISO8859-11/stamp: data/%.UTF-8.src data/ISO8859-11.cm
112		$(LCDEF) -U -w data/widths.txt -i $< -f data/ISO8859-11.cm $(@D)
113		$(TOUCH) $@
114locale/%.ISO8859-13/stamp: data/%.ISO8859-13.src data/ISO8859-13.cm
115		$(LCDEF) -U -w data/widths.txt -i $< -f data/ISO8859-13.cm $(@D)
116		$(TOUCH) $@
117locale/%.ISO8859-15/stamp: data/%.ISO8859-15.src data/ISO8859-15.cm
118		$(LCDEF) -U -w data/widths.txt -i $< -f data/ISO8859-15.cm $(@D)
119		$(TOUCH) $@
120locale/%.KOI8-R/stamp:	data/%.KOI8-R.src data/KOI8-R.cm
121		$(LCDEF) -U -w data/widths.txt -i $< -f data/KOI8-R.cm $(@D)
122		$(TOUCH) $@
123# Strip LC_CTYPE contents for UTF-8 locales and replace them
124# with common LC_CTYPE definition.
125locale/%.UTF-8/stamp: data/%.UTF-8.src data/UTF-8.cm data/common.UTF-8.src
126		$(SED) \
127		-e '/^LC_CTYPE/,/^END LC_CTYPE/d' \
128		-e '$$r data/common.UTF-8.src' $< | \
129		$(LCDEF) -U -w data/widths.txt -f data/UTF-8.cm $(@D)
130		$(TOUCH) $@
131
132# Special handling for zz_AA test locale
133locale/zz_AA.UTF-8/stamp: data/en_US.UTF-8.src data/UTF-8.cm data/common.UTF-8.src
134		$(SED) \
135		-e '/^LC_CTYPE/,/^END LC_CTYPE/d' \
136		-e '$$r data/common.UTF-8.src' data/en_US.UTF-8.src | \
137		$(LCDEF) -U -w data/widths.txt -f data/UTF-8.cm $(@D)
138		$(TOUCH) $@
139
140locale/%/$(DCOLL): locale/%/stamp
141locale/%/$(DCTYPE): locale/%/stamp
142locale/%/$(DMSGS): locale/%/stamp
143locale/%/$(DMON): locale/%/stamp
144locale/%/$(DNUM): locale/%/stamp
145locale/%/$(DTIME): locale/%/stamp
146
147$(ROOTDATA):	$(ROOTLOCDIRS) $(ROOTCATDIRS) $(DATA)
148		$(RM) $@
149		-$(CP) $(@:$(ROOTLIB)/%=%) $@
150		$(CHMOD) -f 0444 $@
151
152%.mo:		%.po
153		$(MSGFMT) -o $@ $<
154
155$(ROOTLIB)/locale/%/$(OSTMOFILE): $(TRANSDIR)/%.mo
156		$(INS.rename)
157		$(CHMOD) 0444 $@
158
159$(ROOTLIB)/locale/%/$(PRIVFILE): $(TRANSDIR)/%.priv
160		$(INS.rename)
161		$(CHMOD) 0444 $@
162