1 # Copyright (C) 2016 and later: Unicode, Inc. and others.
2 # License & terms of use: http://www.unicode.org/copyright.html
3 #******************************************************************************
5 # Copyright (C) 1998-2015, International Business Machines
6 # Corporation and others. All Rights Reserved.
8 #******************************************************************************
9 ## Top-level Makefile.in for ICU
12 ## Source directory information
14 top_srcdir = @top_srcdir@
18 include $(top_builddir)/icudefs.mk
20 ## Build directory information
21 subdir = test/testdata
23 ## Files to remove for 'make clean'
28 -include Makefile.local
30 ## List of phony targets
31 .PHONY : all all-local all-recursive install install-local \
32 install-recursive clean clean-local clean-recursive distclean \
33 distclean-local distclean-recursive doc dist dist-local dist-recursive \
34 check check-local check-recursive build-dir testdata.jar xcheck check-exhaustive
38 .NOTPARALLEL: build-dir
43 ## List of standard targets
45 install: install-local
47 distclean : distclean-local
49 check: all check-local
51 check-exhaustive: check
53 all-local: build-dir build-testdata testdata packagetest
60 test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
63 distclean-local: clean-local
64 $(RMV) Makefile pkgdata.inc
68 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
70 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
72 pkgdata.inc: pkgdataMakefile
73 $(MAKE) -f pkgdataMakefile
77 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
79 #########################################################################
80 ############################## Test ## stuff ############################
82 # relative lib links from pkgdata are the same as for tmp
84 # use the cross root, in case we are cross compiling. Otherwise it is equal to top_builddir
85 TOOLDIR=$(cross_buildroot)/tools
86 SRCDATADIR=$(top_srcdir)/data
87 UNICODEDATADIR=$(SRCDATADIR)/unidata
88 OUTDIR=$(top_builddir)/data/out
89 OUTTMPDIR=$(top_builddir)/data/out/tmp
90 BUILDDIR=$(OUTDIR)/build/$(ICUDATA_PLATFORM_NAME)
91 TESTSRCDATADIR=$(top_srcdir)/test/testdata
92 TESTOUTDIR=$(top_builddir)/test/testdata/out
93 BUILD_DIRS = $(TESTOUTDIR) $(TESTBUILDDIR) $(TESTOUTDIR)/$(TESTDT)
94 GENTEST=$(TOOLDIR)/gentest/gentest$(TOOLEXEEXT)
96 ifeq ($(PKGDATA_MODE),common)
97 ICU_DATA_OPT = -i $(OUTDIR)
99 ifeq ($(PKGDATA_MODE),dll)
100 ifneq ($(ENABLE_SHARED),YES)
101 ICU_DATA_OPT = -i $(BUILDDIR)
106 ICU_DATA_OPT = -i $(BUILDDIR)
110 CURDIR:=$(CURR_FULL_DIR)
111 # current directory should not be blank
116 PKGDATA = $(TOOLBINDIR)/pkgdata -q -c -s $(CURDIR)/out/build/$(ICUDATA_PLATFORM_NAME)
117 PKGDATA_INVOKE:=$(INVOKE) $(PKGDATA_INVOKE_OPTS)
119 # Contains all 'intermediate' files (and temp files) except for 'unpackaged data' below
120 TESTBUILDDIR=$(TESTOUTDIR)/build
122 # unpackaged files - live in 'out' so that the path can find them as part of the pkg
123 UNPACKAGEDTESTDATA=$(TESTOUTDIR)/$(TESTDT)/nam.typ
125 # pkg name for testdata
127 # prefix for files that are testdata
130 # Variable names for rules.mk
131 OUT_DIR=$(TESTBUILDDIR)
132 TMP_DIR=$(TESTOUTDIR)/$(TESTDT)
134 ## Include the Python-generated rules
136 include $(top_builddir)/$(subdir)/rules.mk
139 build-testdata: build-dir $(TESTDATA_ALL_OUTPUT_FILES)
141 testdata: build-testdata
144 packagetest: build-dir testdata pkgdata.inc $(TMP_DIR)/testdata.lst
145 $(PKGDATA_INVOKE) $(PKGDATA) -T $(TESTBUILDDIR) -d $(TESTOUTDIR) -s $(TESTBUILDDIR) -p $(TESTDATA) -m common $(TMP_DIR)/testdata.lst
147 build-dir: $(BUILD_DIRS)
149 -$(MKINSTALLDIRS) $(BUILD_DIRS)
151 # Build the ICU4J testdata.jar.
153 # (Run this from the output testdata folder which may not be .../source/test/testdata in an out-of-source build.)
154 # ~/svn.icu/trunk/source/test/testdata> make JAR=jar ICU4J_ROOT=~/svn.icu4j/trunk testdata.jar
155 # You can omit the ICU4J_ROOT for just building the .jar files without copying them.
156 # You can omit the JAR if it's just jar.
159 # Build testdata.jar:
160 # - swap the test data
161 # - extract all data items
162 # - package them into the .jar file
163 $(OUTDIR)/icu4j/testdata.jar: build-dir testdata $(TESTOUTDIR)/testdata.dat
164 mkdir -p $(OUTDIR)/icu4j/com/ibm/icu/dev/data/testdata
165 $(INVOKE) $(TOOLBINDIR)/icupkg $(TESTOUTDIR)/testdata.dat -r test.icu -x '*' -tb -d $(OUTDIR)/icu4j/com/ibm/icu/dev/data/testdata
166 $(JAR) cf $(OUTDIR)/icu4j/testdata.jar -C $(OUTDIR)/icu4j com/ibm/icu/dev/data/testdata
169 DEBUGUTILITIESDATA_DIR=main/tests/core/src/com/ibm/icu/dev/test/util
170 DEBUGUTILITIESDATA_SRC=DebugUtilitiesData.java
172 ICU4J_DATA=$(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC) $(OUTDIR)/icu4j/testdata.jar
174 $(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC): $(GENTEST)
175 mkdir -p $(OUTDIR)/icu4j/src
176 $(INVOKE) $(GENTEST) -j -d $(OUTDIR)/icu4j/src
180 icu4j-data-install: $(ICU4J_ROOT)/main/shared/data/testdata.jar $(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)/$(DEBUGUTILITIESDATA_SRC)
181 @echo ICU4J test data installed in $(ICU4J_ROOT)
183 $(ICU4J_ROOT)/main/shared/data/testdata.jar: $(OUTDIR)/icu4j/testdata.jar
184 mkdir -p $(ICU4J_ROOT)/main/shared/data
185 cp $(OUTDIR)/icu4j/testdata.jar $(ICU4J_ROOT)/main/shared/data
187 $(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)/$(DEBUGUTILITIESDATA_SRC): $(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC)
188 mkdir -p $(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)
193 icu4j-data-install: $(ICU4J_DATA)
194 @echo ICU4J data was built into $(OUTDIR)/icu4j
195 @echo '** Error:' ICU4J_ROOT was not set, could not install
200 icu4j-data: $(ICU4J_DATA)