1 #******************************************************************************
3 # Copyright (C) 1998-2010, 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
36 .NOTPARALLEL: build-dir
41 ## List of standard targets
43 install: install-local
45 distclean : distclean-local
47 check: all check-local
49 all-local: build-dir build-testdata testdata packagetest
56 test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
59 distclean-local: clean-local
60 $(RMV) Makefile pkgdata.inc
64 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
66 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
68 pkgdata.inc: pkgdataMakefile
69 $(MAKE) -f pkgdataMakefile
73 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
75 #########################################################################
76 ############################## Test ## stuff ############################
78 # relative lib links from pkgdata are the same as for tmp
80 # use the cross root, in case we are cross compiling. Otherwise it is equal to top_builddir
81 TOOLDIR=$(cross_buildroot)/tools
82 SRCDATADIR=$(top_srcdir)/data
83 UNICODEDATADIR=$(SRCDATADIR)/unidata
84 OUTDIR=$(top_builddir)/data/out
85 OUTTMPDIR=$(top_builddir)/data/out/tmp
86 BUILDDIR=$(OUTDIR)/build/$(ICUDATA_PLATFORM_NAME)
87 TESTSRCDATADIR=$(top_srcdir)/test/testdata
88 TESTOUTDIR=$(top_builddir)/test/testdata/out
89 BUILD_DIRS = $(TESTOUTDIR) $(TESTBUILDDIR) $(TESTOUTDIR)/$(TESTDT)
90 GENTEST=$(TOOLDIR)/gentest/gentest$(TOOLEXEEXT)
92 ifeq ($(PKGDATA_MODE),common)
93 ICU_DATA_OPT = -i $(OUTDIR)
95 ifeq ($(PKGDATA_MODE),dll)
96 ifneq ($(ENABLE_SHARED),YES)
97 ICU_DATA_OPT = -i $(BUILDDIR)
102 ICU_DATA_OPT = -i $(BUILDDIR)
106 CURDIR:=$(CURR_FULL_DIR)
107 # current directory should not be blank
112 PKGDATA = $(TOOLBINDIR)/pkgdata -q -c -s $(CURDIR)/out/build/$(ICUDATA_PLATFORM_NAME)
113 PKGDATA_INVOKE:=$(INVOKE) $(PKGDATA_INVOKE_OPTS)
115 # Contains all 'intermediate' files (and temp files) except for 'unpackaged data' below
116 TESTBUILDDIR=$(TESTOUTDIR)/build
118 # unpackaged files - live in 'out' so that the path can find them as part of the pkg
119 UNPACKAGEDTESTDATA=$(TESTOUTDIR)/$(TESTDT)/nam.typ
121 # pkg name for testdata
123 # prefix for files that are testdata
127 TEST_DAT_FILES=$(TESTBUILDDIR)/test.icu
128 TEST_SPP_FILES=$(TESTBUILDDIR)/nfscsi.spp $(TESTBUILDDIR)/nfscss.spp $(TESTBUILDDIR)/nfscis.spp $(TESTBUILDDIR)/nfsmxs.spp $(TESTBUILDDIR)/nfsmxp.spp
130 TEST_UCM_SOURCE= test1.ucm test1bmp.ucm test3.ucm test4.ucm test4x.ucm test5.ucm ibm9027.ucm
131 TEST_UCM_FILES=$(TEST_UCM_SOURCE:%=$(TESTSRCDATADIR)/data/%)
132 TEST_CNV_FILES=$(TEST_UCM_SOURCE:%.ucm=$(TESTBUILDDIR)/%.cnv)
134 TEST_NRM_FILES=$(TESTBUILDDIR)/testnorm.nrm
136 # import the shared .mk file
137 include $(TESTSRCDATADIR)/tstfiles.mk
138 -include $(TESTSRCDATADIR)/tstlocal.mk
140 # TEST_RES_SOURCE comes from tstfiles.mk
141 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
142 TEST_RES_FILES=$(TEST_RES:%.txt=$(TESTBUILDDIR)/%.res) $(TESTBUILDDIR)/iscii.res $(TESTBUILDDIR)/old_l_testtypes.res $(TESTBUILDDIR)/old_e_testtypes.res
144 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
148 $(TESTBUILDDIR)/testdata.lst: $(SRCLISTDEPS)
149 @echo "generating $@ (list of data files)"
151 @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 \
156 build-testdata: build-dir $(ALL_TEST_FILES) $(TESTBUILDDIR)/testdata.lst $(TESTBUILDDIR)/iscii.res
159 $(TESTBUILDDIR)/test.icu: $(GENTEST)
160 $(INVOKE) $(GENTEST) -d $(TESTBUILDDIR)
162 $(TESTBUILDDIR)/testtable32.txt: $(GENTEST)
163 $(INVOKE) $(GENTEST) -r -d $(TESTBUILDDIR)
165 $(TESTBUILDDIR)/testtable32.res: $(TESTBUILDDIR)/testtable32.txt $(TOOLBINDIR)/genrb$(EXEEXT)
166 $(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -s $(TESTBUILDDIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) $(<F)
168 # Targets for nfscsi.spp
169 $(TESTBUILDDIR)/nfscsi.spp: $(TOOLBINDIR)/gensprep$(EXEEXT) $(TESTSRCDATADIR)/nfs4_cs_prep_ci.txt
170 @echo Building nfscsi.icu
171 $(INVOKE) $(TOOLBINDIR)/gensprep -s $(TESTSRCDATADIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) -b nfscsi -u 3.2.0 nfs4_cs_prep_ci.txt
173 # Targets for nfscss.spp
174 $(TESTBUILDDIR)/nfscss.spp: $(TOOLBINDIR)/gensprep$(EXEEXT) $(TESTSRCDATADIR)/nfs4_cs_prep_cs.txt
175 @echo Building nfscss.icu
176 $(INVOKE) $(TOOLBINDIR)/gensprep -s $(TESTSRCDATADIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) -b nfscss -u 3.2.0 nfs4_cs_prep_cs.txt
178 # Targets for nfscis.spp
179 $(TESTBUILDDIR)/nfscis.spp: $(TOOLBINDIR)/gensprep$(EXEEXT) $(TESTSRCDATADIR)/nfs4_cis_prep.txt
180 @echo Building nfscis.spp
181 $(INVOKE) $(TOOLBINDIR)/gensprep -s $(TESTSRCDATADIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) -b nfscis -k -n $(UNICODEDATADIR) -u 3.2.0 nfs4_cis_prep.txt
183 # Targets for nfsmxs.spp
184 $(TESTBUILDDIR)/nfsmxs.spp: $(TOOLBINDIR)/gensprep$(EXEEXT) $(TESTSRCDATADIR)/nfs4_mixed_prep_s.txt
185 @echo Building nfsmxs.spp
186 $(INVOKE) $(TOOLBINDIR)/gensprep -s $(TESTSRCDATADIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) -b nfsmxs -k -n $(UNICODEDATADIR) -u 3.2.0 nfs4_mixed_prep_s.txt
188 # Targets for nfsmxp.spp
189 $(TESTBUILDDIR)/nfsmxp.spp: $(TOOLBINDIR)/gensprep$(EXEEXT) $(TESTSRCDATADIR)/nfs4_mixed_prep_p.txt
190 @echo Building nfsmxp.spp
191 $(INVOKE) $(TOOLBINDIR)/gensprep -s $(TESTSRCDATADIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) -b nfsmxp -k -n $(UNICODEDATADIR) -u 3.2.0 nfs4_mixed_prep_p.txt
193 $(TESTBUILDDIR)/%.cnv: $(TESTSRCDATADIR)/%.ucm $(TOOLBINDIR)/makeconv$(EXEEXT)
194 $(INVOKE) $(TOOLBINDIR)/makeconv --small -c -d $(TESTBUILDDIR) $(TESTSRCDATADIR)/$(<F)
196 $(TESTBUILDDIR)/%.nrm: $(TESTSRCDATADIR)/%.txt $(TOOLBINDIR)/gennorm2$(EXEEXT)
197 $(INVOKE) $(TOOLBINDIR)/gennorm2 -s $(TESTSRCDATADIR) $(<F) -o $@
199 $(TESTBUILDDIR)/%.res: $(TESTSRCDATADIR)/%.txt $(TOOLBINDIR)/genrb$(EXEEXT) $(DAT_FILES)
200 $(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -q -s $(TESTSRCDATADIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) $(<F)
202 $(TESTBUILDDIR)/iscii.res: $(TESTSRCDATADIR)/iscii.bin $(TOOLBINDIR)/genrb$(EXEEXT)
203 @echo Testing genrb -e option
204 @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 $@ )
205 @echo Finished testing genrb -e option
207 ################################################################### TYP
210 $(TESTOUTDIR)/$(TESTDT)/nam.typ: $(TESTBUILDDIR)/te_IN.res
212 $(TESTBUILDDIR)/old_l_testtypes.res: $(TESTSRCDATADIR)/old_l_testtypes.res
214 $(TESTBUILDDIR)/old_e_testtypes.res: $(TESTSRCDATADIR)/old_e_testtypes.res
217 testdata: build-dir $(ALL_TEST_FILES) $(UNPACKAGEDTESTDATA)
219 #$(ALL_TEST_FILES) $(TESTBUILDDIR)/testtable32.txt $(TESTBUILDDIR)/testdata.lst: build-dir
221 packagetest: build-dir testdata pkgdata.inc $(TESTBUILDDIR)/testdata.lst
222 $(PKGDATA_INVOKE) $(PKGDATA) -T $(TESTBUILDDIR) -d $(TESTOUTDIR) -s $(TESTBUILDDIR) -p $(TESTDATA) -m common $(TESTBUILDDIR)/testdata.lst
224 build-dir: $(BUILD_DIRS)
226 -$(MKINSTALLDIRS) $(BUILD_DIRS)
228 # Build the ICU4J testdata.jar.
230 # (Run this from the output testdata folder which may not be .../source/test/testdata in an out-of-source build.)
231 # ~/svn.icu/trunk/source/test/testdata> make JAR=jar ICU4J_ROOT=~/svn.icu4j/trunk testdata.jar
232 # You can omit the ICU4J_ROOT for just building the .jar files without copying them.
233 # You can omit the JAR if it's just jar.
236 # Build testdata.jar:
237 # - swap the test data
238 # - extract all data items
239 # - package them into the .jar file
240 $(OUTDIR)/icu4j/testdata.jar: build-dir testdata $(TESTOUTDIR)/testdata.dat
241 mkdir -p $(OUTDIR)/icu4j/com/ibm/icu/dev/data/testdata
242 $(INVOKE) $(TOOLBINDIR)/icupkg $(TESTOUTDIR)/testdata.dat -r test.icu -x '*' -tb -d $(OUTDIR)/icu4j/com/ibm/icu/dev/data/testdata
243 $(JAR) cf $(OUTDIR)/icu4j/testdata.jar -C $(OUTDIR)/icu4j com/ibm/icu/dev/data/testdata
246 DEBUGUTILITIESDATA_DIR=main/tests/core/src/com/ibm/icu/dev/test/util
247 DEBUGUTILITIESDATA_SRC=DebugUtilitiesData.java
249 ICU4J_DATA=$(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC) $(OUTDIR)/icu4j/testdata.jar
251 $(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC): $(GENTEST)
252 mkdir -p $(OUTDIR)/icu4j/src
253 $(INVOKE) $(GENTEST) -j -d $(OUTDIR)/icu4j/src
257 icu4j-data-install: $(ICU4J_ROOT)/main/shared/data/testdata.jar $(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)/$(DEBUGUTILITIESDATA_SRC)
258 @echo ICU4J test data installed in $(ICU4J_ROOT)
260 $(ICU4J_ROOT)/main/shared/data/testdata.jar: $(OUTDIR)/icu4j/testdata.jar
261 mkdir -p $(ICU4J_ROOT)/main/shared/data
262 cp $(OUTDIR)/icu4j/testdata.jar $(ICU4J_ROOT)/main/shared/data
264 $(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)/$(DEBUGUTILITIESDATA_SRC): $(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC)
265 mkdir -p $(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)
270 icu4j-data-install: $(ICU4J_DATA)
271 @echo ICU4J data was built into $(OUTDIR)/icu4j
272 @echo '** Error:' ICU4J_ROOT was not set, could not install
277 icu4j-data: $(ICU4J_DATA)