# Timestamp files to keep track of current build state
TOOLS_TS=$(ICUTMP)\tools.timestamp
COREDATA_TS=$(ICUTMP)\coredata.timestamp
+ARM_CROSSBUILD_TS=
# ICUCOL
# The directory that contains colfiles.mk files along with *.txt collation data files
!ELSE
DLL_OUTPUT=$(ICUP)\bin$(UWP)
!ENDIF
+!MESSAGE ICU data DLL_OUTPUT path is $(DLL_OUTPUT)
#
# TESTDATA
ICUTOOLS=$(ICUP)\source\tools
!MESSAGE ICU tools path is $(ICUTOOLS)
+# ARM_CROSS_BUILD
+# In order to support cross-compiling for ARM/ARM64 using the x64 tools
+# we need to know if we're building the ARM/ARM64 data DLL, otherwise
+# the existence of the x64 bits will cause us to think we are already done.
+# Note: This is only for the "regular" builds, the UWP builds have a separate project file entirely.
+ARM_CROSS_BUILD=
+!IF "$(UWP)" == ""
+!IF "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM\Debug"
+ARM_CROSS_BUILD=ARM
+ARM_CROSSBUILD_TS=$(ICUTMP)\$(ARM_CROSS_BUILD).timestamp
+!ELSE IF "$(CFG)" == "ARM64\Release" || "$(CFG)" == "ARM64\Debug"
+ARM_CROSS_BUILD=ARM64
+ARM_CROSSBUILD_TS=$(ICUTMP)\$(ARM_CROSS_BUILD).timestamp
+!ENDIF
+!ENDIF
+
#
# TOOLS CFG PATH
-# Generally the tools want to run on the same architechure as is being built.
+# Generally the tools want to run on the same architecture as is being built.
# Thus ARM and ARM64 need to use another build 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.
#
+!IF "$(ARM_CROSS_BUILD)" == ""
CFGTOOLS=$(CFG)
-!IF "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM\Debug" || "$(CFG)" == "ARM64\Release" || "$(CFG)" == "ARM64\Debug"
+!ELSE
CFGTOOLS=x64\Release
!ENDIF
!MESSAGE ICU tools CFG subpath is $(CFGTOOLS)
+
# The current ICU tools need to be in the path first.
# x86 uses x86; x64, arm, and arm64 use x64
!IF "$(CFG)" == "x86\Release" || "$(CFG)" == "x86\Debug"
# Building the common dll in $(ICUBLD_PKG) unconditionally copies it to $(DLL_OUTPUT) too.
#
#############################################################################
+!IF "$(ARM_CROSS_BUILD)" == ""
ALL : GODATA "$(ICU_LIB_TARGET)" "$(TESTDATAOUT)\testdata.dat"
@echo All targets are up to date
copy "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat" "$(ICUMAKE)\..\..\commondata\"
!ENDIF
+!ELSE
+ALL : GODATA "$(ICU_LIB_TARGET)" "$(TESTDATAOUT)\testdata.dat" $(ARM_CROSSBUILD_TS)
+ @echo All targets are up to date
+
+!ENDIF
# Three main targets: tools, core data, and test data.
# Keep track of whether they are built via timestamp files.
-@erase "$(ICUTMP)\$(ICUPKG).dat"
!ENDIF
+"$(ARM_CROSSBUILD_TS)" : $(COMMON_ICUDATA_DEPENDENCIES) "$(ICU_LIB_TARGET)"
+ @echo Building ICU data for "$(ARM_CROSS_BUILD)" from x64
+ 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"
+ @echo "timestamp" > $(ARM_CROSSBUILD_TS)
+
# utility target to create missing directories
# Most directories are made by Python, but still create ICUTMP
# so it works in the source archive