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