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