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