1# -*- Makefile -*- 2# copyright (c) 2004 IBM and others. all rights reserved. 3# 4# (re)generate ICU data out of CLDR 5# 6# to use this file: 7# 8## 0. have ICU installed and built normally (sorry, no out-of-source - yet.) 9## 10## 1. make sure LDML2ICUConverter is in your path (see elsewhere) 11## 12## 2. Add a file 'reslocal.mk' in icu/source/data/locales to include this file: 13## include ../../../locale/tools/scripts/cldrres.mk 14## 15## 3. from icu/source/data type: 'make cldr-clean-old' to get rid of the non-CLDR files 16## now just type 'make' and you should be set. 17## 18 19## Root of the CLDR directory (contains common, icu, ...) 20CLDR_ROOT=../../../cldr 21ICU_XML=$(srcdir)/xml 22 23## Arguments to the LDML2ICUConverter program 24 25## if you want draft locales - uncomment this (or, put it in reslocal.mk) 26#LDML_CONVERTER_OPTS+=-f 27 28## if you want verbose output - uncomment this (or, put it in reslocal.mk) 29#LDML_CONVERTER_OPTS+=-v 30 31## the tool. No $(INVOKE) needed. 32LDML_CONVERTER=LDML2ICUConverter 33 34## command line options to the ldml conversion tool. Shouldn't need to edit from here on down. 35LDML_OPTS_RES += -s $(CLDR_ROOT)/common/main -d $(LOCSRCDIR) -p $(ICU_XML)/main -m $(CLDR_ROOT)/common/supplemental $(LDML_CONVERTER_OPTS) 36LDML_OPTS_COL += -s $(CLDR_ROOT)/common/collation -d $(COLSRCDIR) -p $(ICU_XML)/collation $(LDML_CONVERTER_OPTS) 37 38## some aliases 39GENRB_ALIAS_PATHS=$(GENRB_ALIAS_SOURCE:%.txt=$(LOCSRCDIR)/%.txt) 40GENRB_SYNTHETIC_PATHS=$(GENRB_SYNTHETIC_ALIAS:%.txt=$(LOCSRCDIR)/%.txt) 41COLLATION_ALIAS_PATHS=$(COLLATION_ALIAS_SOURCE:%.txt=$(COLSRCDIR)/%.txt) 42COLLATION_SYNTHETIC_PATHS=$(COLLATION_SYNTHETIC_ALIAS:%.txt=$(COLSRCDIR)/%.txt) 43COLLATION_EMPTY_PATHS=$(COLLATION_EMPTY_SOURCE:%.txt=$(COLSRCDIR)/%.txt) 44GENRB_PATHS=$(GENRB_SOURCE:%.txt=$(LOCSRCDIR)/%.txt) 45COLLATION_PATHS=$(COLLATION_SOURCE:%.txt=$(COLSRCDIR)/%.txt) 46 47## so make doesn't takes it from us (our carefully built .txt files..) 48.PRECIOUS: $(GENRB_PATHS) $(LOCSRCDIR)/root.txt $(GENRB_ALIAS_PATHS) $(COLLATION_PATHS) $(COLSRCDIR)/root.txt $(COLLATION_ALIAS_PATHS) 49 50## Rebuild ICU resource .txt from XML source 51$(LOCSRCDIR)/%.txt: $(CLDR_ROOT)/common/main/%.xml 52 $(LDML_CONVERTER) $(LDML_OPTS_RES) $(<F) || ($(RMV) $@;false) 53 54## Rebuild ICU collation .txt from XML source 55$(COLSRCDIR)/%.txt: $(CLDR_ROOT)/common/collation/%.xml 56 $(LDML_CONVERTER) $(LDML_OPTS_COL) $(<F) || ($(RMV) $@;false) 57 58## Special target for cleaning up the resource lists 59cldr-clean-lists: 60 -$(RMV) coll/colfiles.mk locales/resfiles.mk 61 62## Special target for cleaning up ALL generated files 63cldr-clean-old: cldr-clean-lists 64 -$(RMV) $(LOCSRCDIR)/*.txt $(COLSRCDIR)/*.txt 65 66## Special target for building the resource lists 67cldr-lists: coll/colfiles.mk locales/resfiles.mk 68 69 70## Alias generation. These are slow and shouldn't be rebuilt if 'make clean' is being run. 71 72## These don't work right, yet. 73#ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),) 74#ifneq ($(patsubst %cldr-clean-old,,$(MAKECMDGOALS)),) 75#ifneq ($(patsubst %cldr-clean-lists,,$(MAKECMDGOALS)),) 76 77$(GENRB_SYNTHETIC_PATHS) $(LOCSRCDIR)/resfiles.mk: $(ICU_XML)/deprecatedList.xml 78 $(LDML_CONVERTER) $(LDML_OPTS_RES) -w $(CLDR_ROOT)/common/main || ($(RMV) $@;false) 79 80$(COLLATION_SYNTHETIC_PATHS) $(COLLATION_EMPTY_PATHS) $(COLSRCDIR)/colfiles.mk: $(ICU_XML)/deprecatedList.xml 81 $(LDML_CONVERTER) $(LDML_OPTS_COL) -w $(CLDR_ROOT)/common/collation || ($(RMV) $@;false) 82#endif 83#endif 84#endif 85 86## Special target for building a tarball of the locale data 87locales.tgz: 88 tar cvf - locales/resfiles.mk locales/*.txt coll/colfiles.mk coll/*.txt | gzip > $@ 89 90## Special target for building the resource .txts 91cldr-locale-txt: $(GENRB_PATHS) 92 93## Special target for building the collation .txt 94cldr-collation-txt: $(COLLATION_PATHS) 95 96cldr-all-files: cldr-lists cldr-locale-txt cldr-collation-txt 97