1 #******************************************************************************
3 # Copyright (C) 1998-2011, International Business Machines
4 # Corporation and others. All Rights Reserved.
6 #******************************************************************************
7 ## Top-level Makefile.in for ICU
10 ## Source directory information
12 top_srcdir = @top_srcdir@
16 include $(top_builddir)/icudefs.mk
18 ## Build directory information
19 subdir = test/testdata
21 ## Files to remove for 'make clean'
26 -include Makefile.local
28 ## List of phony targets
29 .PHONY : all all-local all-recursive install install-local \
30 install-recursive clean clean-local clean-recursive distclean \
31 distclean-local distclean-recursive doc dist dist-local dist-recursive \
32 check check-local check-recursive build-dir testdata.jar xcheck check-exhaustive
36 .NOTPARALLEL: build-dir
41 ## List of standard targets
43 install: install-local
45 distclean : distclean-local
47 check: all check-local
49 check-exhaustive: check
51 all-local: build-dir build-testdata testdata packagetest
58 test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
61 distclean-local: clean-local
62 $(RMV) Makefile pkgdata.inc
66 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
68 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
70 pkgdata.inc: pkgdataMakefile
71 $(MAKE) -f pkgdataMakefile
75 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
77 #########################################################################
78 ############################## Test ## stuff ############################
80 # relative lib links from pkgdata are the same as for tmp
82 # use the cross root, in case we are cross compiling. Otherwise it is equal to top_builddir
83 TOOLDIR=$(cross_buildroot)/tools
84 SRCDATADIR=$(top_srcdir)/data
85 UNICODEDATADIR=$(SRCDATADIR)/unidata
86 OUTDIR=$(top_builddir)/data/out
87 OUTTMPDIR=$(top_builddir)/data/out/tmp
88 BUILDDIR=$(OUTDIR)/build/$(ICUDATA_PLATFORM_NAME)
89 TESTSRCDATADIR=$(top_srcdir)/test/testdata
90 TESTOUTDIR=$(top_builddir)/test/testdata/out
91 BUILD_DIRS = $(TESTOUTDIR) $(TESTBUILDDIR) $(TESTOUTDIR)/$(TESTDT)
92 GENTEST=$(TOOLDIR)/gentest/gentest$(TOOLEXEEXT)
94 ifeq ($(PKGDATA_MODE),common)
95 ICU_DATA_OPT = -i $(OUTDIR)
97 ifeq ($(PKGDATA_MODE),dll)
98 ifneq ($(ENABLE_SHARED),YES)
99 ICU_DATA_OPT = -i $(BUILDDIR)
104 ICU_DATA_OPT = -i $(BUILDDIR)
108 CURDIR:=$(CURR_FULL_DIR)
109 # current directory should not be blank
114 PKGDATA = $(TOOLBINDIR)/pkgdata -q -c -s $(CURDIR)/out/build/$(ICUDATA_PLATFORM_NAME)
115 PKGDATA_INVOKE:=$(INVOKE) $(PKGDATA_INVOKE_OPTS)
117 # Contains all 'intermediate' files (and temp files) except for 'unpackaged data' below
118 TESTBUILDDIR=$(TESTOUTDIR)/build
120 # unpackaged files - live in 'out' so that the path can find them as part of the pkg
121 UNPACKAGEDTESTDATA=$(TESTOUTDIR)/$(TESTDT)/nam.typ
123 # pkg name for testdata
125 # prefix for files that are testdata
129 TEST_DAT_FILES=$(TESTBUILDDIR)/test.icu
130 TEST_SPP_FILES=$(TESTBUILDDIR)/nfscsi.spp $(TESTBUILDDIR)/nfscss.spp $(TESTBUILDDIR)/nfscis.spp $(TESTBUILDDIR)/nfsmxs.spp $(TESTBUILDDIR)/nfsmxp.spp
132 TEST_UCM_SOURCE= test1.ucm test1bmp.ucm test3.ucm test4.ucm test4x.ucm test5.ucm ibm9027.ucm
133 TEST_UCM_FILES=$(TEST_UCM_SOURCE:%=$(TESTSRCDATADIR)/data/%)
134 TEST_CNV_FILES=$(TEST_UCM_SOURCE:%.ucm=$(TESTBUILDDIR)/%.cnv)
136 TEST_NRM_FILES=$(TESTBUILDDIR)/testnorm.nrm
138 # import the shared .mk file
139 include $(TESTSRCDATADIR)/tstfiles.mk
140 -include $(TESTSRCDATADIR)/tstlocal.mk
142 # TEST_RES_SOURCE comes from tstfiles.mk
143 TEST_RES = $(TEST_RES_SOURCE) $(TEST_RES_LOCAL) casing.txt mc.txt root.txt sh.txt sh_YU.txt te.txt te_IN.txt te_IN_REVISED.txt testtypes.txt testaliases.txt testempty.txt structLocale.txt idna_rules.txt conversion.txt icuio.txt testtable32.txt
144 TEST_RES_FILES=$(TEST_RES:%.txt=$(TESTBUILDDIR)/%.res) $(TESTBUILDDIR)/iscii.res $(TESTBUILDDIR)/old_l_testtypes.res $(TESTBUILDDIR)/old_e_testtypes.res
146 ALL_TEST_FILES = $(TEST_DAT_FILES) $(TEST_SPP_FILES) $(TEST_BRK_FILES) $(TEST_CNV_FILES) $(TEST_NRM_FILES) $(TEST_RES_FILES) $(TESTOUTDIR)/$(TESTDT)/nam.typ
150 $(TESTBUILDDIR)/testdata.lst: $(SRCLISTDEPS)
151 @echo "generating $@ (list of data files)"
153 @for file in $(TEST_RES_FILES:$(TESTBUILDDIR)/%.res=%.res) $(TEST_DAT_FILES:$(TESTBUILDDIR)/%.icu=%.icu) $(TEST_SPP_FILES:$(TESTBUILDDIR)/%.spp=%.spp) $(TEST_CNV_FILES:$(TESTBUILDDIR)/%.cnv=%.cnv) $(TEST_NRM_FILES:$(TESTBUILDDIR)/%.nrm=%.nrm); do \
158 build-testdata: build-dir $(ALL_TEST_FILES) $(TESTBUILDDIR)/testdata.lst $(TESTBUILDDIR)/iscii.res
161 $(TESTBUILDDIR)/test.icu: $(GENTEST)
162 $(INVOKE) $(GENTEST) -d $(TESTBUILDDIR)
164 $(TESTBUILDDIR)/testtable32.txt: $(GENTEST)
165 $(INVOKE) $(GENTEST) -r -d $(TESTBUILDDIR)
167 $(TESTBUILDDIR)/testtable32.res: $(TESTBUILDDIR)/testtable32.txt $(TOOLBINDIR)/genrb$(EXEEXT)
168 $(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -s $(TESTBUILDDIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) $(<F)
170 # Targets for nfscsi.spp
171 $(TESTBUILDDIR)/nfscsi.spp: $(TOOLBINDIR)/gensprep$(EXEEXT) $(TESTSRCDATADIR)/nfs4_cs_prep_ci.txt
172 @echo Building nfscsi.icu
173 $(INVOKE) $(TOOLBINDIR)/gensprep -s $(TESTSRCDATADIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) -b nfscsi -u 3.2.0 nfs4_cs_prep_ci.txt
175 # Targets for nfscss.spp
176 $(TESTBUILDDIR)/nfscss.spp: $(TOOLBINDIR)/gensprep$(EXEEXT) $(TESTSRCDATADIR)/nfs4_cs_prep_cs.txt
177 @echo Building nfscss.icu
178 $(INVOKE) $(TOOLBINDIR)/gensprep -s $(TESTSRCDATADIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) -b nfscss -u 3.2.0 nfs4_cs_prep_cs.txt
180 # Targets for nfscis.spp
181 $(TESTBUILDDIR)/nfscis.spp: $(TOOLBINDIR)/gensprep$(EXEEXT) $(TESTSRCDATADIR)/nfs4_cis_prep.txt
182 @echo Building nfscis.spp
183 $(INVOKE) $(TOOLBINDIR)/gensprep -s $(TESTSRCDATADIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) -b nfscis -k -n $(UNICODEDATADIR) -u 3.2.0 nfs4_cis_prep.txt
185 # Targets for nfsmxs.spp
186 $(TESTBUILDDIR)/nfsmxs.spp: $(TOOLBINDIR)/gensprep$(EXEEXT) $(TESTSRCDATADIR)/nfs4_mixed_prep_s.txt
187 @echo Building nfsmxs.spp
188 $(INVOKE) $(TOOLBINDIR)/gensprep -s $(TESTSRCDATADIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) -b nfsmxs -k -n $(UNICODEDATADIR) -u 3.2.0 nfs4_mixed_prep_s.txt
190 # Targets for nfsmxp.spp
191 $(TESTBUILDDIR)/nfsmxp.spp: $(TOOLBINDIR)/gensprep$(EXEEXT) $(TESTSRCDATADIR)/nfs4_mixed_prep_p.txt
192 @echo Building nfsmxp.spp
193 $(INVOKE) $(TOOLBINDIR)/gensprep -s $(TESTSRCDATADIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) -b nfsmxp -k -n $(UNICODEDATADIR) -u 3.2.0 nfs4_mixed_prep_p.txt
195 $(TESTBUILDDIR)/%.cnv: $(TESTSRCDATADIR)/%.ucm $(TOOLBINDIR)/makeconv$(EXEEXT)
196 $(INVOKE) $(TOOLBINDIR)/makeconv --small -c -d $(TESTBUILDDIR) $(TESTSRCDATADIR)/$(<F)
198 $(TESTBUILDDIR)/%.nrm: $(TESTSRCDATADIR)/%.txt $(TOOLBINDIR)/gennorm2$(EXEEXT)
199 $(INVOKE) $(TOOLBINDIR)/gennorm2 -s $(TESTSRCDATADIR) $(<F) -o $@
201 $(TESTBUILDDIR)/%.res: $(TESTSRCDATADIR)/%.txt $(TOOLBINDIR)/genrb$(EXEEXT) $(DAT_FILES)
202 $(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -q -s $(TESTSRCDATADIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) $(<F)
204 $(TESTBUILDDIR)/iscii.res: $(TESTSRCDATADIR)/iscii.bin $(TOOLBINDIR)/genrb$(EXEEXT)
205 @echo Testing genrb -e option
206 @ICU_DATA=$(BUILDDIR) $(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -s $(TESTSRCDATADIR) -eISCII,version=0 -d $(TESTBUILDDIR) $(<F) >/dev/null || ( echo "WARNING: could not open ISCII - it may have been disabled." | tee $@ )
207 @echo Finished testing genrb -e option
209 ################################################################### TYP
212 $(TESTOUTDIR)/$(TESTDT)/nam.typ: $(TESTBUILDDIR)/te_IN.res
214 $(TESTBUILDDIR)/old_l_testtypes.res: $(TESTSRCDATADIR)/old_l_testtypes.res
216 $(TESTBUILDDIR)/old_e_testtypes.res: $(TESTSRCDATADIR)/old_e_testtypes.res
219 testdata: build-dir $(ALL_TEST_FILES) $(UNPACKAGEDTESTDATA)
221 #$(ALL_TEST_FILES) $(TESTBUILDDIR)/testtable32.txt $(TESTBUILDDIR)/testdata.lst: build-dir
223 packagetest: build-dir testdata pkgdata.inc $(TESTBUILDDIR)/testdata.lst
224 $(PKGDATA_INVOKE) $(PKGDATA) -T $(TESTBUILDDIR) -d $(TESTOUTDIR) -s $(TESTBUILDDIR) -p $(TESTDATA) -m common $(TESTBUILDDIR)/testdata.lst
226 build-dir: $(BUILD_DIRS)
228 -$(MKINSTALLDIRS) $(BUILD_DIRS)
230 # Build the ICU4J testdata.jar.
232 # (Run this from the output testdata folder which may not be .../source/test/testdata in an out-of-source build.)
233 # ~/svn.icu/trunk/source/test/testdata> make JAR=jar ICU4J_ROOT=~/svn.icu4j/trunk testdata.jar
234 # You can omit the ICU4J_ROOT for just building the .jar files without copying them.
235 # You can omit the JAR if it's just jar.
238 # Build testdata.jar:
239 # - swap the test data
240 # - extract all data items
241 # - package them into the .jar file
242 $(OUTDIR)/icu4j/testdata.jar: build-dir testdata $(TESTOUTDIR)/testdata.dat
243 mkdir -p $(OUTDIR)/icu4j/com/ibm/icu/dev/data/testdata
244 $(INVOKE) $(TOOLBINDIR)/icupkg $(TESTOUTDIR)/testdata.dat -r test.icu -x '*' -tb -d $(OUTDIR)/icu4j/com/ibm/icu/dev/data/testdata
245 $(JAR) cf $(OUTDIR)/icu4j/testdata.jar -C $(OUTDIR)/icu4j com/ibm/icu/dev/data/testdata
248 DEBUGUTILITIESDATA_DIR=main/tests/core/src/com/ibm/icu/dev/test/util
249 DEBUGUTILITIESDATA_SRC=DebugUtilitiesData.java
251 ICU4J_DATA=$(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC) $(OUTDIR)/icu4j/testdata.jar
253 $(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC): $(GENTEST)
254 mkdir -p $(OUTDIR)/icu4j/src
255 $(INVOKE) $(GENTEST) -j -d $(OUTDIR)/icu4j/src
259 icu4j-data-install: $(ICU4J_ROOT)/main/shared/data/testdata.jar $(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)/$(DEBUGUTILITIESDATA_SRC)
260 @echo ICU4J test data installed in $(ICU4J_ROOT)
262 $(ICU4J_ROOT)/main/shared/data/testdata.jar: $(OUTDIR)/icu4j/testdata.jar
263 mkdir -p $(ICU4J_ROOT)/main/shared/data
264 cp $(OUTDIR)/icu4j/testdata.jar $(ICU4J_ROOT)/main/shared/data
266 $(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)/$(DEBUGUTILITIESDATA_SRC): $(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC)
267 mkdir -p $(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)
272 icu4j-data-install: $(ICU4J_DATA)
273 @echo ICU4J data was built into $(OUTDIR)/icu4j
274 @echo '** Error:' ICU4J_ROOT was not set, could not install
279 icu4j-data: $(ICU4J_DATA)