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