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