1#****************************************************************************** 2# 3# Copyright (C) 1998-2015, International Business Machines 4# Corporation and others. All Rights Reserved. 5# 6#****************************************************************************** 7## Top-level Makefile.in for ICU 8## Stephen F. Booth 9 10## Source directory information 11srcdir = @srcdir@ 12top_srcdir = @top_srcdir@ 13 14top_builddir = ../.. 15 16include $(top_builddir)/icudefs.mk 17 18## Build directory information 19subdir = test/testdata 20 21## Files to remove for 'make clean' 22CLEANFILES = *~ 23 24SUBDIRS = 25 26-include Makefile.local 27 28## List of phony targets 29.PHONY : all all-local all-recursive install install-local \ 30install-recursive clean clean-local clean-recursive distclean \ 31distclean-local distclean-recursive doc dist dist-local dist-recursive \ 32check check-local check-recursive build-dir testdata.jar xcheck check-exhaustive 33 34xcheck: all-local 35 36.NOTPARALLEL: build-dir 37 38## Clear suffix list 39.SUFFIXES : 40 41## List of standard targets 42all: all-local 43install: install-local 44clean: clean-local 45distclean : distclean-local 46dist: dist-local 47check: all check-local 48 49check-exhaustive: check 50 51all-local: build-dir build-testdata testdata packagetest 52 53install-local: 54 55dist-local: 56 57clean-local: 58 test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES) 59 $(RMV) $(TESTOUTDIR) 60 61distclean-local: clean-local 62 $(RMV) Makefile pkgdata.inc 63 64check-local: 65 66Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 67 cd $(top_builddir) \ 68 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status 69 70pkgdata.inc: pkgdataMakefile 71 $(MAKE) -f pkgdataMakefile 72 73pkgdataMakefile: 74 cd $(top_builddir) \ 75 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status 76 77######################################################################### 78############################## Test ## stuff ############################ 79 80# relative lib links from pkgdata are the same as for tmp 81GENRBOPTS=-k 82# use the cross root, in case we are cross compiling. Otherwise it is equal to top_builddir 83TOOLDIR=$(cross_buildroot)/tools 84SRCDATADIR=$(top_srcdir)/data 85UNICODEDATADIR=$(SRCDATADIR)/unidata 86OUTDIR=$(top_builddir)/data/out 87OUTTMPDIR=$(top_builddir)/data/out/tmp 88BUILDDIR=$(OUTDIR)/build/$(ICUDATA_PLATFORM_NAME) 89TESTSRCDATADIR=$(top_srcdir)/test/testdata 90TESTOUTDIR=$(top_builddir)/test/testdata/out 91BUILD_DIRS = $(TESTOUTDIR) $(TESTBUILDDIR) $(TESTOUTDIR)/$(TESTDT) 92GENTEST=$(TOOLDIR)/gentest/gentest$(TOOLEXEEXT) 93 94ifeq ($(PKGDATA_MODE),common) 95ICU_DATA_OPT = -i $(OUTDIR) 96else 97ifeq ($(PKGDATA_MODE),dll) 98ifneq ($(ENABLE_SHARED),YES) 99ICU_DATA_OPT = -i $(BUILDDIR) 100else 101ICU_DATA_OPT = 102endif 103else 104ICU_DATA_OPT = -i $(BUILDDIR) 105endif 106endif 107 108CURDIR:=$(CURR_FULL_DIR) 109# current directory should not be blank 110ifeq ($(CURDIR),) 111CURDIR=. 112endif 113 114PKGDATA = $(TOOLBINDIR)/pkgdata -q -c -s $(CURDIR)/out/build/$(ICUDATA_PLATFORM_NAME) 115PKGDATA_INVOKE:=$(INVOKE) $(PKGDATA_INVOKE_OPTS) 116 117# Contains all 'intermediate' files (and temp files) except for 'unpackaged data' below 118TESTBUILDDIR=$(TESTOUTDIR)/build 119 120# unpackaged files - live in 'out' so that the path can find them as part of the pkg 121UNPACKAGEDTESTDATA=$(TESTOUTDIR)/$(TESTDT)/nam.typ 122 123# pkg name for testdata 124TESTDATA=testdata 125# prefix for files that are testdata 126TESTDT=$(TESTDATA) 127 128# File definitions 129TEST_DAT_FILES=$(TESTBUILDDIR)/test.icu 130TEST_SPP_FILES=$(TESTBUILDDIR)/nfscsi.spp $(TESTBUILDDIR)/nfscss.spp $(TESTBUILDDIR)/nfscis.spp $(TESTBUILDDIR)/nfsmxs.spp $(TESTBUILDDIR)/nfsmxp.spp 131 132TEST_UCM_SOURCE= test1.ucm test1bmp.ucm test2.ucm test3.ucm test4.ucm test4x.ucm test5.ucm ibm9027.ucm 133TEST_UCM_FILES=$(TEST_UCM_SOURCE:%=$(TESTSRCDATADIR)/data/%) 134TEST_CNV_FILES=$(TEST_UCM_SOURCE:%.ucm=$(TESTBUILDDIR)/%.cnv) 135 136TEST_NRM_FILES=$(TESTBUILDDIR)/testnorm.nrm 137 138# import the shared .mk file 139include $(TESTSRCDATADIR)/tstfiles.mk 140-include $(TESTSRCDATADIR)/tstlocal.mk 141 142# TEST_RES_SOURCE comes from tstfiles.mk 143TEST_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 metaZones.txt timezoneTypes.txt windowsZones.txt zoneinfo64.txt 144TEST_RES_FILES=$(TEST_RES:%.txt=$(TESTBUILDDIR)/%.res) $(TESTBUILDDIR)/encoded.res $(TESTBUILDDIR)/old_l_testtypes.res $(TESTBUILDDIR)/old_e_testtypes.res 145 146ALL_TEST_FILES = $(TEST_DAT_FILES) $(TEST_SPP_FILES) $(TEST_BRK_FILES) $(TEST_CNV_FILES) $(TEST_NRM_FILES) $(TEST_RES_FILES) $(TESTOUTDIR)/$(TESTDT)/nam.typ $(TESTOUTDIR)/$(TESTDT)/zoneinfo64.res 147 148# list 149 150$(TESTBUILDDIR)/testdata.lst: $(SRCLISTDEPS) 151 @echo "generating $@ (list of data files)" 152 @-$(RMV) $@ 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 \ 154 echo $$file >> $@; \ 155 done; 156 157 158build-testdata: build-dir $(ALL_TEST_FILES) $(TESTBUILDDIR)/testdata.lst $(TESTBUILDDIR)/encoded.res 159 160# test.icu 161$(TESTBUILDDIR)/test.icu: $(GENTEST) 162 $(INVOKE) $(GENTEST) -d $(TESTBUILDDIR) 163 164$(TESTBUILDDIR)/testtable32.txt: $(GENTEST) 165 $(INVOKE) $(GENTEST) -r -d $(TESTBUILDDIR) 166 167$(TESTBUILDDIR)/testtable32.res: $(TESTBUILDDIR)/testtable32.txt $(TOOLBINDIR)/genrb$(EXEEXT) 168 $(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -s $(TESTBUILDDIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) $(<F) 169 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 174 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 179 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 184 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 189 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 194 195$(TESTBUILDDIR)/%.cnv: $(TESTSRCDATADIR)/%.ucm $(TOOLBINDIR)/makeconv$(EXEEXT) 196 $(INVOKE) $(TOOLBINDIR)/makeconv --small -c -d $(TESTBUILDDIR) $(TESTSRCDATADIR)/$(<F) 197 198$(TESTBUILDDIR)/%.nrm: $(TESTSRCDATADIR)/%.txt $(TOOLBINDIR)/gennorm2$(EXEEXT) 199 $(INVOKE) $(TOOLBINDIR)/gennorm2 -s $(TESTSRCDATADIR) $(<F) -o $@ 200 201$(TESTBUILDDIR)/%.res: $(TESTSRCDATADIR)/%.txt $(TOOLBINDIR)/genrb$(EXEEXT) $(DAT_FILES) 202 $(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -q -s $(TESTSRCDATADIR) $(ICU_DATA_OPT) -d $(TESTBUILDDIR) $(<F) 203 204$(TESTBUILDDIR)/encoded.res: $(TESTSRCDATADIR)/encoded.utf16be $(TOOLBINDIR)/genrb$(EXEEXT) 205 @echo Testing genrb -e option 206 ICU_DATA=$(BUILDDIR) $(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -s $(TESTSRCDATADIR) -eUTF-16BE -d $(TESTBUILDDIR) $(<F) 207 @echo Finished testing genrb -e option 208 209################################################################### TYP 210# TYP FILES 211 212$(TESTOUTDIR)/$(TESTDT)/nam.typ: $(TESTBUILDDIR)/te_IN.res 213 cp $< $@ 214$(TESTBUILDDIR)/old_l_testtypes.res: $(TESTSRCDATADIR)/old_l_testtypes.res 215 cp $< $@ 216$(TESTBUILDDIR)/old_e_testtypes.res: $(TESTSRCDATADIR)/old_e_testtypes.res 217 cp $< $@ 218$(TESTOUTDIR)/$(TESTDT)/zoneinfo64.res: $(TESTBUILDDIR)/zoneinfo64.res 219 cp $< $@ 220 221testdata: build-dir $(ALL_TEST_FILES) $(UNPACKAGEDTESTDATA) 222 223#$(ALL_TEST_FILES) $(TESTBUILDDIR)/testtable32.txt $(TESTBUILDDIR)/testdata.lst: build-dir 224 225packagetest: build-dir testdata pkgdata.inc $(TESTBUILDDIR)/testdata.lst 226 $(PKGDATA_INVOKE) $(PKGDATA) -T $(TESTBUILDDIR) -d $(TESTOUTDIR) -s $(TESTBUILDDIR) -p $(TESTDATA) -m common $(TESTBUILDDIR)/testdata.lst 227 228build-dir: $(BUILD_DIRS) 229$(BUILD_DIRS): 230 -$(MKINSTALLDIRS) $(BUILD_DIRS) 231 232# Build the ICU4J testdata.jar. 233# Command line: 234# (Run this from the output testdata folder which may not be .../source/test/testdata in an out-of-source build.) 235# ~/svn.icu/trunk/source/test/testdata> make JAR=jar ICU4J_ROOT=~/svn.icu4j/trunk testdata.jar 236# You can omit the ICU4J_ROOT for just building the .jar files without copying them. 237# You can omit the JAR if it's just jar. 238JAR=jar 239 240# Build testdata.jar: 241# - swap the test data 242# - extract all data items 243# - package them into the .jar file 244$(OUTDIR)/icu4j/testdata.jar: build-dir testdata $(TESTOUTDIR)/testdata.dat 245 mkdir -p $(OUTDIR)/icu4j/com/ibm/icu/dev/data/testdata 246 $(INVOKE) $(TOOLBINDIR)/icupkg $(TESTOUTDIR)/testdata.dat -r test.icu -x '*' -tb -d $(OUTDIR)/icu4j/com/ibm/icu/dev/data/testdata 247 $(JAR) cf $(OUTDIR)/icu4j/testdata.jar -C $(OUTDIR)/icu4j com/ibm/icu/dev/data/testdata 248 249 250DEBUGUTILITIESDATA_DIR=main/tests/core/src/com/ibm/icu/dev/test/util 251DEBUGUTILITIESDATA_SRC=DebugUtilitiesData.java 252 253ICU4J_DATA=$(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC) $(OUTDIR)/icu4j/testdata.jar 254 255$(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC): $(GENTEST) 256 mkdir -p $(OUTDIR)/icu4j/src 257 $(INVOKE) $(GENTEST) -j -d $(OUTDIR)/icu4j/src 258 259ifdef ICU4J_ROOT 260 261icu4j-data-install: $(ICU4J_ROOT)/main/shared/data/testdata.jar $(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)/$(DEBUGUTILITIESDATA_SRC) 262 @echo ICU4J test data installed in $(ICU4J_ROOT) 263 264$(ICU4J_ROOT)/main/shared/data/testdata.jar: $(OUTDIR)/icu4j/testdata.jar 265 mkdir -p $(ICU4J_ROOT)/main/shared/data 266 cp $(OUTDIR)/icu4j/testdata.jar $(ICU4J_ROOT)/main/shared/data 267 268$(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)/$(DEBUGUTILITIESDATA_SRC): $(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC) 269 mkdir -p $(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR) 270 cp $^ $@ 271 272else 273 274icu4j-data-install: $(ICU4J_DATA) 275 @echo ICU4J data was built into $(OUTDIR)/icu4j 276 @echo '** Error:' ICU4J_ROOT was not set, could not install 277 exit 1 278 279endif 280 281icu4j-data: $(ICU4J_DATA) 282