+# Copyright (C) 2016 and later: Unicode, Inc. and others.
+# License & terms of use: http://www.unicode.org/copyright.html
#**********************************************************************
-#* Copyright (C) 1999-2003, International Business Machines Corporation
+#* Copyright (C) 1999-2016, International Business Machines Corporation
#* and others. All Rights Reserved.
#**********************************************************************
# nmake file for creating data files on win32
# invoke with
-# nmake /f makedata.mak [Debug|Release]
+# nmake /f makedata.mak icumake=$(ProjectDir)
#
# 12/10/1999 weiv Created
##############################################################################
-# Keep the following in sync with the version - see common/unicode/uversion.h
-U_ICUDATA_NAME=icudt26
+# Keep the following in sync with the version - see common/unicode/uvernum.h
+U_ICUDATA_NAME=icudt64
##############################################################################
+!IF "$(UWP)" == "UWP"
+# Optionally change the name of the data file for the UWP version.
+U_ICUDATA_NAME=icudt64
+!ENDIF
U_ICUDATA_ENDIAN_SUFFIX=l
-UNICODE_VERSION=4
+UNICODE_VERSION=12.1
+ICU_LIB_TARGET=$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll
# ICUMAKE
# Must be provided by whoever runs this makefile.
# Is the directory containing this file (makedata.mak)
# Is the directory into which most data is built (prior to packaging)
-# Is icu\source\data\build
+# Is icu\source\data\
#
!IF "$(ICUMAKE)"==""
!ERROR Can't find ICUMAKE (ICU Data Make dir, should point to icu\source\data\ )!
!ENDIF
!MESSAGE ICU data make path is $(ICUMAKE)
+!IF [py -3 -c "exit(0)"]!=0
+!MESSAGE Information: Unable to find Python 3. Data will fail to build from source.
+!ENDIF
+
+# Suffixes for data files
+.SUFFIXES : .nrm .icu .ucm .cnv .dll .dat .res .txt .c
+
ICUOUT=$(ICUMAKE)\out
+# the prefix "icudt62_" for use in filenames
+ICUPKG=$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX)
+
# need to nuke \\ for .NET...
ICUOUT=$(ICUOUT:\\=\)
ICUBLD=$(ICUOUT)\build
-
-# ICUDT
-# the prefix "icudt21_" for use in filenames
-ICUPKG=$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX)
-ICUDT=$(ICUPKG)_
+ICUBLD_PKG=$(ICUBLD)\$(ICUPKG)
+ICUTMP=$(ICUOUT)\tmp
# ICUP
# The root of the ICU source directory tree
# The data directory in source
#
ICUSRCDATA=$(ICUP)\source\data
-ICUSRCDATA_RELATIVE_PATH=..\..\
+ICUSRCDATA_RELATIVE_PATH=..\..\..
-# ICUUCM
-# The directory that contains ucmcore.mk files along with *.ucm files
+# Timestamp files to keep track of current build state
+TOOLS_TS=$(ICUTMP)\tools.timestamp
+COREDATA_TS=$(ICUTMP)\coredata.timestamp
+
+# ICUCOL
+# The directory that contains colfiles.mk files along with *.txt collation data files
#
-ICUUCM=mappings
+ICUCOL=coll
-# ICULOC
-# The directory that contains resfiles.mk files along with *.txt locale data files
+# ICURBNF
+# The directory that contains rbnffiles.mk files along with *.txt RBNF data files
#
-ICULOC=locales
+ICURBNF=rbnf
-# ICUTRANSLIT
+# ICUTRNS
# The directory that contains trfiles.mk files along with *.txt transliterator files
#
ICUTRNS=translit
# ICUBRK
# The directory that contains resfiles.mk files along with *.txt break iterator files
#
-ICUBRK=$(ICUP)\source\data\brkitr
-
-# ICUUNIDATA
-# The directory that contains Unicode data files
-#
-ICUUNIDATA=$(ICUP)\source\data\unidata
-
-
-# ICUMISC
-# The directory that contains files that are miscelleneous data
-#
-ICUMISC=$(ICUP)\source\data\misc
+ICUBRK=brkitr
#
# ICUDATA
# This is the same place that all of the other ICU DLLs go (the code-containing DLLs)
# The lib file for the data DLL goes in $(DLL_OUTPUT)/../lib/
#
-DLL_OUTPUT=$(ICUP)\bin
+!IF "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM\Debug"
+DLL_OUTPUT=$(ICUP)\binARM$(UWP)
+!ELSE IF "$(CFG)" == "x64\Release" || "$(CFG)" == "x64\Debug"
+DLL_OUTPUT=$(ICUP)\bin64$(UWP)
+!ELSE IF "$(UWP)" == "UWP"
+DLL_OUTPUT=$(ICUP)\bin32$(UWP)
+!ELSE
+DLL_OUTPUT=$(ICUP)\bin$(UWP)
+!ENDIF
#
# TESTDATA
#
# TESTDATAOUT
# The destination directory for the built test data .dat file
-# When running the tests, ICU_DATA environment variable is set to here
-# so that test data files can be loaded. (Tests are NOT run from this makefile,
-# only the data is put in place.)
-TESTDATAOUT=$(ICUP)\source\test\testdata\out\
+TESTDATAOUT=$(ICUP)\source\test\testdata\out
#
# TESTDATABLD
# Directory under which all of the ICU data building tools live.
#
ICUTOOLS=$(ICUP)\source\tools
+!MESSAGE ICU tools path is $(ICUTOOLS)
-
-PATH = $(PATH);$(ICUP)\bin
-
-
-# We have to prepare params for pkgdata - to help it find the tools
-!IF "$(CFG)" == "Debug" || "$(CFG)" == "debug"
-!MESSAGE makedata.mak: doing a Debug build.
-PKGOPT=D:$(ICUP)
-!ELSE
-!MESSAGE makedata.mak: doing a Release build.
-PKGOPT=R:$(ICUP)
-!ENDIF
-
-
-# Suffixes for data files
-.SUFFIXES : .ucm .cnv .dll .dat .res .txt .c
-
-# We're including a list of .ucm files.
-# There are several lists, they are all optional.
-
-# Always build the mapping files for the EBCDIC fallback codepages
-# They are necessary on EBCDIC machines, and
-# the following logic is much easier if UCM_SOURCE is never empty.
-# (They are small.)
-UCM_SOURCE=ibm-37_P100-1995.ucm ibm-1047_P100-1995.ucm
-
-!IF EXISTS("$(ICUSRCDATA)\$(ICUUCM)\ucmcore.mk")
-!INCLUDE "$(ICUSRCDATA)\$(ICUUCM)\ucmcore.mk"
-UCM_SOURCE=$(UCM_SOURCE) $(UCM_SOURCE_CORE)
-!ELSE
-!MESSAGE Warning: cannot find "ucmcore.mk". Not building core MIME/Unix/Windows converter files.
+#
+# TOOLS CFG PATH
+# ARM needs to use one of the other tools, so make sure to get an usable cfg path
+# Since tools, particularly pkggen, have architecture built-in, we made x64 on
+# Windows be machine-independent and use those tools.
+#
+CFGTOOLS=$(CFG)
+!IF "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM\Debug"
+CFGTOOLS=x64\Release
!ENDIF
+!MESSAGE ICU tools CFG subpath is $(CFGTOOLS)
-!IF EXISTS("$(ICUSRCDATA)\$(ICUUCM)\ucmfiles.mk")
-!INCLUDE "$(ICUSRCDATA)\$(ICUUCM)\ucmfiles.mk"
-UCM_SOURCE=$(UCM_SOURCE) $(UCM_SOURCE_FILES)
+# The current ICU tools need to be in the path first.
+# x86 uses x86, x64 and arm use x64
+!IF "$(CFG)" == "x86\Release" || "$(CFG)" == "x86\Debug"
+PATH = $(ICUP)\bin;$(PATH)
+ICUPBIN=$(ICUP)\bin
!ELSE
-!MESSAGE Warning: cannot find "ucmfiles.mk". Not building many converter files.
+PATH = $(ICUP)\bin64;$(PATH)
+ICUPBIN=$(ICUP)\bin64
!ENDIF
-!IF EXISTS("$(ICUSRCDATA)\$(ICUUCM)\ucmebcdic.mk")
-!INCLUDE "$(ICUSRCDATA)\$(ICUUCM)\ucmebcdic.mk"
-UCM_SOURCE=$(UCM_SOURCE) $(UCM_SOURCE_EBCDIC)
-!ELSE
-!MESSAGE Warning: cannot find "ucmebcdic.mk". Not building EBCDIC converter files.
-!ENDIF
-!IF EXISTS("$(ICUSRCDATA)\$(ICUUCM)\ucmlocal.mk")
-!INCLUDE "$(ICUSRCDATA)\$(ICUUCM)\ucmlocal.mk"
-UCM_SOURCE=$(UCM_SOURCE) $(UCM_SOURCE_LOCAL)
-!ELSE
-!MESSAGE Information: cannot find "ucmlocal.mk". Not building user-additional converter files.
+# This variable can be overridden to "-m static" by the project settings,
+# if you want a static data library.
+!IF "$(ICU_PACKAGE_MODE)"==""
+ICU_PACKAGE_MODE=-m dll
!ENDIF
-CNV_FILES=$(UCM_SOURCE:.ucm=.cnv)
-
-# Read list of locale resource bundle files
-!IF EXISTS("$(ICUSRCDATA)\$(ICULOC)\resfiles.mk")
-!INCLUDE "$(ICUSRCDATA)\$(ICULOC)\resfiles.mk"
-!IF EXISTS("$(ICUSRCDATA)\$(ICULOC)\reslocal.mk")
-!INCLUDE "$(ICUSRCDATA)\$(ICULOC)\reslocal.mk"
-GENRB_SOURCE=$(GENRB_SOURCE) $(GENRB_SOURCE_LOCAL)
+# If this archive exists, build from that
+# instead of building everything from scratch.
+ICUDATA_SOURCE_ARCHIVE=$(ICUSRCDATA)\in\$(ICUPKG).dat
+!IF !EXISTS("$(ICUDATA_SOURCE_ARCHIVE)")
+# Does a big endian version exist either?
+ICUDATA_ARCHIVE=$(ICUSRCDATA)\in\$(U_ICUDATA_NAME)b.dat
+!IF EXISTS("$(ICUDATA_ARCHIVE)")
+ICUDATA_SOURCE_ARCHIVE=$(ICUTMP)\$(ICUPKG).dat
!ELSE
-!MESSAGE Information: cannot find "reslocal.mk". Not building user-additional resource bundle files.
+# Nothing was usable for input
+!UNDEF ICUDATA_SOURCE_ARCHIVE
!ENDIF
-!ELSE
-!MESSAGE Warning: cannot find "resfiles.mk"
!ENDIF
-RB_FILES = root.res $(GENRB_ALIAS_SOURCE:.txt=.res) $(GENRB_SOURCE:.txt=.res)
+!IFDEF ICUDATA_SOURCE_ARCHIVE
+!MESSAGE ICU data source archive is $(ICUDATA_SOURCE_ARCHIVE)
+!ENDIF
-# Read list of transliterator resource bundle files
-!IF EXISTS("$(ICUSRCDATA)\$(ICUTRNS)\trnsfiles.mk")
-!INCLUDE "$(ICUSRCDATA)\$(ICUTRNS)\trnsfiles.mk"
-!IF EXISTS("$(ICUSRCDATA)\$(ICUTRNS)\trnslocal.mk")
-!INCLUDE "$(ICUSRCDATA)\$(ICUTRNS)\trnslocal.mk"
-TRANLIT_SOURCE=$(TRANSLIT_SOURCE) $(TRANSLIT_SOURCE_LOCAL)
-!ELSE
-!MESSAGE Information: cannot find "trnslocal.mk". Not building user-additional transliterator files.
+# Common defines for both ways of building ICU's data library.
+COMMON_ICUDATA_DEPENDENCIES="$(ICUPBIN)\pkgdata.exe" "$(ICUTMP)\icudata.res" "$(ICUP)\source\stubdata\stubdatabuilt.txt"
+COMMON_ICUDATA_ARGUMENTS=-f -e $(U_ICUDATA_NAME) -v $(ICU_PACKAGE_MODE) -c -p $(ICUPKG) -T "$(ICUTMP)" -L $(U_ICUDATA_NAME) -d "$(ICUBLD_PKG)" -s .
+!IF "$(UWP)" == "UWP"
+COMMON_ICUDATA_ARGUMENTS=$(COMMON_ICUDATA_ARGUMENTS) -u
+!IF "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM\Debug"
+COMMON_ICUDATA_ARGUMENTS=$(COMMON_ICUDATA_ARGUMENTS) -a
!ENDIF
-!ELSE
-!MESSAGE Warning: cannot find "trnsfiles.mk"
!ENDIF
-TRANSLIT_FILES = $(TRANSLIT_SOURCE:.txt=.res)
-
-INDEX_RES_FILES = res_index.res
-
-ALL_RES = $(INDEX_RES_FILES) $(RB_FILES) $(TRANSLIT_FILES)
-
#############################################################################
#
-# ALL
+# ALL
# This target builds all the data files. The world starts here.
-# Note: we really want the common data dll to go to $(DLL_OUTPUT), not $(ICUBLD). But specifying
+# Note: we really want the common data dll to go to $(DLL_OUTPUT), not $(ICUBLD_PKG). But specifying
# that here seems to cause confusion with the building of the stub library of the same name.
-# Building the common dll in $(ICUBLD) unconditionally copies it to $(DLL_OUTPUT) too.
+# Building the common dll in $(ICUBLD_PKG) unconditionally copies it to $(DLL_OUTPUT) too.
#
#############################################################################
-ALL : GODATA "$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll" "$(TESTDATAOUT)\testdata.dat"
+ALL : GODATA "$(ICU_LIB_TARGET)" "$(TESTDATAOUT)\testdata.dat"
@echo All targets are up to date
-#
-# testdata - nmake will invoke pkgdata, which will create testdata.dat
-#
-"$(TESTDATAOUT)\testdata.dat": $(ICUDT)ucadata.icu $(TRANSLIT_FILES) $(RB_FILES) {"$(ICUTOOLS)\genrb\$(CFG)"}genrb.exe
- @cd "$(TESTDATA)"
- @echo building testdata...
- nmake /nologo /f "$(TESTDATA)\testdata.mk" TESTDATA=. ICUTOOLS="$(ICUTOOLS)" PKGOPT="$(PKGOPT)" CFG=$(CFG) TESTDATAOUT="$(TESTDATAOUT)" ICUDATA="$(ICUDATA)" TESTDATABLD="$(TESTDATABLD)"
+!IF "$(UWP)" == "UWP"
+ @if not exist "$(ICUMAKE)\..\..\commondata\" mkdir "$(ICUMAKE)\..\..\commondata\"
+ copy "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat" "$(ICUMAKE)\..\..\commondata\"
+!ENDIF
-#
-# Break iterator data files.
-#
-BRK_FILES = $(ICUDT)sent.brk $(ICUDT)char.brk $(ICUDT)line.brk $(ICUDT)word.brk $(ICUDT)title.brk $(ICUDT)line_th.brk $(ICUDT)word_th.brk
-#invoke pkgdata for ICU common data
-# pkgdata will drop all output files (.dat, .dll, .lib) into the target (ICUBLD) directory.
-# move the .dll and .lib files to their final destination afterwards.
-# The $(U_ICUDATA_NAME).lib and $(U_ICUDATA_NAME).exp should already be in the right place due to stubdata.
+# Three main targets: tools, core data, and test data.
+# Keep track of whether they are built via timestamp files.
+
+$(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"
+ @echo "timestamp" > $(TOOLS_TS)
+
+# On Unix, Python generates at configure time a list of Makefile rules.
+# On Windows, however, we run the Python data build script at build time instead.
+# The alternative would be to use a preprocessor macro to generate rules for nmake.
+# However, this approach was abandoned for reasons including:
#
-"$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll" : "$(ICUTOOLS)\pkgdata\$(CFG)\pkgdata.exe" $(CNV_FILES) $(BRK_FILES) "$(ICUBLD)\$(ICUDT)uprops.icu" "$(ICUBLD)\$(ICUDT)unames.icu" "$(ICUBLD)\$(ICUDT)pnames.icu" "$(ICUBLD)\$(ICUDT)unorm.icu" "$(ICUBLD)\$(ICUDT)cnvalias.icu" "$(ICUBLD)\$(ICUDT)tz.icu" "$(ICUBLD)\$(ICUDT)ucadata.icu" "$(ICUBLD)\$(ICUDT)invuca.icu" "$(ICUBLD)\$(ICUDT)uidna.icu" $(ALL_RES) "$(ICUBLD)\$(ICUDT)icudata.res" "$(ICUP)\source\stubdata\stubdatabuilt.txt"
- @echo Building icu data
- @cd "$(ICUBLD)"
- @"$(ICUTOOLS)\pkgdata\$(CFG)\pkgdata" -f -e $(U_ICUDATA_NAME) -v -m dll -c -p $(ICUPKG) -O "$(PKGOPT)" -d "$(ICUBLD)" -s . <<pkgdatain.txt
-$(ICUDT)unorm.icu
-$(ICUDT)uprops.icu
-$(ICUDT)pnames.icu
-$(ICUDT)unames.icu
-$(ICUDT)ucadata.icu
-$(ICUDT)invuca.icu
-$(ICUDT)uidna.icu
-$(ICUDT)tz.icu
-$(ICUDT)cnvalias.icu
-$(CNV_FILES:.cnv =.cnv
-)
-$(ALL_RES:.res =.res
-)
-$(BRK_FILES:.brk =.brk
-)
-<<KEEP
- copy "$(ICUPKG).dll" "$(DLL_OUTPUT)"
- -@erase "$(ICUPKG).dll"
- copy "$(ICUPKG).dat" "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat"
- -@erase "$(ICUPKG).dat"
-
-
-
-# RBBI .brk file generation.
-# TODO: set up an inference rule, so these don't need to be written out one by one...
+# - nmake imposes more stringent restrictions on command line length.
+# - The lack of gnumake features makes nmake file construction more complex.
+# - Windows builds are single-threaded, giving less advantage to a Makefile approach.
#
+# Currently, the entire script needs to run even for small changes to data. Maybe consider
+# checking file-changed timestamps in Python to build only the required subset of data.
+
+$(COREDATA_TS):
+ @cd "$(ICUSRCDATA)"
+ py -3 -B -m buildtool \
+ --mode windows-exec \
+ --src_dir "$(ICUSRCDATA)" \
+ --tool_dir "$(ICUTOOLS)" \
+ --tool_cfg "$(CFG)" \
+ --out_dir "$(ICUBLD_PKG)" \
+ --tmp_dir "$(ICUTMP)"
+ --filter_file "$(ICU_DATA_FILTER_FILE)" \
+ $(ICU_DATA_BUILDTOOL_OPTS) \
+ @echo "timestamp" > $(COREDATA_TS)
+
+
+# The core Unicode properties files (uprops.icu, ucase.icu, ubidi.icu)
+# are hardcoded in the common DLL and therefore not included in the data package any more.
+# They are not built by default but need to be built for ICU4J data and for getting the .c source files
+# when updating the Unicode data.
+# Changed in makedata.mak revision 1.117. See Jitterbug 4497.
+# 2010-dec Removed pnames.icu.
+# Command line:
+# 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
+uni-core-data: GODATA "$(ICUBLD_PKG)\pnames.icu" "$(ICUBLD_PKG)\uprops.icu" "$(ICUBLD_PKG)\ucase.icu" "$(ICUBLD_PKG)\ubidi.icu" "$(ICUBLD_PKG)\nfc.nrm"
+ @echo Unicode .icu files built to "$(ICUBLD_PKG)"
+
+# Build the ICU4J icudata.jar and testdata.jar.
+# see icu4j-readme.txt
+
+ICU4J_TZDATA="$(ICUOUT)\icu4j\icutzdata.jar"
+ICU4J_DATA_DIRNAME=com\ibm\icu\impl\data\$(U_ICUDATA_NAME)b
+ICU4J_TZDATA_PATHS=$(ICU4J_DATA_DIRNAME)\zoneinfo64.res $(ICU4J_DATA_DIRNAME)\metaZones.res $(ICU4J_DATA_DIRNAME)\timezoneTypes.res $(ICU4J_DATA_DIRNAME)\windowsZones.res
+
+generate-data: GODATA "$(ICUOUT)\$(ICUPKG).dat" uni-core-data
+ if not exist "$(ICUOUT)\icu4j\$(ICU4J_DATA_DIRNAME)" mkdir "$(ICUOUT)\icu4j\$(ICU4J_DATA_DIRNAME)"
+ if not exist "$(ICUOUT)\icu4j\tzdata\$(ICU4J_DATA_DIRNAME)" mkdir "$(ICUOUT)\icu4j\tzdata\$(ICU4J_DATA_DIRNAME)"
+ echo pnames.icu ubidi.icu ucase.icu uprops.icu nfc.nrm > "$(ICUOUT)\icu4j\add.txt"
+ "$(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)"
+ @for %f in ($(ICU4J_TZDATA_PATHS)) do @move "$(ICUOUT)\icu4j\%f" "$(ICUOUT)\icu4j\tzdata\$(ICU4J_DATA_DIRNAME)"
+
+"$(ICUOUT)\icu4j\icutzdata.jar": GODATA generate-data
+ "$(JAR)" cf "$(ICUOUT)\icu4j\icutzdata.jar" -C "$(ICUOUT)\icu4j\tzdata" "$(ICU4J_DATA_DIRNAME)"
+
+# Build icudata.jar:
+# - add the uni-core-data to the ICU package
+# - swap the ICU data
+# - extract all data items
+# - package them into the .jar file
+"$(ICUOUT)\icu4j\icudata.jar": GODATA generate-data
+ "$(JAR)" cf "$(ICUOUT)\icu4j\icudata.jar" -C "$(ICUOUT)\icu4j" "$(ICU4J_DATA_DIRNAME)"
+
+# Build testdata.jar:
+# - swap the test data
+# - extract all data items
+# - package them into the .jar file
+"$(ICUOUT)\icu4j\testdata.jar": GODATA "$(TESTDATAOUT)\testdata.dat"
+ if not exist "$(ICUOUT)\icu4j\com\ibm\icu\dev\data\testdata" mkdir "$(ICUOUT)\icu4j\com\ibm\icu\dev\data\testdata"
+ "$(ICUPBIN)\icupkg" "$(TESTDATAOUT)\testdata.dat" -r test.icu -x * -tb -d "$(ICUOUT)\icu4j\com\ibm\icu\dev\data\testdata"
+ "$(JAR)" cf "$(ICUOUT)\icu4j\testdata.jar" -C "$(ICUOUT)\icu4j" com\ibm\icu\dev\data\testdata
+
+## Compare to: source\data\Makefile.in and source\test\testdata\Makefile.in
+
+DEBUGUTILITIESDATA_DIR=main\tests\core\src\com\ibm\icu\dev\test\util
+DEBUGUTILITIESDATA_SRC=DebugUtilitiesData.java
+
+# Build DebugUtilitiesData.java
+"$(ICUOUT)\icu4j\src\$(DEBUGUTILITIESDATA_DIR)\$(DEBUGUTILITIESDATA_SRC)" : {"$(ICUTOOLS)\gentest\$(CFGTOOLS)"}gentest.exe
+ if not exist "$(ICUOUT)\icu4j\src\$(DEBUGUTILITIESDATA_DIR)" mkdir "$(ICUOUT)\icu4j\src\$(DEBUGUTILITIESDATA_DIR)"
+ "$(ICUTOOLS)\gentest\$(CFGTOOLS)\gentest" -j -d"$(ICUOUT)\icu4j\src\$(DEBUGUTILITIESDATA_DIR)"
+
+ICU4J_DATA="$(ICUOUT)\icu4j\icudata.jar" "$(ICUOUT)\icu4j\testdata.jar" "$(ICUOUT)\icu4j\src\$(DEBUGUTILITIESDATA_DIR)\$(DEBUGUTILITIESDATA_SRC)"
+
+icu4j-data: GODATA $(ICU4J_DATA) $(ICU4J_TZDATA)
+
+!IFDEF ICU4J_ROOT
+
+"$(ICU4J_ROOT)\main\shared\data\icudata.jar": "$(ICUOUT)\icu4j\icudata.jar"
+ if not exist "$(ICU4J_ROOT)\main\shared\data" mkdir "$(ICU4J_ROOT)\main\shared\data"
+ copy "$(ICUOUT)\icu4j\icudata.jar" "$(ICU4J_ROOT)\main\shared\data"
+
+"$(ICU4J_ROOT)\main\shared\data\icutzdata.jar": "$(ICUOUT)\icu4j\icutzdata.jar"
+ if not exist "$(ICU4J_ROOT)\main\shared\data" mkdir "$(ICU4J_ROOT)\main\shared\data"
+ copy "$(ICUOUT)\icu4j\icutzdata.jar" "$(ICU4J_ROOT)\main\shared\data"
+
+"$(ICU4J_ROOT)\main\shared\data\testdata.jar": "$(ICUOUT)\icu4j\testdata.jar"
+ if not exist "$(ICU4J_ROOT)\main\shared\data" mkdir "$(ICU4J_ROOT)\main\shared\data"
+ copy "$(ICUOUT)\icu4j\testdata.jar" "$(ICU4J_ROOT)\main\shared\data"
+
+# "$(DEBUGUTILTIESDATA_OUT)"
+
+"$(ICU4J_ROOT)\$(DEBUGUTILITIESDATA_DIR)\$(DEBUGUTILITIESDATA_SRC)": "$(ICUOUT)\icu4j\src\$(DEBUGUTILITIESDATA_DIR)\$(DEBUGUTILITIESDATA_SRC)"
+ if not exist "$(ICU4J_ROOT)\$(DEBUGUTILITIESDATA_DIR)" mkdir "$(ICU4J_ROOT)\$(DEBUGUTILITIESDATA_DIR)"
+ copy "$(ICUOUT)\icu4j\src\$(DEBUGUTILITIESDATA_DIR)\$(DEBUGUTILITIESDATA_SRC)" "$(ICU4J_ROOT)\$(DEBUGUTILITIESDATA_DIR)\$(DEBUGUTILITIESDATA_SRC)"
+
+ICU4J_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)"
+
+icu4j-data-install : GODATA $(ICU4J_DATA) $(ICU4J_TZDATA) $(ICU4J_DATA_INSTALLED)
+ @echo ICU4J data output to "$(ICU4J_ROOT)"
-BRKDEPS = "$(ICUBLD)\$(ICUDT)uprops.icu" "$(ICUBLD)\$(ICUDT)unames.icu" "$(ICUBLD)\$(ICUDT)pnames.icu" "$(ICUBLD)\$(ICUDT)unorm.icu"
-
-$(ICUDT)char.brk : "$(ICUBRK)\char.txt" $(BRKDEPS)
- genbrk -r "$(ICUBRK)\char.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
+!ELSE
-$(ICUDT)word.brk : "$(ICUBRK)\word.txt" $(BRKDEPS)
- genbrk -r "$(ICUBRK)\word.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
+icu4j-data-install :
+ @echo ERROR ICU4J_ROOT not set
+ @exit 1
-$(ICUDT)line.brk : "$(ICUBRK)\line.txt" $(BRKDEPS)
- genbrk -r "$(ICUBRK)\line.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
+!ENDIF
-$(ICUDT)sent.brk : "$(ICUBRK)\sent.txt" $(BRKDEPS)
- genbrk -r "$(ICUBRK)\sent.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
-$(ICUDT)title.brk : "$(ICUBRK)\title.txt" $(BRKDEPS)
- genbrk -r "$(ICUBRK)\title.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
-$(ICUDT)word_th.brk : "$(ICUBRK)\word_th.txt" $(BRKDEPS)
- genbrk -r "$(ICUBRK)\word_th.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
+#
+# testdata - nmake will invoke pkgdata, which will create testdata.dat
+#
+"$(TESTDATAOUT)\testdata.dat": "$(TESTDATA)\*" $(TOOLS_TS) $(COREDATA_TS)
+ @cd "$(TESTDATA)"
+ @echo building testdata...
+ 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)"
-$(ICUDT)line_th.brk : "$(ICUBRK)\line_th.txt" $(BRKDEPS)
- genbrk -r "$(ICUBRK)\line_th.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
+#invoke pkgdata for ICU common data
+# pkgdata will drop all output files (.dat, .dll, .lib) into the target (ICUBLD_PKG) directory.
+# move the .dll and .lib files to their final destination afterwards.
+# The $(U_ICUDATA_NAME).lib and $(U_ICUDATA_NAME).exp should already be in the right place due to stubdata.
+#
+# 2005-may-05 Removed Unicode properties files (unorm.icu, uprops.icu, ucase.icu, ubidi.icu)
+# from data build. See Jitterbug 4497. (makedata.mak revision 1.117)
+#
+!IFDEF ICUDATA_SOURCE_ARCHIVE
+"$(ICU_LIB_TARGET)" : $(COMMON_ICUDATA_DEPENDENCIES) "$(ICUDATA_SOURCE_ARCHIVE)"
+ @echo Building icu data from $(ICUDATA_SOURCE_ARCHIVE)
+ cd "$(ICUBLD_PKG)"
+ "$(ICUPBIN)\icupkg" -x * --list "$(ICUDATA_SOURCE_ARCHIVE)" > "$(ICUTMP)\icudata.lst"
+ "$(ICUPBIN)\pkgdata" $(COMMON_ICUDATA_ARGUMENTS) "$(ICUTMP)\icudata.lst"
+ copy "$(U_ICUDATA_NAME).dll" "$(DLL_OUTPUT)"
+ -@erase "$(U_ICUDATA_NAME).dll"
+ copy "$(ICUTMP)\$(ICUPKG).dat" "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat"
+ -@erase "$(ICUTMP)\$(ICUPKG).dat"
+!ELSE
+"$(ICU_LIB_TARGET)" : $(COMMON_ICUDATA_DEPENDENCIES) $(COREDATA_TS)
+ @echo Building ICU data from scratch
+ cd "$(ICUBLD_PKG)"
+ "$(ICUPBIN)\pkgdata" $(COMMON_ICUDATA_ARGUMENTS) $(ICUTMP)\icudata.lst
+ -@erase "$(ICU_LIB_TARGET)"
+ @if not exist "$(DLL_OUTPUT)" mkdir "$(DLL_OUTPUT)"
+ copy "$(U_ICUDATA_NAME).dll" "$(ICU_LIB_TARGET)"
+ -@erase "$(U_ICUDATA_NAME).dll"
+ copy "$(ICUTMP)\$(ICUPKG).dat" "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat"
+ -@erase "$(ICUTMP)\$(ICUPKG).dat"
+!ENDIF
+# utility target to create missing directories
+# Most directories are made by Python, but still create ICUTMP
+# so it works in the source archive
+CREATE_DIRS :
+ @if not exist "$(ICUOUT)\$(NULL)" mkdir "$(ICUOUT)"
+ @if not exist "$(ICUTMP)\$(NULL)" mkdir "$(ICUTMP)"
+ @if not exist "$(ICUOUT)\build\$(NULL)" mkdir "$(ICUOUT)\build"
+ @if not exist "$(ICUBLD_PKG)\$(NULL)" mkdir "$(ICUBLD_PKG)"
# utility target to send us to the right dir
-GODATA :
- @if not exist "$(ICUOUT)\$(NULL)" mkdir "$(ICUOUT)"
- @if not exist "$(ICUBLD)\$(NULL)" mkdir "$(ICUBLD)"
- @if not exist "$(TESTDATAOUT)\$(NULL)" mkdir "$(TESTDATAOUT)"
- @if not exist "$(TESTDATABLD)\$(NULL)" mkdir "$(TESTDATABLD)"
- @cd "$(ICUBLD)"
+GODATA : CREATE_DIRS
+ @cd "$(ICUBLD_PKG)"
# This is to remove all the data files
CLEAN : GODATA
@echo Cleaning up the data files.
- @cd "$(ICUBLD)"
- -@erase "*.brk"
+ @cd "$(ICUBLD_PKG)"
-@erase "*.cnv"
- -@erase "*.dat"
-@erase "*.exp"
- -@erase "*.obj"
-@erase "*.icu"
-@erase "*.lib"
- -@erase "*.mak"
+ -@erase "*.nrm"
+ -@erase "*.res"
+ -@erase "*.spp"
+ -@erase "*.txt"
+ -@erase "*.cfu"
+ -@erase "curr\*.res"
+ -@erase "curr\*.txt"
+ -@erase "lang\*.res"
+ -@erase "lang\*.txt"
+ -@erase "region\*.res"
+ -@erase "region\*.txt"
+ -@erase "zone\*.res"
+ -@erase "zone\*.txt"
+ @cd "$(ICUBLD_PKG)\$(ICUBRK)"
+ -@erase "*.brk"
+ -@erase "*.res"
+ -@erase "*.txt"
+ -@erase "*.dict"
+ @cd "$(ICUBLD_PKG)\$(ICUCOL)"
-@erase "*.res"
-@erase "*.txt"
+ @cd "$(ICUBLD_PKG)\$(ICURBNF)"
+ -@erase "*.res"
+ -@erase "*.txt"
+ @cd "$(ICUBLD_PKG)\$(ICUTRNS)"
+ -@erase "*.res"
@cd "$(ICUOUT)"
-@erase "*.dat"
- @cd "$(TESTDATABLD)"
+ @cd "$(ICUTMP)"
+ -@erase "*.html"
+ -@erase "*.lst"
+ -@erase "*.mak"
+ -@erase "*.obj"
-@erase "*.res"
- -@erase "*.dat"
+ -@erase "*.timestamp"
+ @cd "$(TESTDATABLD)"
+ -@erase "*.cnv"
+ -@erase "*.icu"
-@erase "*.mak"
+ -@erase "*.nrm"
+ -@erase "*.res"
+ -@erase "*.spp"
+ -@erase "*.txt"
@cd "$(TESTDATAOUT)"
-@erase "*.dat"
- -@erase "*.cnv"
- @cd "$(ICUBLD)"
-
-
-# Batch inference rule for creating converters
-{$(ICUSRCDATA_RELATIVE_PATH)\$(ICUUCM)}.ucm.cnv::
- @echo Generating converters
- @"$(ICUTOOLS)\makeconv\$(CFG)\makeconv" -t -p"$(ICUPKG)" -d"$(ICUBLD)" $<
-
-# Batch infrence rule for creating transliterator resource files
-{$(ICUSRCDATA_RELATIVE_PATH)\$(ICUTRNS)}.txt.res::
- @echo Making Transliterator Resource Bundle files
- @"$(ICUTOOLS)\genrb\$(CFG)\genrb" -k -t -p"$(ICUPKG)" -d"$(ICUBLD)" $<
-
-$(INDEX_RES_FILES):
- @echo Generating <<res_index.txt
-// Warning this file is automatically generated
-res_index {
- InstalledLocales {
- $(GENRB_SOURCE:.txt= {""}
- )
- }
-}
-<<KEEP
- @"$(ICUTOOLS)\genrb\$(CFG)\genrb" -k -t -p"$(ICUPKG)" -d"$(ICUBLD)" .\res_index.txt
-
-# Inference rule for creating resource bundle files
-{$(ICUSRCDATA_RELATIVE_PATH)\$(ICULOC)}.txt.res::
- @echo Making Locale Resource Bundle files
- @"$(ICUTOOLS)\genrb\$(CFG)\genrb" -k -t -p"$(ICUPKG)" -d"$(ICUBLD)" $<
+ @cd "$(TESTDATAOUT)\testdata"
+ -@erase "*.typ"
+ @cd "$(ICUBLD_PKG)"
+
# DLL version information
-"$(ICUBLD)\$(ICUDT)icudata.res": "$(ICUMISC)\icudata.rc"
+# If you modify this, modify winmode.c in pkgdata.
+"$(ICUTMP)\icudata.res": "$(ICUSRCDATA)\misc\icudata.rc"
@echo Creating data DLL version information from $**
- @rc.exe /i "..\..\..\..\include" /r /fo $@ $**
-
-# Targets for unames.icu
-"$(ICUBLD)\$(ICUDT)unames.icu": "$(ICUUNIDATA)\*.txt" "$(ICUTOOLS)\gennames\$(CFG)\gennames.exe"
- @echo Creating data file for Unicode Names
- @set ICU_DATA=$(ICUBLD)
- @"$(ICUTOOLS)\gennames\$(CFG)\gennames" -1 -u $(UNICODE_VERSION) "$(ICUUNIDATA)\UnicodeData.txt"
-
-# Targets for pnames.icu
-# >> Depends on the Unicode data as well as uchar.h and uscript.h <<
-"$(ICUBLD)\$(ICUDT)pnames.icu": "$(ICUUNIDATA)\*.txt" "$(ICUTOOLS)\genpname\$(CFG)\genpname.exe" "$(ICUP)\source\common\unicode\uchar.h" "$(ICUP)\source\common\unicode\uscript.h"
- @echo Creating data file for Unicode Property Names
- @set ICU_DATA=$(ICUBLD)
- @"$(ICUTOOLS)\genpname\$(CFG)\genpname" -d "$(ICUBLD)"
-
-# Targets for uprops.icu
-"$(ICUBLD)\$(ICUDT)uprops.icu": "$(ICUUNIDATA)\*.txt" "$(ICUTOOLS)\genprops\$(CFG)\genprops.exe" "$(ICUBLD)\$(ICUDT)pnames.icu"
- @echo Creating data file for Unicode Character Properties
- @set ICU_DATA=$(ICUBLD)
- @"$(ICUTOOLS)\genprops\$(CFG)\genprops" -u $(UNICODE_VERSION) -s "$(ICUUNIDATA)"
-
-# Targets for unorm.icu
-"$(ICUBLD)\$(ICUDT)unorm.icu": "$(ICUUNIDATA)\*.txt" "$(ICUTOOLS)\gennorm\$(CFG)\gennorm.exe"
- @echo Creating data file for Unicode Normalization
- @set ICU_DATA=$(ICUBLD)
- @"$(ICUTOOLS)\gennorm\$(CFG)\gennorm" -u $(UNICODE_VERSION) -s "$(ICUUNIDATA)"
-
-# Targets for converters
-"$(ICUBLD)\$(ICUDT)cnvalias.icu" : {"$(ICUSRCDATA)\$(ICUUCM)"}\convrtrs.txt "$(ICUTOOLS)\gencnval\$(CFG)\gencnval.exe"
- @echo Creating data file for Converter Aliases
- @set ICU_DATA=$(ICUBLD)
- @"$(ICUTOOLS)\gencnval\$(CFG)\gencnval" "$(ICUSRCDATA)\$(ICUUCM)\convrtrs.txt"
-
-# Targets for tz
-"$(ICUBLD)\$(ICUDT)tz.icu" : {"$(ICUMISC)"}timezone.txt {"$(ICUTOOLS)\gentz\$(CFG)"}gentz.exe
- @echo Creating data file for Timezones
- @set ICU_DATA=$(ICUBLD)
- @"$(ICUTOOLS)\gentz\$(CFG)\gentz" "$(ICUMISC)\timezone.txt"
-
-# Targets for ucadata.icu & invuca.icu
-"$(ICUBLD)\$(ICUDT)invuca.icu" "$(ICUBLD)\$(ICUDT)ucadata.icu": "$(ICUUNIDATA)\FractionalUCA.txt" "$(ICUTOOLS)\genuca\$(CFG)\genuca.exe" $(ICUDT)uprops.icu $(ICUDT)unorm.icu
- @echo Creating UCA data files
- @set ICU_DATA=$(ICUBLD)
- @"$(ICUTOOLS)\genuca\$(CFG)\genuca" -s "$(ICUUNIDATA)"
-
-# Targets for uidna.icu
-"$(ICUBLD)\$(ICUDT)uidna.icu" : "$(ICUUNIDATA)\*.txt" "$(ICUMISC)\*.txt"
- genidna -s "$(ICUDATA)" -d "$(ICUBLD)\\"
-
-# Dependencies on the tools for the batch inference rules
-
-$(UCM_SOURCE) : {"$(ICUTOOLS)\makeconv\$(CFG)"}makeconv.exe
-
-$(TRANSLIT_SOURCE) $(GENRB_SOURCE) "$(ICUBLD)\$(ICUDT)root.res" : {"$(ICUTOOLS)\genrb\$(CFG)"}genrb.exe "$(ICUBLD)\$(ICUDT)ucadata.icu" "$(ICUBLD)\$(ICUDT)uprops.icu" "$(ICUBLD)\$(ICUDT)unorm.icu"
+ @rc.exe /i "..\..\..\..\common" /r /fo $@ $**
+
+# Targets for prebuilt Unicode data
+# Needed for ICU4J!
+"$(ICUBLD_PKG)\pnames.icu": $(ICUSRCDATA_RELATIVE_PATH)\in\pnames.icu
+ "$(ICUPBIN)\icupkg" -tl $? $@
+
+"$(ICUBLD_PKG)\ubidi.icu": $(ICUSRCDATA_RELATIVE_PATH)\in\ubidi.icu
+ "$(ICUPBIN)\icupkg" -tl $? $@
+
+"$(ICUBLD_PKG)\ucase.icu": $(ICUSRCDATA_RELATIVE_PATH)\in\ucase.icu
+ "$(ICUPBIN)\icupkg" -tl $? $@
+
+"$(ICUBLD_PKG)\uprops.icu": $(ICUSRCDATA_RELATIVE_PATH)\in\uprops.icu
+ "$(ICUPBIN)\icupkg" -tl $? $@
+
+"$(ICUBLD_PKG)\unames.icu": $(ICUSRCDATA_RELATIVE_PATH)\in\unames.icu
+ "$(ICUPBIN)\icupkg" -tl $? $@
+
+"$(ICUBLD_PKG)\nfc.nrm": $(ICUSRCDATA_RELATIVE_PATH)\in\nfc.nrm
+ "$(ICUPBIN)\icupkg" -tl $? $@
+"$(ICUBLD_PKG)\nfkc.nrm": $(ICUSRCDATA_RELATIVE_PATH)\in\nfkc.nrm
+ "$(ICUPBIN)\icupkg" -tl $? $@
+
+"$(ICUBLD_PKG)\nfkc_cf.nrm": $(ICUSRCDATA_RELATIVE_PATH)\in\nfkc_cf.nrm
+ "$(ICUPBIN)\icupkg" -tl $? $@
+
+"$(ICUBLD_PKG)\uts46.nrm": $(ICUSRCDATA_RELATIVE_PATH)\in\uts46.nrm
+ "$(ICUPBIN)\icupkg" -tl $? $@
+
+"$(ICUBLD_PKG)\coll\ucadata.icu": $(ICUSRCDATA_RELATIVE_PATH)\in\coll\ucadata-unihan.icu
+ "$(ICUPBIN)\icupkg" -tl $? $@
+
+
+!IFDEF ICUDATA_ARCHIVE
+"$(ICUDATA_SOURCE_ARCHIVE)": CREATE_DIRS $(ICUDATA_ARCHIVE) $(TOOLS_TS)
+ "$(ICUTOOLS)\icupkg\$(CFGTOOLS)\icupkg" -t$(U_ICUDATA_ENDIAN_SUFFIX) "$(ICUDATA_ARCHIVE)" "$(ICUDATA_SOURCE_ARCHIVE)"
+!ENDIF