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