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