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