• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## Makefile.in for ICU data
2## Copyright (c) 1999-2011, International Business Machines Corporation and
3## others. All Rights Reserved.
4
5## Source directory information
6srcdir = @srcdir@
7top_srcdir = @top_srcdir@
8
9# So that you have $(top_builddir)/config.status
10top_builddir = ..
11
12## All the flags and other definitions are included here.
13include $(top_builddir)/icudefs.mk
14
15## Build directory information
16# So that  $(top_builddir)/$(subdir) ~= "here"
17subdir = data
18
19#lib icu data for link
20LIB_ICUDATA_NAME=$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX)
21LIB_STATIC_ICUDATA_NAME=$(LIBSICU)$(DATA_STUBNAME)$(ICULIBSUFFIX)
22
23# Allow Windows to override these options
24ifeq ($(PKGDATA_OPTS),)
25PKGDATA_OPTS = -O $(top_builddir)/data/icupkg.inc
26endif
27ifeq ($(PKGDATA_VERSIONING),)
28PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION)
29endif
30
31# This allows all the data to be in one directory
32ifeq ($(PKGDATA_MODE),dll)
33ICUPKGDATA_OUTDIR = $(LIBDIR)
34else
35ifeq ($(PKGDATA_MODE),static)
36ICUPKGDATA_OUTDIR = $(LIBDIR)
37else
38ICUPKGDATA_OUTDIR = $(OUTDIR)
39endif
40endif
41
42CURDIR:=$(CURR_FULL_DIR)
43# current directory should not be blank
44ifeq ($(CURDIR),)
45CURDIR=.
46endif
47PKGDATA = $(TOOLBINDIR)/pkgdata $(PKGDATA_OPTS) -q -c -s $(CURDIR)/out/build/$(ICUDATA_PLATFORM_NAME) -d $(ICUPKGDATA_OUTDIR)
48
49ifeq ($(OS390_STUBDATA),1)
50OS390PKG=package390
51OS390INSTALL=install390
52
53# Additional data for 390
54OS390LIST=$(OUTTMPDIR)/icudata390.lst
55OUTTMPDIR_390STUB=$(top_builddir)/data/out/tmp_390stub
56endif
57
58# OBJDATADIR must be a short path (with ..'s) to the data.
59
60ifeq ($(top_srcdir),..)
61SRCDATADIR=.
62else
63SRCDATADIR=$(top_srcdir)/data
64endif
65ifeq ($(top_builddir),..)
66OUTDIR=./out
67else
68OUTDIR=$(top_builddir)/data/out
69endif
70
71OUTTMPDIR=$(OUTDIR)/tmp
72MAINBUILDDIR=$(OUTDIR)/build
73BUILDDIR=$(MAINBUILDDIR)/$(ICUDATA_PLATFORM_NAME)
74UNICODEDATADIR=$(SRCDATADIR)/unidata
75LOCSRCDIR=$(SRCDATADIR)/locales
76CURRSRCDIR=$(SRCDATADIR)/curr
77CURRBLDDIR=$(BUILDDIR)/curr
78LANGSRCDIR=$(SRCDATADIR)/lang
79LANGBLDDIR=$(BUILDDIR)/lang
80REGIONSRCDIR=$(SRCDATADIR)/region
81REGIONBLDDIR=$(BUILDDIR)/region
82ZONESRCDIR=$(SRCDATADIR)/zone
83ZONEBLDDIR=$(BUILDDIR)/zone
84COLSRCDIR=$(SRCDATADIR)/coll
85COLBLDDIR=$(BUILDDIR)/coll
86RBNFSRCDIR=$(SRCDATADIR)/rbnf
87RBNFBLDDIR=$(BUILDDIR)/rbnf
88TRANSLITSRCDIR=$(SRCDATADIR)/translit
89TRANSLITBLDDIR=$(BUILDDIR)/translit
90MISCSRCDIR=$(SRCDATADIR)/misc
91BRKSRCDIR=$(SRCDATADIR)/brkitr
92BRKBLDDIR=$(BUILDDIR)/brkitr
93MISCSRCDIR=$(SRCDATADIR)/misc
94UCMSRCDIR=$(SRCDATADIR)/mappings
95SPREPSRCDIR=$(SRCDATADIR)/sprep
96COMINCDIR=$(top_srcdir)/common/unicode
97SRCLISTDEPS=Makefile $(srcdir)/Makefile.in
98BUILD_DIRS=$(OUTDIR) $(MAINBUILDDIR) $(BUILDDIR) $(CURRBLDDIR) $(LANGBLDDIR) $(REGIONBLDDIR) $(ZONEBLDDIR) $(BRKBLDDIR) $(COLBLDDIR) $(RBNFBLDDIR) $(TRANSLITBLDDIR) $(OUTTMPDIR) $(OUTTMPDIR_390STUB) $(OUTTMPDIR)/$(CURR_TREE) $(OUTTMPDIR)/$(LANG_TREE) $(OUTTMPDIR)/$(REGION_TREE) $(OUTTMPDIR)/$(ZONE_TREE) $(OUTTMPDIR)/$(COLLATION_TREE) $(OUTTMPDIR)/$(RBNF_TREE) $(OUTTMPDIR)/$(TRANSLIT_TREE) $(OUTTMPDIR)/$(BREAK_TREE)
99
100# relative lib links from pkgdata are the same as for tmp
101TOOLDIR=$(top_builddir)/tools
102
103## List of phony targets
104.PHONY : all all-local all-recursive install install-local install-files	\
105install-recursive clean clean-local clean-recursive distclean		\
106distclean-local distclean-recursive dist dist-local dist-recursive	\
107check check-local check-recursive build-local clean-resindex build-dir icudata.jar
108
109## Clear suffix list
110.SUFFIXES :
111
112## List of standard targets
113all: all-local
114install: all-local install-local
115clean: clean-local
116distclean : distclean-local
117dist:
118check: all
119
120-include Makefile.local
121
122
123distclean-local: clean
124	$(RMV) Makefile
125
126all-local: build-dir icupkg.inc build-local packagedata $(POST_DATA_BUILD) $(OS390PKG)
127
128dist-local:
129
130clean-map:
131	-test -z *.map || $(RMV) *.map
132
133clean-local: cleanpackage cleanfiles clean-map
134
135cleanfiles:
136	test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
137
138cleanpackage:
139	$(RMV) $(OUTDIR)
140	$(RMV) $(LIBDIR)/$(LIB_ICUDATA_NAME)*.$(SO)* $(LIBDIR)/$(LIB_STATIC_ICUDATA_NAME).$(A)
141
142check-local:
143
144# Find out if we have a source archive.
145# If we have that, then use that instead of building everything from scratch.
146ICUDATA_SOURCE_ARCHIVE = $(wildcard $(srcdir)/in/$(ICUDATA_PLATFORM_NAME).dat)
147ifeq ($(ICUDATA_SOURCE_ARCHIVE),)
148ICUDATA_ARCHIVE = $(firstword $(wildcard $(srcdir)/in/$(ICUDATA_BASENAME_VERSION)*.dat))
149# We don't have the data in the current endianess or charset.
150# See if we can find data of any archive type,
151# and convert it to the current type.
152ifneq ($(ICUDATA_ARCHIVE),)
153ICUDATA_SOURCE_ARCHIVE = $(OUTDIR)/$(ICUDATA_PLATFORM_NAME).dat
154$(ICUDATA_SOURCE_ARCHIVE): $(ICUDATA_ARCHIVE) $(OUTDIR)
155	$(INVOKE) $(TOOLBINDIR)/icupkg -t$(ICUDATA_CHAR) $(ICUDATA_ARCHIVE) $(ICUDATA_SOURCE_ARCHIVE)
156endif
157else
158ifneq ($(ENABLE_STATIC),YES)
159ifeq ($(PKGDATA_MODE),common)
160# We have a source data common archive in the native endianess,
161# and it's what we want to build. Try to not run any of ICU's tools.
162ICUDATA_SOURCE_IS_NATIVE_TARGET=YES
163endif
164endif
165endif
166
167packagedata: icupkg.inc $(PKGDATA_LIST) build-local
168ifneq ($(ENABLE_STATIC),)
169ifeq ($(PKGDATA_MODE),dll)
170	$(PKGDATA_INVOKE) $(PKGDATA) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBSTATICNAME) -m static $(PKGDATA_VERSIONING) $(PKGDATA_LIST)
171endif
172endif
173ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
174	$(PKGDATA_INVOKE) $(PKGDATA) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -p $(ICUDATA_NAME) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) $(PKGDATA_LIBNAME) $(PKGDATA_LIST)
175else
176	$(INSTALL_DATA) $(ICUDATA_SOURCE_ARCHIVE) $(OUTDIR)
177endif
178
179## Install ICU data.
180install-local: $(PKGDATA_LIST) ./icupkg.inc packagedata $(OS390INSTALL)
181	$(MKINSTALLDIRS) $(TMPDATADIR) $(DESTDIR)$(ICUPKGDATA_DIR)
182ifeq ($(PKGDATA_MODE),files)
183	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)
184	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(CURR_TREE)
185	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(LANG_TREE)
186	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(REGION_TREE)
187	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(ZONE_TREE)
188	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(BREAK_TREE)
189	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(COLLATION_TREE)
190	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(RBNF_TREE)
191	$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(TRANSLIT_TREE)
192endif
193ifneq ($(ENABLE_STATIC),)
194ifeq ($(PKGDATA_MODE),dll)
195	$(PKGDATA_INVOKE) $(PKGDATA) -m static -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBSTATICNAME) $(PKGDATA_LIST) -I $(ICUPKGDATA_INSTALL_LIBDIR)
196endif
197endif
198ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
199	$(PKGDATA_INVOKE) $(PKGDATA) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBNAME) $(PKGDATA_LIST) -I $(ICUPKGDATA_INSTALL_DIR)
200else
201	$(INSTALL_DATA) $(ICUDATA_SOURCE_ARCHIVE) $(DESTDIR)$(ICUPKGDATA_DIR)
202endif
203
204
205####
206####
207#### 390 support
208install390: package390
209	$(MKINSTALLDIRS) $(TMPDATADIR) $(DESTDIR)$(libdir)
210	$(INVOKE) $(PKGDATA) -s $(BUILDDIR)$(STUB_SUFFIX) -T $(OUTTMPDIR_390STUB) -p $(ICUDATA_NAME)$(STUB_SUFFIX) $(PKGDATA_LIBNAME)$(STUB_SUFFIX) -e $(ICUDATA_ENTRY_POINT) $(OS390LIST) -m dll $(PKGDATA_VERSIONING) -I $(DESTDIR)$(ICUPKGDATA_DIR)
211ifeq ($(PKGDATA_MODE),dll)
212	$(INSTALL-L) $(ICUPKGDATA_OUTDIR)/$(FINAL_IMPORT_LIB) $(DESTDIR)$(ICUPKGDATA_DIR)/$(FINAL_IMPORT_LIB)
213endif
214
215#### $(LIB_ICUDATA_NAME)$(STUB_SUFFIX) is the subset data for batch mode
216package390: $(OUTTMPDIR)/icudata390.lst $(PKGDATA_LIST) ./icupkg.inc packagedata
217	ln -s $(ICUDATA_NAME) $(OUTDIR)/build/$(ICUDATA_NAME)$(STUB_SUFFIX)
218	$(INVOKE) $(PKGDATA) -s $(BUILDDIR)$(STUB_SUFFIX) -T $(OUTTMPDIR_390STUB) -p $(ICUDATA_NAME)$(STUB_SUFFIX) $(PKGDATA_LIBNAME)$(STUB_SUFFIX) -e $(ICUDATA_ENTRY_POINT) $(OS390LIST) -m dll $(PKGDATA_VERSIONING)
219	cp $(ICUPKGDATA_OUTDIR)/$(LIB_ICUDATA_NAME)$(STUB_SUFFIX).$(SO) $(top_builddir)/stubdata/$(LIB_ICUDATA_NAME)$(STUB_SUFFIX).$(SO)
220
221
222##### Define all the data files. the build rule that depends on them is below.
223# X_FILES_SHORT = just the base names (for lists)
224# X_FILES = full paths (for dependency)
225
226## DAT files - Misc. data files.
227#  2005-may-05 Removed Unicode properties files (unorm.icu, uprops.icu, ucase.icu, ubidi.icu)
228#  from data build. See Jitterbug 4497. (makedata.mak revision 1.117)
229#  2010-dec Removed pnames.icu.
230# These are now hardcoded in ICU4C and only loaded in ICU4J.
231#
232DAT_FILES_SHORT=unames.icu cnvalias.icu coll/ucadata.icu coll/invuca.icu nfc.nrm nfkc.nrm nfkc_cf.nrm uts46.nrm
233DAT_FILES=$(DAT_FILES_SHORT:%=$(BUILDDIR)/%)
234
235## BRK files
236BREAK_TREE=brkitr
237-include $(BRKSRCDIR)/brkfiles.mk
238-include $(BRKSRCDIR)/brklocal.mk
239ALL_BRK_SOURCE= $(BRK_SOURCE) $(BRK_SOURCE_LOCAL)
240BRK_FILES_SHORT=$(ALL_BRK_SOURCE:%.txt=$(BREAK_TREE)/%.brk)
241BRK_FILES=$(ALL_BRK_SOURCE:%.txt=$(BRKBLDDIR)/%.brk)
242ifdef BRK_CTD_SOURCE
243ALL_CTD_SOURCE=$(BRK_CTD_SOURCE) $(BRK_CTD_SOURCE_LOCAL)
244CTD_FILES_SHORT=$(ALL_CTD_SOURCE:%.txt=$(BREAK_TREE)/%.ctd)
245CTD_FILES=$(ALL_CTD_SOURCE:%.txt=$(BRKBLDDIR)/%.ctd)
246endif
247ifdef BRK_RES_SOURCE
248BRS_SRC= root.txt $(BRK_RES_SOURCE) $(BRK_RES_SOURCE_LOCAL)
249BRS_SRC_FILES = $(BRS_SRC:%=$(BRKSRCDIR)/%)
250INSTALLED_BRS_FILES = $(BRK_RES_SOURCE:%.txt=%)  $(BRK_RES_SOURCE_LOCAL:%.txt=%)
251endif
252
253## Confusables (Spoofing) files
254ALL_CFU_SOURCE=$(UNICODEDATADIR)/confusables.txt $(UNICODEDATADIR)/confusablesWholeScript.txt
255CFU_FILES_SHORT=confusables.cfu
256CFU_FILES=$(BUILDDIR)/$(CFU_FILES_SHORT)
257
258## UCM files
259-include $(UCMSRCDIR)/ucmcore.mk
260-include $(UCMSRCDIR)/ucmfiles.mk
261-include $(UCMSRCDIR)/ucmebcdic.mk
262-include $(UCMSRCDIR)/ucmlocal.mk
263ALL_UCM_SOURCE=ibm-37_P100-1995.ucm ibm-1047_P100-1995.ucm $(UCM_SOURCE_CORE) $(UCM_SOURCE_FILES) $(UCM_SOURCE_EBCDIC) $(UCM_SOURCE_LOCAL)
264UCM_FILES = $(ALL_UCM_SOURCE:%=$(SRCDATADIR)/%)
265CNV_FILES = $(ALL_UCM_SOURCE:%.ucm=$(BUILDDIR)/%.cnv)
266CNV_FILES_SHORT = $(ALL_UCM_SOURCE:%.ucm=%.cnv)
267UCM_SOURCE_SPECIAL=$(UCM_SOURCE_EBCDIC_IGNORE_SISO) $(UCM_SOURCE_EBCDIC_IGNORE_SISO_LOCAL)
268UCM_FILES_SPECIAL=$(UCM_SOURCE_SPECIAL:%=$(UCMSRCDIR)/%)
269CNV_FILES_SPECIAL=$(UCM_SOURCE_SPECIAL:%.ucm=$(BUILDDIR)/%.cnv)
270CNV_FILES_SHORT_SPECIAL=$(UCM_SOURCE_SPECIAL:%.ucm=%.cnv)
271
272## RES files
273-include $(LOCSRCDIR)/resfiles.mk
274-include $(CURRSRCDIR)/resfiles.mk
275-include $(LANGSRCDIR)/resfiles.mk
276-include $(REGIONSRCDIR)/resfiles.mk
277-include $(ZONESRCDIR)/resfiles.mk
278-include $(COLSRCDIR)/colfiles.mk
279-include $(RBNFSRCDIR)/rbnffiles.mk
280-include $(TRANSLITSRCDIR)/trnsfiles.mk
281-include $(LOCSRCDIR)/reslocal.mk
282-include $(CURRSRCDIR)/reslocal.mk
283-include $(LANGSRCDIR)/reslocal.mk
284-include $(REGIONSRCDIR)/reslocal.mk
285-include $(ZONESRCDIR)/reslocal.mk
286-include $(COLSRCDIR)/collocal.mk
287-include $(BRKSRCDIR)/brslocal.mk
288-include $(RBNFSRCDIR)/rbnflocal.mk
289-include $(TRANSLITSRCDIR)/trnslocal.mk
290ifdef GENRB_SOURCE
291RES_SRC= root.txt $(GENRB_SOURCE) $(GENRB_ALIAS_SOURCE) $(GENRB_SOURCE_LOCAL) $(GENRB_ALIAS_SOURCE_LOCAL)
292RES_SRC_FILES = $(RES_SRC:%=$(LOCSRCDIR)/%)
293INSTALLED_RB_FILES = $(GENRB_SOURCE:%.txt=%) $(GENRB_SOURCE_LOCAL:%.txt=%)
294endif
295ifdef CURR_SOURCE
296CURR_SRC= root.txt supplementalData.txt $(CURR_SOURCE) $(CURR_ALIAS_SOURCE) $(CURR_SOURCE_LOCAL)
297CURR_SRC_FILES = $(CURR_SRC:%=$(CURRSRCDIR)/%)
298INSTALLED_CURR_FILES = $(CURR_SOURCE:%.txt=%)  $(CURR_SOURCE_LOCAL:%.txt=%)
299endif
300ifdef LANG_SOURCE
301LANG_SRC= root.txt $(LANG_SOURCE) $(LANG_ALIAS_SOURCE) $(LANG_SOURCE_LOCAL)
302LANG_SRC_FILES = $(LANG_SRC:%=$(LANGSRCDIR)/%)
303INSTALLED_LANG_FILES = $(LANG_SOURCE:%.txt=%)  $(LANG_SOURCE_LOCAL:%.txt=%)
304endif
305ifdef REGION_SOURCE
306REGION_SRC= root.txt $(REGION_SOURCE) $(REGION_ALIAS_SOURCE) $(REGION_SOURCE_LOCAL)
307REGION_SRC_FILES = $(REGION_SRC:%=$(REGIONSRCDIR)/%)
308INSTALLED_REGION_FILES = $(REGION_SOURCE:%.txt=%)  $(REGION_SOURCE_LOCAL:%.txt=%)
309endif
310ifdef ZONE_SOURCE
311ZONE_SRC= root.txt $(ZONE_SOURCE) $(ZONE_ALIAS_SOURCE) $(ZONE_SOURCE_LOCAL)
312ZONE_SRC_FILES = $(ZONE_SRC:%=$(ZONESRCDIR)/%)
313INSTALLED_ZONE_FILES = $(ZONE_SOURCE:%.txt=%)  $(ZONE_SOURCE_LOCAL:%.txt=%)
314endif
315ifdef COLLATION_SOURCE
316COL_SRC= root.txt $(COLLATION_SOURCE) $(COLLATION_ALIAS_SOURCE) $(COLLATION_SOURCE_LOCAL)
317COL_SRC_FILES = $(COL_SRC:%=$(COLSRCDIR)/%)
318INSTALLED_COL_FILES = $(COLLATION_SOURCE:%.txt=%)  $(COLLATION_SOURCE_LOCAL:%.txt=%)
319endif
320ifdef RBNF_SOURCE
321RBNF_SRC= root.txt $(RBNF_SOURCE) $(RBNF_ALIAS_SOURCE) $(RBNF_SOURCE_LOCAL)
322RBNF_SRC_FILES = $(RBNF_SRC:%=$(RBNFSRCDIR)/%)
323INSTALLED_RBNF_FILES = $(RBNF_SOURCE:%.txt=%)  $(RBNF_SOURCE_LOCAL:%.txt=%)
324endif
325ifdef TRANSLIT_SOURCE
326TRANSLIT_SRC= $(TRANSLIT_SOURCE) $(TRANSLIT_ALIAS_SOURCE) $(TRANSLIT_SOURCE_LOCAL)
327TRANSLIT_SRC_FILES = $(TRANSLIT_SRC:%=$(TRANSLITSRCDIR)/%)
328INSTALLED_TRANSLIT_FILES = $(TRANSLIT_SOURCE:%.txt=%)  $(TRANSLIT_SOURCE_LOCAL:%.txt=%)
329endif
330GENRBOPTS=-k
331
332## MISC files
333-include $(MISCSRCDIR)/miscfiles.mk
334-include $(MISCSRCDIR)/misclocal.mk
335MSC_SOURCE= $(MISC_SOURCE) $(MISC_SOURCE_LOCAL)
336MSC_SRC_FILES=$(MSC_SOURCE:%=$(MISCSRCDIR)/%)
337
338ifeq ($(ENABLE_SO_VERSION_DATA),1)
339ifeq ($(PKGDATA_MODE),dll)
340SO_VERSION_DATA = $(OUTTMPDIR)/icudata.res
341$(SO_VERSION_DATA) : $(MISCSRCDIR)/icudata.rc
342	rc.exe /i$(srcdir)/../common /fo$@ $(CPPFLAGS) $(SOURCE_FILE)
343endif
344endif
345
346INDEX_NAME=res_index
347INDEX_FILE=$(OUTTMPDIR)/$(INDEX_NAME).txt
348
349ALL_RES_SRC= $(RES_SRC) $(TRNS_SOURCE) $(MSC_SOURCE)
350RES_FILES = $(ALL_RES_SRC:%.txt=$(BUILDDIR)/%.res) $(BUILDDIR)/$(INDEX_NAME).res $(BUILDDIR)/pool.res
351RES_FILES_SHORT = $(ALL_RES_SRC:%.txt=%.res) $(INDEX_NAME).res pool.res
352PKGDATA_LIST = $(OUTTMPDIR)/icudata.lst
353
354CURR_TREE=curr
355CURR_INDEX_FILE=$(OUTTMPDIR)/$(CURR_TREE)/$(INDEX_NAME).txt
356CURR_FILES = $(CURR_SRC:%.txt=$(CURRBLDDIR)/%.res) $(CURRBLDDIR)/$(INDEX_NAME).res $(CURRBLDDIR)/pool.res
357CURR_FILES_SHORT = $(CURR_SRC:%.txt=$(CURR_TREE)/%.res) $(CURR_TREE)/$(INDEX_NAME).res $(CURR_TREE)/pool.res
358
359LANG_TREE=lang
360LANG_INDEX_FILE=$(OUTTMPDIR)/$(LANG_TREE)/$(INDEX_NAME).txt
361LANG_FILES = $(LANG_SRC:%.txt=$(LANGBLDDIR)/%.res) $(LANGBLDDIR)/$(INDEX_NAME).res $(LANGBLDDIR)/pool.res
362LANG_FILES_SHORT = $(LANG_SRC:%.txt=$(LANG_TREE)/%.res) $(LANG_TREE)/$(INDEX_NAME).res $(LANG_TREE)/pool.res
363
364REGION_TREE=region
365REGION_INDEX_FILE=$(OUTTMPDIR)/$(REGION_TREE)/$(INDEX_NAME).txt
366REGION_FILES = $(REGION_SRC:%.txt=$(REGIONBLDDIR)/%.res) $(REGIONBLDDIR)/$(INDEX_NAME).res $(REGIONBLDDIR)/pool.res
367REGION_FILES_SHORT = $(REGION_SRC:%.txt=$(REGION_TREE)/%.res) $(REGION_TREE)/$(INDEX_NAME).res $(REGION_TREE)/pool.res
368
369ZONE_TREE=zone
370ZONE_INDEX_FILE=$(OUTTMPDIR)/$(ZONE_TREE)/$(INDEX_NAME).txt
371ZONE_FILES = $(ZONE_SRC:%.txt=$(ZONEBLDDIR)/%.res) $(ZONEBLDDIR)/$(INDEX_NAME).res $(ZONEBLDDIR)/pool.res
372ZONE_FILES_SHORT = $(ZONE_SRC:%.txt=$(ZONE_TREE)/%.res) $(ZONE_TREE)/$(INDEX_NAME).res $(ZONE_TREE)/pool.res
373
374COLLATION_TREE=coll
375COLLATION_INDEX_FILE=$(OUTTMPDIR)/$(COLLATION_TREE)/$(INDEX_NAME).txt
376COLLATION_INDEX_RES=$(COLBLDDIR)/$(INDEX_NAME).res
377COLLATION_INDEX_RES_SHORT=$(COLLATION_TREE)/$(INDEX_NAME).res
378COLLATION_FILES = $(COL_SRC:%.txt=$(COLBLDDIR)/%.res) $(COLLATION_INDEX_RES)
379COLLATION_FILES_SHORT = $(COL_SRC:%.txt=$(COLLATION_TREE)/%.res)
380
381BRK_RES_INDEX_FILE=$(OUTTMPDIR)/$(BREAK_TREE)/$(INDEX_NAME).txt
382BRK_RES_INDEX_RES=$(BRKBLDDIR)/$(INDEX_NAME).res
383BRK_RES_INDEX_RES_SHORT=$(BREAK_TREE)/$(INDEX_NAME).res
384BRK_RES_FILES = $(BRS_SRC:%.txt=$(BRKBLDDIR)/%.res) $(BRK_RES_INDEX_RES)
385BRK_RES_FILES_SHORT = $(BRS_SRC:%.txt=$(BREAK_TREE)/%.res)
386
387RBNF_TREE=rbnf
388RBNF_INDEX_FILE=$(OUTTMPDIR)/$(RBNF_TREE)/$(INDEX_NAME).txt
389RBNF_INDEX_RES=$(RBNFBLDDIR)/$(INDEX_NAME).res
390RBNF_INDEX_RES_SHORT=$(RBNF_TREE)/$(INDEX_NAME).res
391RBNF_FILES = $(RBNF_SRC:%.txt=$(RBNFBLDDIR)/%.res) $(RBNF_INDEX_RES)
392RBNF_FILES_SHORT = $(RBNF_SRC:%.txt=$(RBNF_TREE)/%.res)
393
394TRANSLIT_TREE=translit
395#TRANSLIT_INDEX_FILE=$(OUTTMPDIR)/$(TRANSLIT_TREE)/$(INDEX_NAME).txt
396#TRANSLIT_INDEX_RES=$(TRANSLITBLDDIR)/$(INDEX_NAME).res
397#TRANSLIT_INDEX_RES_SHORT=$(TRANSLIT_TREE)/$(INDEX_NAME).res
398TRANSLIT_FILES = $(TRANSLIT_SRC:%.txt=$(TRANSLITBLDDIR)/%.res)
399TRANSLIT_FILES_SHORT = $(TRANSLIT_SRC:%.txt=$(TRANSLIT_TREE)/%.res)
400
401## SPP files
402-include $(SPREPSRCDIR)/sprepfiles.mk
403-include $(SPREPSRCDIR)/spreplocal.mk
404ALL_SPREP_SOURCE=$(SPREP_SOURCE) $(SPREP_SOURCE_LOCAL)
405SPREP_FILES = $(ALL_SPREP_SOURCE:%.txt=$(BUILDDIR)/%.spp)
406SPREP_FILES_SHORT = $(ALL_SPREP_SOURCE:%.txt=%.spp)
407
408## All generated files
409ALL_FILES = $(DAT_FILES) $(CNV_FILES) $(CNV_FILES_SPECIAL) $(BRK_FILES) $(CTD_FILES) $(RES_FILES) $(INDEX_RES_FILE) $(CURR_FILES) $(LANG_FILES) $(REGION_FILES) $(ZONE_FILES) $(COLLATION_FILES) $(BRK_RES_FILES) $(RBNF_FILES) $(TRANSLIT_FILES) $(SPREP_FILES) $(CFU_FILES)
410ALL_INDEX_SRC_FILES = $(PKGDATA_LIST) $(INDEX_FILE) $(CURR_INDEX_FILE) $(LANG_INDEX_FILE) $(REGION_INDEX_FILE) $(ZONE_INDEX_FILE) $(COLLATION_INDEX_FILE) $(BRK_RES_INDEX_FILE) $(RBNF_INDEX_FILE)
411# a list to use in the .lst files (package-relative)
412COLL_FILES_LIST=$(COLLATION_FILES_SHORT) $(COLLATION_INDEX_RES_SHORT)
413BRK_FILES_LIST=$(BRK_FILES_SHORT) $(CTD_FILES_SHORT) $(BRK_RES_FILES_SHORT) $(BRK_RES_INDEX_RES_SHORT)
414LOCALE_FILES_LIST= $(RES_FILES_SHORT) $(LANG_FILES_SHORT) $(REGION_FILES_SHORT) $(ZONE_FILES_SHORT)
415MISC_FILES_LIST=$(DAT_FILES_SHORT) $(CNV_FILES_SHORT) $(CNV_FILES_SHORT_SPECIAL) $(CURR_FILES_SHORT) $(RBNF_FILES_SHORT) $(RBNF_INDEX_RES_SHORT) $(TRANSLIT_FILES_SHORT) $(SPREP_FILES_SHORT) $(CFU_FILES_SHORT)
416UNI_CORE_DATA=pnames.icu uprops.icu ucase.icu ubidi.icu
417UNI_CORE_TARGET_DATA=$(UNI_CORE_DATA:%=$(BUILDDIR)/%)
418
419ifneq ($(INCLUDE_UNI_CORE_DATA),)
420MISC_FILES_LIST+=$(UNI_CORE_DATA)
421build-local: uni-core-data
422endif
423
424#####################################################
425# General data build rules
426
427## Files to remove for 'make clean'
428CLEANFILES = *~ icupkg.inc
429
430ifeq ($(ICUDATA_SOURCE_ARCHIVE),)
431build-local: build-dir $(SO_VERSION_DATA) $(ALL_FILES) $(PKGDATA_LIST) $(OS390LIST)
432$(PKGDATA_LIST): $(SRCLISTDEPS)
433	@echo "generating $@ (list of data files)"
434	@-$(RMV) $@
435	@for file in $(COLL_FILES_LIST); do \
436	  echo $$file >> $@; \
437	done;
438	@for file in $(BRK_FILES_LIST); do \
439	  echo $$file >> $@; \
440	done;
441	@for file in $(LOCALE_FILES_LIST); do \
442	  echo $$file >> $@; \
443	done;
444	@for file in $(MISC_FILES_LIST); do \
445	  echo $$file >> $@; \
446	done;
447else
448build-local: build-dir $(SO_VERSION_DATA) $(PKGDATA_LIST) $(OS390LIST)
449$(PKGDATA_LIST): $(SRCLISTDEPS) $(ICUDATA_SOURCE_ARCHIVE)
450ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
451	@echo "Unpacking $(ICUDATA_SOURCE_ARCHIVE) and generating $@ (list of data files)"
452	@-$(RMV) $@
453	$(INVOKE) $(TOOLBINDIR)/icupkg -d $(BUILDDIR) --list -x \* $(ICUDATA_SOURCE_ARCHIVE) -o $@
454else
455	@echo "$@" > $@
456endif
457endif
458
459
460$(BUILD_DIRS): build-dir
461
462build-dir:
463	@list='$(BUILD_DIRS)'; \
464	for dir in $$list; do \
465	  if ! test -d $$dir; then \
466	    echo $(MKINSTALLDIRS) $(BUILD_DIRS); \
467	    $(MKINSTALLDIRS) $(BUILD_DIRS); \
468	  fi; \
469	done
470
471# The | is an order-only prerequisite. This helps when the -j option is used,
472# and we don't want the files to be built before the directories are built.
473ifneq ($(filter order-only,$(.FEATURES)),)
474$(ALL_FILES) $(ALL_INDEX_SRC_FILES): | build-dir
475endif
476
477# Now, sections for building each kind of data.
478
479####################################################    DAT
480# DAT FILES
481
482# cnvalias.icu
483$(BUILDDIR)/cnvalias.icu: $(UCMSRCDIR)/convrtrs.txt $(TOOLBINDIR)/gencnval$(TOOLEXEEXT)
484	$(INVOKE) $(TOOLBINDIR)/gencnval -d $(BUILDDIR) $(UCMSRCDIR)/convrtrs.txt
485
486# Targets for prebuilt Unicode data
487$(BUILDDIR)/%.icu: $(SRCDATADIR)/in/%.icu
488	$(INVOKE) $(TOOLBINDIR)/icupkg -t$(ICUDATA_CHAR) $< $@
489
490$(BUILDDIR)/%.nrm: $(SRCDATADIR)/in/%.nrm
491	$(INVOKE) $(TOOLBINDIR)/icupkg -t$(ICUDATA_CHAR) $< $@
492
493$(BUILDDIR)/coll/%.icu: $(SRCDATADIR)/in/coll/%.icu
494	$(INVOKE) $(TOOLBINDIR)/icupkg -t$(ICUDATA_CHAR) $< $@
495
496####################################################    SPP
497# SPP FILES
498
499$(BUILDDIR)/%.spp: $(SPREPSRCDIR)/%.txt $(TOOLBINDIR)/gensprep$(TOOLEXEEXT) $(BUILDDIR)/unames.icu
500	$(INVOKE) $(TOOLBINDIR)/gensprep -d $(BUILDDIR) -i $(BUILDDIR) -s $(SPREPSRCDIR) -b $(@F:%.spp=%) -m $(UNICODEDATADIR) -u 3.2.0 $(<F)
501
502####################################################    BRK
503# BRK FILES
504
505#thaidict.brk: $(SRCDATADIR)/thaidict.brk
506#	$(RMV) $@ && ln -s $(BUILDDIR) $@
507
508#khmerdict.brk: $(SRCDATADIR)/khmerdict.brk
509#	$(RMV) $@ && ln -s $(BUILDDIR) $@
510
511$(BRKBLDDIR)/%.brk: $(BRKSRCDIR)/%.txt $(TOOLBINDIR)/genbrk$(TOOLEXEEXT) $(DAT_FILES)
512	$(INVOKE) $(TOOLBINDIR)/genbrk -c -i $(BUILDDIR) -r $< -o $@
513
514####################################################    CTD
515# CTD FILES
516
517$(BRKBLDDIR)/%.ctd: $(BRKSRCDIR)/%.txt $(TOOLBINDIR)/genctd$(TOOLEXEEXT) $(DAT_FILES)
518	$(INVOKE) $(TOOLBINDIR)/genctd -c -i $(BUILDDIR) -o $@ $<
519
520####################################################    CFU
521# CFU FILES
522#    Note: gencfu requires two input files to produce a single output file.
523#          There will be exactly one target file and two source files.
524#          The $(word n, ...) selects the nth word from the following stuff.
525#          There must be a nicer way to do this.
526
527$(CFU_FILES): $(ALL_CFU_SOURCE) $(TOOLBINDIR)/gencfu$(TOOLEXEEXT) $(DAT_FILES)
528	$(INVOKE) echo ALL_CFU_SOURCE: $(ALL_CFU_SOURCE)
529	$(INVOKE) echo CFU_FILES: $(CFU_FILES)
530	$(INVOKE) echo CFU_FILES_SHORT: $(CFU_FILES_SHORT)
531	$(INVOKE) $(TOOLBINDIR)/gencfu -c -i $(BUILDDIR) -r $(word 1,$(ALL_CFU_SOURCE)) -w $(word 2,$(ALL_CFU_SOURCE)) -o $@
532
533
534####################################################    CNV
535# CNV FILES
536$(CNV_FILES_SPECIAL) : $(UCM_FILES_SPECIAL) $(TOOLBINDIR)/makeconv$(TOOLEXEEXT)
537	$(INVOKE) $(TOOLBINDIR)/makeconv --ignore-siso-check -c -d $(BUILDDIR) $(UCMSRCDIR)/$(@F:%.cnv=%.ucm)
538# BEGIN android-changed
539$(BUILDDIR)/%.cnv: $(UCMSRCDIR)/%.ucm $(TOOLBINDIR)/makeconv$(TOOLEXEEXT)
540	$(INVOKE) $(TOOLBINDIR)/makeconv -c --small -d $(BUILDDIR) $(UCMSRCDIR)/$(<F)
541#END android-changed
542
543####################################################    RES
544# RES FILES
545
546### curr res
547$(CURRBLDDIR)/%.res: $(CURRSRCDIR)/%.txt  $(TOOLBINDIR)/genrb$(TOOLEXEEXT) $(DAT_FILES)
548	$(INVOKE) $(TOOLBINDIR)/genrb --usePoolBundle $(GENRBOPTS) -i $(BUILDDIR) -s $(CURRSRCDIR) -d $(CURRBLDDIR) $(<F)
549
550# copy the curr/pool.res file from the source folder to the build output folder
551# and swap it to native endianness
552$(CURRBLDDIR)/pool.res: $(CURRSRCDIR)/pool.res
553	$(INVOKE) $(TOOLBINDIR)/icupkg -t$(ICUDATA_CHAR) $(CURRSRCDIR)/pool.res $(CURRBLDDIR)/pool.res
554
555$(CURRBLDDIR)/$(INDEX_NAME).res: $(OUTTMPDIR)/$(CURR_TREE)/$(INDEX_NAME).txt $(TOOLBINDIR)/genrb$(TOOLEXEEXT)
556	$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -i $(BUILDDIR) -s $(OUTTMPDIR)/$(CURR_TREE) -d $(CURRBLDDIR) $(INDEX_NAME).txt
557
558$(CURR_INDEX_FILE): $(SRCLISTDEPS)
559	@echo "generating $@ (list of installed currency name locales)"; \
560	$(RMV) $@; \
561	echo "// Warning this file is automatically generated" > $@; \
562	echo "$(INDEX_NAME):table(nofallback) {" >> $@; \
563	echo "    InstalledLocales {" >> $@; \
564	for file in $(INSTALLED_CURR_FILES); do \
565	  echo "        $$file {\"\"}" >> $@; \
566	done; \
567	echo "    }" >> $@; \
568	echo "}" >> $@;
569
570### lang res
571$(LANGBLDDIR)/%.res: $(LANGSRCDIR)/%.txt  $(TOOLBINDIR)/genrb$(TOOLEXEEXT) $(DAT_FILES)
572	$(INVOKE) $(TOOLBINDIR)/genrb --usePoolBundle $(GENRBOPTS) -i $(BUILDDIR) -s $(LANGSRCDIR) -d $(LANGBLDDIR) $(<F)
573
574# copy the lang/pool.res file from the source folder to the build output folder
575# and swap it to native endianness
576$(LANGBLDDIR)/pool.res: $(LANGSRCDIR)/pool.res
577	$(INVOKE) $(TOOLBINDIR)/icupkg -t$(ICUDATA_CHAR) $(LANGSRCDIR)/pool.res $(LANGBLDDIR)/pool.res
578
579$(LANGBLDDIR)/$(INDEX_NAME).res: $(OUTTMPDIR)/$(LANG_TREE)/$(INDEX_NAME).txt $(TOOLBINDIR)/genrb$(TOOLEXEEXT)
580	$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -i $(BUILDDIR) -s $(OUTTMPDIR)/$(LANG_TREE) -d $(LANGBLDDIR) $(INDEX_NAME).txt
581
582$(LANG_INDEX_FILE): $(SRCLISTDEPS)
583	@echo "generating $@ (list of installed language name locales)"; \
584	$(RMV) $@; \
585	echo "// Warning this file is automatically generated" > $@; \
586	echo "$(INDEX_NAME):table(nofallback) {" >> $@; \
587	echo "    InstalledLocales {" >> $@; \
588	for file in $(INSTALLED_LANG_FILES); do \
589	  echo "        $$file {\"\"}" >> $@; \
590	done; \
591	echo "    }" >> $@; \
592	echo "}" >> $@;
593
594### region res
595$(REGIONBLDDIR)/%.res: $(REGIONSRCDIR)/%.txt  $(TOOLBINDIR)/genrb$(TOOLEXEEXT) $(DAT_FILES)
596	$(INVOKE) $(TOOLBINDIR)/genrb --usePoolBundle $(GENRBOPTS) -i $(BUILDDIR) -s $(REGIONSRCDIR) -d $(REGIONBLDDIR) $(<F)
597
598# copy the region/pool.res file from the source folder to the build output folder
599# and swap it to native endianness
600$(REGIONBLDDIR)/pool.res: $(REGIONSRCDIR)/pool.res
601	$(INVOKE) $(TOOLBINDIR)/icupkg -t$(ICUDATA_CHAR) $(REGIONSRCDIR)/pool.res $(REGIONBLDDIR)/pool.res
602
603$(REGIONBLDDIR)/$(INDEX_NAME).res: $(OUTTMPDIR)/$(REGION_TREE)/$(INDEX_NAME).txt $(TOOLBINDIR)/genrb$(TOOLEXEEXT)
604	$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -i $(BUILDDIR) -s $(OUTTMPDIR)/$(REGION_TREE) -d $(REGIONBLDDIR) $(INDEX_NAME).txt
605
606$(REGION_INDEX_FILE): $(SRCLISTDEPS)
607	@echo "generating $@ (list of installed region name locales)"; \
608	$(RMV) $@; \
609	echo "// Warning this file is automatically generated" > $@; \
610	echo "$(INDEX_NAME):table(nofallback) {" >> $@; \
611	echo "    InstalledLocales {" >> $@; \
612	for file in $(INSTALLED_REGION_FILES); do \
613	  echo "        $$file {\"\"}" >> $@; \
614	done; \
615	echo "    }" >> $@; \
616	echo "}" >> $@;
617
618### zone res
619$(ZONEBLDDIR)/%.res: $(ZONESRCDIR)/%.txt  $(TOOLBINDIR)/genrb$(TOOLEXEEXT) $(DAT_FILES)
620	$(INVOKE) $(TOOLBINDIR)/genrb --usePoolBundle $(GENRBOPTS) -i $(BUILDDIR) -s $(ZONESRCDIR) -d $(ZONEBLDDIR) $(<F)
621
622# copy the zone/pool.res file from the source folder to the build output folder
623# and swap it to native endianness
624$(ZONEBLDDIR)/pool.res: $(ZONESRCDIR)/pool.res
625	$(INVOKE) $(TOOLBINDIR)/icupkg -t$(ICUDATA_CHAR) $(ZONESRCDIR)/pool.res $(ZONEBLDDIR)/pool.res
626
627$(ZONEBLDDIR)/$(INDEX_NAME).res: $(OUTTMPDIR)/$(ZONE_TREE)/$(INDEX_NAME).txt $(TOOLBINDIR)/genrb$(TOOLEXEEXT)
628	$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -i $(BUILDDIR) -s $(OUTTMPDIR)/$(ZONE_TREE) -d $(ZONEBLDDIR) $(INDEX_NAME).txt
629
630$(ZONE_INDEX_FILE): $(SRCLISTDEPS)
631	@echo "generating $@ (list of installed time zone name locales)"; \
632	$(RMV) $@; \
633	echo "// Warning this file is automatically generated" > $@; \
634	echo "$(INDEX_NAME):table(nofallback) {" >> $@; \
635	echo "    InstalledLocales {" >> $@; \
636	for file in $(INSTALLED_ZONE_FILES); do \
637	  echo "        $$file {\"\"}" >> $@; \
638	done; \
639	echo "    }" >> $@; \
640	echo "}" >> $@;
641
642### collation res
643# BEGIN android-changed
644$(COLBLDDIR)/%.res: $(COLSRCDIR)/%.txt  $(TOOLBINDIR)/genrb$(TOOLEXEEXT) $(DAT_FILES)
645	$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -i $(BUILDDIR) -s $(COLSRCDIR) -d $(COLBLDDIR) -R $(<F)
646
647$(COLBLDDIR)/$(INDEX_NAME).res: $(OUTTMPDIR)/$(COLLATION_TREE)/$(INDEX_NAME).txt $(TOOLBINDIR)/genrb$(TOOLEXEEXT)
648	$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -i $(BUILDDIR) -s $(OUTTMPDIR)/$(COLLATION_TREE) -d $(COLBLDDIR) -R $(INDEX_NAME).txt
649#END android-changed
650
651$(COLLATION_INDEX_FILE): $(SRCLISTDEPS)
652	@echo "generating $@ (list of installed collation locales)"; \
653	$(RMV) $@; \
654	echo "// Warning this file is automatically generated" > $@; \
655	echo "$(INDEX_NAME):table(nofallback) {" >> $@; \
656	echo "    InstalledLocales {" >> $@; \
657	for file in $(INSTALLED_COL_FILES); do \
658	  echo "        $$file {\"\"}" >> $@; \
659	done; \
660	echo "    }" >> $@; \
661	echo "}" >> $@;
662
663### brk res
664$(BRKBLDDIR)/%.res: $(BRKSRCDIR)/%.txt $(TOOLBINDIR)/genrb$(TOOLEXEEXT) $(BRK_FILES) $(DAT_FILES)
665	$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -i $(BUILDDIR) -s $(BRKSRCDIR) -d $(BRKBLDDIR) $(<F)
666
667$(BRKBLDDIR)/$(INDEX_NAME).res: $(OUTTMPDIR)/$(BREAK_TREE)/$(INDEX_NAME).txt $(TOOLBINDIR)/genrb$(TOOLEXEEXT)
668	$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -i $(BUILDDIR) -s $(OUTTMPDIR)/$(BREAK_TREE) -d $(BRKBLDDIR) $(INDEX_NAME).txt
669
670$(BRK_RES_INDEX_FILE): $(SRCLISTDEPS)
671	@echo "generating $@ (list of installed break locales)"; \
672	$(RMV) $@; \
673	echo "// Warning this file is automatically generated" > $@; \
674	echo "$(INDEX_NAME):table(nofallback) {" >> $@; \
675	echo "    InstalledLocales {" >> $@; \
676	for file in $(INSTALLED_BRS_FILES); do \
677	  echo "        $$file {\"\"}" >> $@; \
678	done; \
679	echo "    }" >> $@; \
680	echo "}" >> $@;
681
682### RBNF res
683$(RBNFBLDDIR)/%.res: $(RBNFSRCDIR)/%.txt  $(TOOLBINDIR)/genrb$(TOOLEXEEXT) $(DAT_FILES)
684	$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -i $(BUILDDIR) -s $(RBNFSRCDIR) -d $(RBNFBLDDIR) $(<F)
685
686$(RBNFBLDDIR)/$(INDEX_NAME).res: $(OUTTMPDIR)/$(RBNF_TREE)/$(INDEX_NAME).txt $(TOOLBINDIR)/genrb$(TOOLEXEEXT)
687	$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -i $(BUILDDIR) -s $(OUTTMPDIR)/$(RBNF_TREE) -d $(RBNFBLDDIR) $(INDEX_NAME).txt
688
689$(RBNF_INDEX_FILE): $(SRCLISTDEPS)
690	@echo "generating $@ (list of installed RBNF locales)"; \
691	$(RMV) $@; \
692	echo "// Warning this file is automatically generated" > $@; \
693	echo "$(INDEX_NAME):table(nofallback) {" >> $@; \
694	echo "    InstalledLocales {" >> $@; \
695	for file in $(INSTALLED_RBNF_FILES); do \
696	  echo "        $$file {\"\"}" >> $@; \
697	done; \
698	echo "    }" >> $@; \
699	echo "}" >> $@;
700
701### TRANSLIT res
702$(TRANSLITBLDDIR)/%.res: $(TRANSLITSRCDIR)/%.txt  $(TOOLBINDIR)/genrb$(TOOLEXEEXT) $(DAT_FILES)
703	$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -i $(BUILDDIR) -s $(TRANSLITSRCDIR) -d $(TRANSLITBLDDIR) $(<F)
704
705### normal (locale) res
706all-RES:  $(RES_FILES)
707
708$(BUILDDIR)/%.res: $(LOCSRCDIR)/%.txt $(TOOLBINDIR)/genrb$(TOOLEXEEXT) $(DAT_FILES)
709	$(INVOKE) $(TOOLBINDIR)/genrb --usePoolBundle $(GENRBOPTS) -i $(BUILDDIR) -s $(LOCSRCDIR) -d $(BUILDDIR) $(<F)
710
711# copy the locales/pool.res file from the source folder to the build output folder
712# and swap it to native endianness
713$(BUILDDIR)/pool.res: $(LOCSRCDIR)/pool.res
714	$(INVOKE) $(TOOLBINDIR)/icupkg -t$(ICUDATA_CHAR) $(LOCSRCDIR)/pool.res $(BUILDDIR)/pool.res
715
716# if the tzcode directory contains a new tzdata*.tar.gz file, use it for zoneinfo
717ifeq ($(TZDATA),)
718TZDATA = $(firstword $(wildcard $(top_builddir)/tools/tzcode/tzdata*.tar.gz) $(wildcard $(top_srcdir)/tools/tzcode/tzdata*.tar.gz))
719endif
720
721ifneq ($(TZDATA),)
722
723TZCODE_DIR=$(top_builddir)/tools/tzcode
724ZONEINFO=$(TZCODE_DIR)/zoneinfo64.txt
725
726# Override the normal genrb for zoneinfo to always pull from
727# icu/source/tools/tzcode/zoneinfo64.txt
728$(BUILDDIR)/zoneinfo64.res: $(ZONEINFO) $(TOOLBINDIR)/genrb$(TOOLEXEEXT)
729	@echo Note: $(MISCSRCDIR)/zoneinfo.txt is IGNORED because $(TZDATA) is present.
730	$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -q -i $(BUILDDIR) -d $(BUILDDIR) $(ZONEINFO)
731
732# Create the tzcode tool and zoneinfo as needed.
733$(ZONEINFO): $(TZDATA)
734	@echo "$(MAKE)[$(MAKELEVEL)]: Making \`$(ZONEINFO)' in \`$(TZCODE_DIR)'"; \
735	(cd $(TZCODE_DIR) && $(MAKE)) || exit; \
736
737# end of zoneinfo-generation
738endif
739
740# zoneinfo has some issues. Ignore some warnings with -q
741$(BUILDDIR)/%.res: $(MISCSRCDIR)/%.txt $(TOOLBINDIR)/genrb$(TOOLEXEEXT)
742	$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -q -i $(BUILDDIR) -s $(MISCSRCDIR) -d $(BUILDDIR) $(<F)
743
744
745
746$(INDEX_FILE): $(SRCLISTDEPS)
747	@echo "generating $@ (list of installed locales)"; \
748	$(RMV) $@; \
749	echo "// Warning this file is automatically generated" > $@; \
750	echo "$(INDEX_NAME):table(nofallback) {" >> $@; \
751        echo "    CLDRVersion { \"$(GENRB_CLDR_VERSION)\" }" >> $@; \
752	echo "    InstalledLocales {" >> $@; \
753	for file in $(INSTALLED_RB_FILES); do \
754	  echo "        $$file {\"\"}" >> $@; \
755	done; \
756	echo "    }" >> $@; \
757	echo "}" >> $@;
758
759clean-resindex:
760	-$(RMV) $(BUILDDIR)/$(INDEX_NAME).txt $(PKGDATA_LIST)
761
762$(BUILDDIR)/$(INDEX_NAME).res: $(INDEX_FILE) $(TOOLBINDIR)/genrb$(TOOLEXEEXT)
763	$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -i $(BUILDDIR) -d $(BUILDDIR) $(INDEX_FILE)
764
765# The core Unicode properties files (pnames.icu, uprops.icu, ucase.icu, ubidi.icu)
766# are hardcoded in the common DLL and therefore not included in the data package any more.
767# They are not built by default but need to be built for ICU4J data and for getting the .c source files
768# when updating the Unicode data.
769uni-core-data: build-dir $(UNI_CORE_TARGET_DATA)
770	@echo Unicode .icu files built to $(BUILDDIR)
771
772# Build the ICU4J icudata.jar.
773# Command line:
774#   (Run this from the output data folder which may not be .../source/data in an out-of-source build.)
775#   ~/svn.icu/trunk/source/data> make JAR=jar ICU4J_ROOT=~/svn.icu4j/trunk icudata.jar
776# You can omit the ICU4J_ROOT for just building the .jar files without copying them.
777# You can omit the JAR if it's just jar.
778JAR=jar
779
780# For building the testdata.jar see ../test/testdata/Makefile.
781
782# Build icudata.jar:
783# - add the uni-core-data to the ICU package
784# - swap the ICU data
785# - extract all data items
786# - package them into the .jar file
787$(OUTDIR)/icu4j/icudata.jar: build-dir packagedata $(OUTTMPDIR)/$(ICUDATA_PLATFORM_NAME).dat uni-core-data
788	mkdir -p $(OUTDIR)/icu4j/com/ibm/icu/impl/data/$(ICUDATA_BASENAME_VERSION)b
789	echo pnames.icu ubidi.icu ucase.icu uprops.icu > $(OUTDIR)/icu4j/add.txt
790	$(INVOKE) $(TOOLBINDIR)/icupkg $(OUTTMPDIR)/$(ICUDATA_PLATFORM_NAME).dat $(OUTDIR)/icu4j/$(ICUDATA_BASENAME_VERSION)b.dat -a $(OUTDIR)/icu4j/add.txt -s $(BUILDDIR) -x '*' -tb -d $(OUTDIR)/icu4j/com/ibm/icu/impl/data/$(ICUDATA_BASENAME_VERSION)b
791	$(JAR) cf $(OUTDIR)/icu4j/icudata.jar -C $(OUTDIR)/icu4j com/ibm/icu/impl/data/$(ICUDATA_BASENAME_VERSION)b
792
793ICU4J_DATA=$(OUTDIR)/icu4j/icudata.jar
794
795ifdef ICU4J_ROOT
796
797ICU4J_DATA_INSTALLED=$(ICU4J_ROOT)/main/shared/data/icudata.jar
798
799$(ICU4J_ROOT)/main/shared/data/icudata.jar: $(OUTDIR)/icu4j/icudata.jar
800	mkdir -p $(ICU4J_ROOT)/main/shared/data
801	cp $(OUTDIR)/icu4j/icudata.jar $(ICU4J_ROOT)/main/shared/data
802
803icu4j-data-install: $(ICU4J_DATA_INSTALLED)
804
805else
806
807icu4j-data-install: icu4j-data
808	@echo data is built into $(OUTDIR)/icu4j
809	@echo '** Error:' ICU4J_ROOT was not set, could not install
810	exit 1
811
812endif
813
814icu4j-data: $(ICU4J_DATA)
815
816
817###################################################################
818Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
819	cd $(top_builddir) \
820	&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
821
822icupkg.inc: pkgdataMakefile
823	$(MAKE) -f pkgdataMakefile
824
825pkgdataMakefile:
826	cd $(top_builddir) \
827	&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
828
829###########
830########### 390 (z/OS) support
831UCMFILES390=ebcdic-xml-us.ucm ibm-37_P100-1995.ucm ibm-1047_P100-1995.ucm ibm-4909_P100-1999.ucm
832# used to depend on pnames.icu uprops.icu ucase.icu ubidi.icu
833# These are now hardcoded in ICU4C and only loaded in ICU4J.
834ALLFILES390=cnvalias.icu $(UCMFILES390:.ucm=.cnv)
835
836$(OUTTMPDIR)/icudata390.lst: $(SRCLISTDEPS)
837	@echo "generating $@ (list of 390 data files)"
838	@-$(RMV) $@
839	@for file in $(ALLFILES390); do \
840	  echo $$file >> $@; \
841	done;
842
843ifeq ($(POST_DATA_BUILD), os400-data-rebind)
844os400-data-rebind: $(LIBICUUC)
845
846$(LIBICUUC): $(LIBICUDT)
847	$(RMV) $(LIBICUUC)
848	(cd ../common && $(MAKE) RECURSIVE=YES) || exit;
849endif
850
851