1# Copyright (C) 2016 and later: Unicode, Inc. and others.
2# License & terms of use: http://www.unicode.org/copyright.html
3#**********************************************************************
4#* Copyright (C) 1999-2016, International Business Machines Corporation
5#* and others.  All Rights Reserved.
6#**********************************************************************
7# nmake file for creating data files on win32
8# invoke with
9# nmake /f makedata.mak icumake=$(ProjectDir)
10#
11#	12/10/1999	weiv	Created
12
13##############################################################################
14# Keep the following in sync with the version - see common/unicode/uvernum.h
15U_ICUDATA_NAME=icudt68
16##############################################################################
17!IF "$(UWP)" == "UWP"
18# Optionally change the name of the data file for the UWP version.
19U_ICUDATA_NAME=icudt68
20!ENDIF
21U_ICUDATA_ENDIAN_SUFFIX=l
22UNICODE_VERSION=13.0
23ICU_LIB_TARGET=$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll
24
25#  ICUMAKE
26#     Must be provided by whoever runs this makefile.
27#     Is the directory containing this file (makedata.mak)
28#     Is the directory into which most data is built (prior to packaging)
29#     Is icu\source\data\
30#
31!IF "$(ICUMAKE)"==""
32!ERROR Can't find ICUMAKE (ICU Data Make dir, should point to icu\source\data\ )!
33!ENDIF
34!MESSAGE ICU data make path is $(ICUMAKE)
35
36!IF [py -3 -c "exit(0)"]!=0
37!MESSAGE Information: Unable to find Python 3. Data will fail to build from source.
38!ENDIF
39
40# Suffixes for data files
41.SUFFIXES : .nrm .icu .ucm .cnv .dll .dat .res .txt .c
42
43ICUOUT=$(ICUMAKE)\out
44
45#  the prefix "icudt62_" for use in filenames
46ICUPKG=$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX)
47
48# need to nuke \\ for .NET...
49ICUOUT=$(ICUOUT:\\=\)
50
51ICUBLD=$(ICUOUT)\build
52ICUBLD_PKG=$(ICUBLD)\$(ICUPKG)
53ICUTMP=$(ICUOUT)\tmp
54
55#  ICUP
56#     The root of the ICU source directory tree
57#
58ICUP=$(ICUMAKE)\..\..
59ICUP=$(ICUP:\source\data\..\..=)
60# In case the first one didn't do it, try this one.  .NET would do the second one.
61ICUP=$(ICUP:\source\data\\..\..=)
62!MESSAGE ICU root path is $(ICUP)
63
64
65#  ICUSRCDATA
66#       The data directory in source
67#
68ICUSRCDATA=$(ICUP)\source\data
69ICUSRCDATA_RELATIVE_PATH=..\..\..
70
71# Timestamp files to keep track of current build state
72TOOLS_TS=$(ICUTMP)\tools.timestamp
73COREDATA_TS=$(ICUTMP)\coredata.timestamp
74ARM_CROSSBUILD_TS=
75
76#  ICUCOL
77#       The directory that contains colfiles.mk files along with *.txt collation data files
78#
79ICUCOL=coll
80
81#  ICURBNF
82#       The directory that contains rbnffiles.mk files along with *.txt RBNF data files
83#
84ICURBNF=rbnf
85
86#  ICUTRNS
87#       The directory that contains trfiles.mk files along with *.txt transliterator files
88#
89ICUTRNS=translit
90
91#  ICUBRK
92#       The directory that contains resfiles.mk files along with *.txt break iterator files
93#
94ICUBRK=brkitr
95
96#
97#  ICUDATA
98#     The source directory.  Contains the source files for the common data to be built.
99#     WARNING:  NOT THE SAME AS ICU_DATA environment variable.  Confusing.
100ICUDATA=$(ICUP)\source\data
101
102#
103#  DLL_OUTPUT
104#      Destination directory for the common data DLL file.
105#      This is the same place that all of the other ICU DLLs go (the code-containing DLLs)
106#      The lib file for the data DLL goes in $(DLL_OUTPUT)/../lib/
107#
108!IF "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM\Debug"
109DLL_OUTPUT=$(ICUP)\binARM$(UWP)
110!ELSE IF "$(CFG)" == "ARM64\Release" || "$(CFG)" == "ARM64\Debug"
111DLL_OUTPUT=$(ICUP)\binARM64$(UWP)
112!ELSE IF "$(CFG)" == "x64\Release" || "$(CFG)" == "x64\Debug"
113DLL_OUTPUT=$(ICUP)\bin64$(UWP)
114!ELSE IF "$(UWP)" == "UWP"
115DLL_OUTPUT=$(ICUP)\bin32$(UWP)
116!ELSE
117DLL_OUTPUT=$(ICUP)\bin$(UWP)
118!ENDIF
119!MESSAGE ICU data DLL_OUTPUT path is $(DLL_OUTPUT)
120
121#
122#  TESTDATA
123#     The source directory for data needed for test programs.
124TESTDATA=$(ICUP)\source\test\testdata
125
126#
127#   TESTDATAOUT
128#      The destination directory for the built test data .dat file
129TESTDATAOUT=$(ICUP)\source\test\testdata\out
130
131#
132#   TESTDATABLD
133#		The build directory for test data intermediate files
134#		(Tests are NOT run from this makefile,
135#         only the data is put in place.)
136TESTDATABLD=$(ICUP)\source\test\testdata\out\build
137
138#
139#   ICUTOOLS
140#       Directory under which all of the ICU data building tools live.
141#
142ICUTOOLS=$(ICUP)\source\tools
143!MESSAGE ICU tools path is $(ICUTOOLS)
144
145#   ARM_CROSS_BUILD
146#       In order to support cross-compiling for ARM/ARM64 using the x64 tools
147#       we need to know if we're building the ARM/ARM64 data DLL, otherwise
148#       the existence of the x64 bits will cause us to think we are already done.
149#    Note: This is only for the "regular" builds, the UWP builds have a separate project file entirely.
150ARM_CROSS_BUILD=
151!IF "$(UWP)" == ""
152!IF "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM\Debug"
153ARM_CROSS_BUILD=ARM
154ARM_CROSSBUILD_TS=$(ICUTMP)\$(ARM_CROSS_BUILD).timestamp
155!ELSE IF "$(CFG)" == "ARM64\Release"  || "$(CFG)" == "ARM64\Debug"
156ARM_CROSS_BUILD=ARM64
157ARM_CROSSBUILD_TS=$(ICUTMP)\$(ARM_CROSS_BUILD).timestamp
158!ENDIF
159!ENDIF
160
161#
162#  TOOLS CFG PATH
163#      Generally the tools want to run on the same architecture as is being built.
164#      Thus ARM and ARM64 need to use another build of the other tools, so make sure to get an usable CFG path.
165#      Since tools, particularly pkggen, have architecture built-in, we made x64 on
166#      Windows be machine-independent and use those tools for both ARM and ARM64.
167#      Note: If we're building ARM/ARM64 Debug, then we'll use the x64 Debug tools.
168#      If we're building ARM/ARM64 Release, then we'll use the x64 Release tools.
169#
170!IF "$(ARM_CROSS_BUILD)" == ""
171CFGTOOLS=$(CFG)
172!ELSE
173!IF "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM64\Release"
174CFGTOOLS=x64\Release
175!ENDIF
176!IF "$(CFG)" == "ARM\Debug" || "$(CFG)" == "ARM64\Debug"
177CFGTOOLS=x64\Debug
178!ENDIF
179!ENDIF
180!MESSAGE ICU tools CFG subpath is $(CFGTOOLS)
181
182
183# The current ICU tools need to be in the path first.
184# x86 uses x86; x64, arm, and arm64 use x64
185!IF "$(CFG)" == "x86\Release" || "$(CFG)" == "x86\Debug"
186PATH = $(ICUP)\bin;$(PATH)
187ICUPBIN=$(ICUP)\bin
188!ELSE
189PATH = $(ICUP)\bin64;$(PATH)
190ICUPBIN=$(ICUP)\bin64
191!ENDIF
192
193
194# This variable can be overridden to "-m static" by the project settings,
195# if you want a static data library.
196!IF "$(ICU_PACKAGE_MODE)"==""
197ICU_PACKAGE_MODE=-m dll
198!ENDIF
199
200# If this archive exists, build from that
201# instead of building everything from scratch.
202ICUDATA_SOURCE_ARCHIVE=$(ICUSRCDATA)\in\$(ICUPKG).dat
203!IF !EXISTS("$(ICUDATA_SOURCE_ARCHIVE)")
204# Does a big endian version exist either?
205ICUDATA_ARCHIVE=$(ICUSRCDATA)\in\$(U_ICUDATA_NAME)b.dat
206!IF EXISTS("$(ICUDATA_ARCHIVE)")
207ICUDATA_SOURCE_ARCHIVE=$(ICUTMP)\$(ICUPKG).dat
208!ELSE
209# Nothing was usable for input
210!UNDEF ICUDATA_SOURCE_ARCHIVE
211!ENDIF
212!ENDIF
213
214!IFDEF ICUDATA_SOURCE_ARCHIVE
215!MESSAGE ICU data source archive is $(ICUDATA_SOURCE_ARCHIVE)
216!ENDIF
217
218# Common defines for both ways of building ICU's data library.
219COMMON_ICUDATA_DEPENDENCIES="$(ICUPBIN)\pkgdata.exe" "$(ICUTMP)\icudata.res" "$(ICUP)\source\stubdata\stubdatabuilt.txt"
220COMMON_ICUDATA_ARGUMENTS=-f -e $(U_ICUDATA_NAME) -v $(ICU_PACKAGE_MODE) -c -p $(ICUPKG) -T "$(ICUTMP)" -L $(U_ICUDATA_NAME) -d "$(ICUBLD_PKG)" -s .
221!IF "$(UWP)" == "UWP"
222COMMON_ICUDATA_ARGUMENTS=$(COMMON_ICUDATA_ARGUMENTS) -u
223!ENDIF
224!IF "$(CFG)" == "x64\Release" || "$(CFG)" == "x64\Debug"
225COMMON_ICUDATA_ARGUMENTS=$(COMMON_ICUDATA_ARGUMENTS) -a X64
226!ENDIF
227!IF "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM\Debug"
228COMMON_ICUDATA_ARGUMENTS=$(COMMON_ICUDATA_ARGUMENTS) -a ARM
229!ENDIF
230!IF "$(CFG)" == "ARM64\Release" || "$(CFG)" == "ARM64\Debug"
231COMMON_ICUDATA_ARGUMENTS=$(COMMON_ICUDATA_ARGUMENTS) -a ARM64
232!ENDIF
233
234#############################################################################
235#
236# ALL
237#     This target builds all the data files.  The world starts here.
238#			Note: we really want the common data dll to go to $(DLL_OUTPUT), not $(ICUBLD_PKG).  But specifying
239#				that here seems to cause confusion with the building of the stub library of the same name.
240#				Building the common dll in $(ICUBLD_PKG) unconditionally copies it to $(DLL_OUTPUT) too.
241#
242#############################################################################
243!IF "$(ARM_CROSS_BUILD)" == ""
244ALL : GODATA "$(ICU_LIB_TARGET)" "$(TESTDATAOUT)\testdata.dat"
245	@echo All targets are up to date
246
247!IF "$(UWP)" == "UWP"
248	@if not exist "$(ICUMAKE)\..\..\commondata\" mkdir "$(ICUMAKE)\..\..\commondata\"
249    copy "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat" "$(ICUMAKE)\..\..\commondata\"
250!ENDIF
251
252!ELSE
253ALL : GODATA "$(ICU_LIB_TARGET)" "$(TESTDATAOUT)\testdata.dat" $(ARM_CROSSBUILD_TS)
254	@echo All targets are up to date
255
256!ENDIF
257
258# Verbose output when building the data for Debug builds.
259!IF "$(DEBUG)" == "true"
260ICU_DATA_BUILD_VERBOSE=--verbose
261!ELSE
262ICU_DATA_BUILD_VERBOSE=
263!ENDIF
264
265# Three main targets: tools, core data, and test data.
266# Keep track of whether they are built via timestamp files.
267
268$(TOOLS_TS): "$(ICUTOOLS)\genrb\$(CFGTOOLS)\genrb.exe" "$(ICUTOOLS)\gencnval\$(CFGTOOLS)\gencnval.exe" "$(ICUTOOLS)\gencfu\$(CFGTOOLS)\gencfu.exe" "$(ICUTOOLS)\icupkg\$(CFGTOOLS)\icupkg.exe" "$(ICUTOOLS)\makeconv\$(CFGTOOLS)\makeconv.exe" "$(ICUPBIN)\pkgdata.exe"
269	@echo "timestamp" > $(TOOLS_TS)
270
271# On Unix, Python generates at configure time a list of Makefile rules.
272# On Windows, however, we run the Python data build script at build time instead.
273# The alternative would be to use a preprocessor macro to generate rules for nmake.
274# However, this approach was abandoned for reasons including:
275#
276#  - nmake imposes more stringent restrictions on command line length.
277#  - The lack of gnumake features makes nmake file construction more complex.
278#  - Windows builds are single-threaded, giving less advantage to a Makefile approach.
279#
280# Currently, the entire script needs to run even for small changes to data. Maybe consider
281# checking file-changed timestamps in Python to build only the required subset of data.
282
283$(COREDATA_TS):
284	@cd "$(ICUSRCDATA)"
285	set PYTHONPATH=$(ICUP)\source\python;%PYTHONPATH%
286	py -3 -B -m icutools.databuilder \
287		--mode windows-exec \
288		--src_dir "$(ICUSRCDATA)" \
289		--tool_dir "$(ICUTOOLS)" \
290		--tool_cfg "$(CFGTOOLS)" \
291		--out_dir "$(ICUBLD_PKG)" \
292		--tmp_dir "$(ICUTMP)" \
293		--filter_file "$(ICU_DATA_FILTER_FILE)" \
294		$(ICU_DATA_BUILD_VERBOSE) \
295		$(ICU_DATA_BUILDTOOL_OPTS)
296	@echo "timestamp" > $(COREDATA_TS)
297
298
299# The core Unicode properties files (uprops.icu, ucase.icu, ubidi.icu)
300# are hardcoded in the common DLL and therefore not included in the data package any more.
301# They are not built by default but need to be built for ICU4J data and for getting the .c source files
302# when updating the Unicode data.
303# Changed in makedata.mak revision 1.117. See Jitterbug 4497.
304# 2010-dec Removed pnames.icu.
305# Command line:
306#   C:\svn\icuproj\icu\trunk\source\data>nmake -f makedata.mak ICUMAKE=C:\svn\icuproj\icu\trunk\source\data\ CFG=x86\Debug uni-core-data
307uni-core-data: GODATA "$(ICUBLD_PKG)\pnames.icu" "$(ICUBLD_PKG)\uprops.icu" "$(ICUBLD_PKG)\ucase.icu" "$(ICUBLD_PKG)\ubidi.icu" "$(ICUBLD_PKG)\nfc.nrm"
308	@echo Unicode .icu files built to "$(ICUBLD_PKG)"
309
310# Build the ICU4J icudata.jar and testdata.jar.
311# see icu4j-readme.txt
312
313ICU4J_TZDATA="$(ICUOUT)\icu4j\icutzdata.jar"
314ICU4J_DATA_DIRNAME=com\ibm\icu\impl\data\$(U_ICUDATA_NAME)b
315ICU4J_TZDATA_PATHS=$(ICU4J_DATA_DIRNAME)\zoneinfo64.res $(ICU4J_DATA_DIRNAME)\metaZones.res $(ICU4J_DATA_DIRNAME)\timezoneTypes.res $(ICU4J_DATA_DIRNAME)\windowsZones.res
316
317generate-data: GODATA "$(ICUOUT)\$(ICUPKG).dat" uni-core-data
318	if not exist "$(ICUOUT)\icu4j\$(ICU4J_DATA_DIRNAME)" mkdir "$(ICUOUT)\icu4j\$(ICU4J_DATA_DIRNAME)"
319	if not exist "$(ICUOUT)\icu4j\tzdata\$(ICU4J_DATA_DIRNAME)" mkdir "$(ICUOUT)\icu4j\tzdata\$(ICU4J_DATA_DIRNAME)"
320	echo pnames.icu ubidi.icu ucase.icu uprops.icu nfc.nrm > "$(ICUOUT)\icu4j\add.txt"
321	"$(ICUPBIN)\icupkg" "$(ICUOUT)\$(ICUPKG).dat" "$(ICUOUT)\icu4j\$(U_ICUDATA_NAME)b.dat" -a "$(ICUOUT)\icu4j\add.txt" -s "$(ICUBLD_PKG)" -x * -tb -d "$(ICUOUT)\icu4j\$(ICU4J_DATA_DIRNAME)"
322	@for %f in ($(ICU4J_TZDATA_PATHS)) do @move "$(ICUOUT)\icu4j\%f" "$(ICUOUT)\icu4j\tzdata\$(ICU4J_DATA_DIRNAME)"
323
324"$(ICUOUT)\icu4j\icutzdata.jar": GODATA generate-data
325	"$(JAR)" cf "$(ICUOUT)\icu4j\icutzdata.jar" -C "$(ICUOUT)\icu4j\tzdata" "$(ICU4J_DATA_DIRNAME)"
326
327# Build icudata.jar:
328# - add the uni-core-data to the ICU package
329# - swap the ICU data
330# - extract all data items
331# - package them into the .jar file
332"$(ICUOUT)\icu4j\icudata.jar": GODATA generate-data
333	"$(JAR)" cf "$(ICUOUT)\icu4j\icudata.jar" -C "$(ICUOUT)\icu4j" "$(ICU4J_DATA_DIRNAME)"
334
335# Build testdata.jar:
336# - swap the test data
337# - extract all data items
338# - package them into the .jar file
339"$(ICUOUT)\icu4j\testdata.jar": GODATA "$(TESTDATAOUT)\testdata.dat"
340	if not exist "$(ICUOUT)\icu4j\com\ibm\icu\dev\data\testdata" mkdir "$(ICUOUT)\icu4j\com\ibm\icu\dev\data\testdata"
341	"$(ICUPBIN)\icupkg" "$(TESTDATAOUT)\testdata.dat" -r test.icu -x * -tb -d "$(ICUOUT)\icu4j\com\ibm\icu\dev\data\testdata"
342	"$(JAR)" cf "$(ICUOUT)\icu4j\testdata.jar" -C "$(ICUOUT)\icu4j" com\ibm\icu\dev\data\testdata
343
344## Compare to:  source\data\Makefile.in and source\test\testdata\Makefile.in
345
346DEBUGUTILITIESDATA_DIR=main\tests\core\src\com\ibm\icu\dev\test\util
347DEBUGUTILITIESDATA_SRC=DebugUtilitiesData.java
348
349# Build DebugUtilitiesData.java
350"$(ICUOUT)\icu4j\src\$(DEBUGUTILITIESDATA_DIR)\$(DEBUGUTILITIESDATA_SRC)" : {"$(ICUTOOLS)\gentest\$(CFGTOOLS)"}gentest.exe
351	if not exist "$(ICUOUT)\icu4j\src\$(DEBUGUTILITIESDATA_DIR)" mkdir "$(ICUOUT)\icu4j\src\$(DEBUGUTILITIESDATA_DIR)"
352	"$(ICUTOOLS)\gentest\$(CFGTOOLS)\gentest" -j -d"$(ICUOUT)\icu4j\src\$(DEBUGUTILITIESDATA_DIR)"
353
354ICU4J_DATA="$(ICUOUT)\icu4j\icudata.jar" "$(ICUOUT)\icu4j\testdata.jar"  "$(ICUOUT)\icu4j\src\$(DEBUGUTILITIESDATA_DIR)\$(DEBUGUTILITIESDATA_SRC)"
355
356icu4j-data: GODATA $(ICU4J_DATA) $(ICU4J_TZDATA)
357
358!IFDEF ICU4J_ROOT
359
360"$(ICU4J_ROOT)\main\shared\data\icudata.jar": "$(ICUOUT)\icu4j\icudata.jar"
361	if not exist "$(ICU4J_ROOT)\main\shared\data" mkdir "$(ICU4J_ROOT)\main\shared\data"
362	copy "$(ICUOUT)\icu4j\icudata.jar" "$(ICU4J_ROOT)\main\shared\data"
363
364"$(ICU4J_ROOT)\main\shared\data\icutzdata.jar": "$(ICUOUT)\icu4j\icutzdata.jar"
365	if not exist "$(ICU4J_ROOT)\main\shared\data" mkdir "$(ICU4J_ROOT)\main\shared\data"
366	copy "$(ICUOUT)\icu4j\icutzdata.jar" "$(ICU4J_ROOT)\main\shared\data"
367
368"$(ICU4J_ROOT)\main\shared\data\testdata.jar": "$(ICUOUT)\icu4j\testdata.jar"
369	if not exist "$(ICU4J_ROOT)\main\shared\data" mkdir "$(ICU4J_ROOT)\main\shared\data"
370	copy "$(ICUOUT)\icu4j\testdata.jar" "$(ICU4J_ROOT)\main\shared\data"
371
372# "$(DEBUGUTILTIESDATA_OUT)"
373
374"$(ICU4J_ROOT)\$(DEBUGUTILITIESDATA_DIR)\$(DEBUGUTILITIESDATA_SRC)": "$(ICUOUT)\icu4j\src\$(DEBUGUTILITIESDATA_DIR)\$(DEBUGUTILITIESDATA_SRC)"
375	if not exist "$(ICU4J_ROOT)\$(DEBUGUTILITIESDATA_DIR)" mkdir "$(ICU4J_ROOT)\$(DEBUGUTILITIESDATA_DIR)"
376	copy "$(ICUOUT)\icu4j\src\$(DEBUGUTILITIESDATA_DIR)\$(DEBUGUTILITIESDATA_SRC)" "$(ICU4J_ROOT)\$(DEBUGUTILITIESDATA_DIR)\$(DEBUGUTILITIESDATA_SRC)"
377
378ICU4J_DATA_INSTALLED="$(ICU4J_ROOT)\main\shared\data\icudata.jar" "$(ICU4J_ROOT)\main\shared\data\icutzdata.jar" "$(ICU4J_ROOT)\main\shared\data\testdata.jar" "$(ICU4J_ROOT)\$(DEBUGUTILITIESDATA_DIR)\$(DEBUGUTILITIESDATA_SRC)"
379
380icu4j-data-install : GODATA $(ICU4J_DATA) $(ICU4J_TZDATA) $(ICU4J_DATA_INSTALLED)
381	@echo ICU4J  data output to "$(ICU4J_ROOT)"
382
383!ELSE
384
385icu4j-data-install :
386	@echo ERROR ICU4J_ROOT not set
387	@exit 1
388
389!ENDIF
390
391
392
393#
394# testdata - nmake will invoke pkgdata, which will create testdata.dat
395#
396"$(TESTDATAOUT)\testdata.dat": "$(TESTDATA)\*" $(TOOLS_TS)
397	@cd "$(TESTDATA)"
398	@echo building testdata...
399	nmake /nologo /f "$(TESTDATA)\testdata.mak" TESTDATA=. ICUTOOLS="$(ICUTOOLS)" ICUPBIN="$(ICUPBIN)" ICUP="$(ICUP)" CFG=$(CFGTOOLS) TESTDATAOUT="$(TESTDATAOUT)" TESTDATABLD="$(TESTDATABLD)" ICUSRCDATA="$(ICUSRCDATA)" DLL_OUTPUT="$(DLL_OUTPUT)"
400
401#invoke pkgdata for ICU common data
402#  pkgdata will drop all output files (.dat, .dll, .lib) into the target (ICUBLD_PKG) directory.
403#  move the .dll and .lib files to their final destination afterwards.
404#  The $(U_ICUDATA_NAME).lib and $(U_ICUDATA_NAME).exp should already be in the right place due to stubdata.
405#
406#  2005-may-05 Removed Unicode properties files (unorm.icu, uprops.icu, ucase.icu, ubidi.icu)
407#  from data build. See Jitterbug 4497. (makedata.mak revision 1.117)
408#
409!IFDEF ICUDATA_SOURCE_ARCHIVE
410"$(ICU_LIB_TARGET)" : $(COMMON_ICUDATA_DEPENDENCIES) "$(ICUDATA_SOURCE_ARCHIVE)"
411	@echo Building icu data from $(ICUDATA_SOURCE_ARCHIVE)
412	cd "$(ICUBLD_PKG)"
413	"$(ICUPBIN)\icupkg" -x * --list "$(ICUDATA_SOURCE_ARCHIVE)" > "$(ICUTMP)\icudata.lst"
414	"$(ICUPBIN)\pkgdata" $(COMMON_ICUDATA_ARGUMENTS) "$(ICUTMP)\icudata.lst"
415	copy "$(U_ICUDATA_NAME).dll" "$(DLL_OUTPUT)"
416	-@erase "$(U_ICUDATA_NAME).dll"
417	copy "$(ICUTMP)\$(ICUPKG).dat" "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat"
418	-@erase "$(ICUTMP)\$(ICUPKG).dat"
419!ELSE
420"$(ICU_LIB_TARGET)" : $(COMMON_ICUDATA_DEPENDENCIES) $(COREDATA_TS)
421	@echo Building ICU data from scratch
422	cd "$(ICUBLD_PKG)"
423	"$(ICUPBIN)\pkgdata" $(COMMON_ICUDATA_ARGUMENTS) $(ICUTMP)\icudata.lst
424	-@erase "$(ICU_LIB_TARGET)"
425	@if not exist "$(DLL_OUTPUT)" mkdir "$(DLL_OUTPUT)"
426	copy "$(U_ICUDATA_NAME).dll" "$(ICU_LIB_TARGET)"
427	-@erase "$(U_ICUDATA_NAME).dll"
428	copy "$(ICUTMP)\$(ICUPKG).dat" "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat"
429	-@erase "$(ICUTMP)\$(ICUPKG).dat"
430!ENDIF
431
432"$(ARM_CROSSBUILD_TS)" : $(COMMON_ICUDATA_DEPENDENCIES) "$(ICU_LIB_TARGET)"
433	@echo Building ICU data for "$(ARM_CROSS_BUILD)" from x64
434	cd "$(ICUBLD_PKG)"
435	"$(ICUPBIN)\pkgdata" $(COMMON_ICUDATA_ARGUMENTS) $(ICUTMP)\icudata.lst
436	-@erase "$(ICU_LIB_TARGET)"
437	@if not exist "$(DLL_OUTPUT)" mkdir "$(DLL_OUTPUT)"
438	copy "$(U_ICUDATA_NAME).dll" "$(ICU_LIB_TARGET)"
439	-@erase "$(U_ICUDATA_NAME).dll"
440	copy "$(ICUTMP)\$(ICUPKG).dat" "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat"
441	-@erase "$(ICUTMP)\$(ICUPKG).dat"
442	@echo "timestamp" > $(ARM_CROSSBUILD_TS)
443
444# utility target to create missing directories
445# Most directories are made by Python, but still create ICUTMP
446# so it works in the source archive
447CREATE_DIRS :
448	@if not exist "$(ICUOUT)\$(NULL)" mkdir "$(ICUOUT)"
449	@if not exist "$(ICUTMP)\$(NULL)" mkdir "$(ICUTMP)"
450	@if not exist "$(ICUOUT)\build\$(NULL)" mkdir "$(ICUOUT)\build"
451	@if not exist "$(ICUBLD_PKG)\$(NULL)" mkdir "$(ICUBLD_PKG)"
452	@if not exist "$(TESTDATAOUT)" mkdir "$(TESTDATAOUT)"
453
454# utility target to send us to the right dir
455GODATA : CREATE_DIRS
456	@cd "$(ICUBLD_PKG)"
457
458# This is to remove all the data files
459CLEAN : GODATA
460	@echo Cleaning up the data files.
461	@cd "$(ICUOUT)"
462	-@erase "$(ICUOUT)\*.dat"
463	@rmdir $(ICUBLD) /s /q
464	@rmdir $(ICUTMP) /s /q
465	@rmdir $(TESTDATAOUT) /s /q
466
467# DLL version information
468# If you modify this, modify winmode.c in pkgdata.
469"$(ICUTMP)\icudata.res": "$(ICUSRCDATA)\misc\icudata.rc"
470	@echo Creating data DLL version information from $**
471	@rc.exe /i "..\..\..\..\common" /r /fo $@ $**
472
473# Targets for prebuilt Unicode data
474# Needed for ICU4J!
475"$(ICUBLD_PKG)\pnames.icu": $(ICUSRCDATA_RELATIVE_PATH)\in\pnames.icu
476	"$(ICUPBIN)\icupkg" -tl $? $@
477
478"$(ICUBLD_PKG)\ubidi.icu": $(ICUSRCDATA_RELATIVE_PATH)\in\ubidi.icu
479	"$(ICUPBIN)\icupkg" -tl $? $@
480
481"$(ICUBLD_PKG)\ucase.icu": $(ICUSRCDATA_RELATIVE_PATH)\in\ucase.icu
482	"$(ICUPBIN)\icupkg" -tl $? $@
483
484"$(ICUBLD_PKG)\uprops.icu": $(ICUSRCDATA_RELATIVE_PATH)\in\uprops.icu
485	"$(ICUPBIN)\icupkg" -tl $? $@
486
487"$(ICUBLD_PKG)\unames.icu": $(ICUSRCDATA_RELATIVE_PATH)\in\unames.icu
488	"$(ICUPBIN)\icupkg" -tl $? $@
489
490"$(ICUBLD_PKG)\nfc.nrm": $(ICUSRCDATA_RELATIVE_PATH)\in\nfc.nrm
491	"$(ICUPBIN)\icupkg" -tl $? $@
492
493"$(ICUBLD_PKG)\nfkc.nrm": $(ICUSRCDATA_RELATIVE_PATH)\in\nfkc.nrm
494	"$(ICUPBIN)\icupkg" -tl $? $@
495
496"$(ICUBLD_PKG)\nfkc_cf.nrm": $(ICUSRCDATA_RELATIVE_PATH)\in\nfkc_cf.nrm
497	"$(ICUPBIN)\icupkg" -tl $? $@
498
499"$(ICUBLD_PKG)\uts46.nrm": $(ICUSRCDATA_RELATIVE_PATH)\in\uts46.nrm
500	"$(ICUPBIN)\icupkg" -tl $? $@
501
502"$(ICUBLD_PKG)\coll\ucadata.icu": $(ICUSRCDATA_RELATIVE_PATH)\in\coll\ucadata-unihan.icu
503	"$(ICUPBIN)\icupkg" -tl $? $@
504
505
506!IFDEF ICUDATA_ARCHIVE
507"$(ICUDATA_SOURCE_ARCHIVE)": CREATE_DIRS $(ICUDATA_ARCHIVE) $(TOOLS_TS)
508	"$(ICUTOOLS)\icupkg\$(CFGTOOLS)\icupkg" -t$(U_ICUDATA_ENDIAN_SUFFIX) "$(ICUDATA_ARCHIVE)" "$(ICUDATA_SOURCE_ARCHIVE)"
509!ENDIF
510