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