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) 95LIBRARY_DATA_DIR=$(OUTDIR)/build 96 97ifeq ($(PKGDATA_MODE),common) 98ICU_DATA_OPT = -i $(OUTDIR) 99else 100ifeq ($(PKGDATA_MODE),dll) 101ifneq ($(ENABLE_SHARED),YES) 102ICU_DATA_OPT = -i $(BUILDDIR) 103else 104ICU_DATA_OPT = 105endif 106else 107ICU_DATA_OPT = -i $(BUILDDIR) 108endif 109endif 110 111CURDIR:=$(CURR_FULL_DIR) 112# current directory should not be blank 113ifeq ($(CURDIR),) 114CURDIR=. 115endif 116 117PKGDATA = $(TOOLBINDIR)/pkgdata -q -c -s $(CURDIR)/out/build/$(ICUDATA_PLATFORM_NAME) 118PKGDATA_INVOKE:=$(INVOKE) $(PKGDATA_INVOKE_OPTS) 119 120# Contains all 'intermediate' files (and temp files) except for 'unpackaged data' below 121TESTBUILDDIR=$(TESTOUTDIR)/build 122 123# unpackaged files - live in 'out' so that the path can find them as part of the pkg 124UNPACKAGEDTESTDATA=$(TESTOUTDIR)/$(TESTDT)/nam.typ 125 126# pkg name for testdata 127TESTDATA=testdata 128# prefix for files that are testdata 129TESTDT=$(TESTDATA) 130 131# Variable names for rules.mk 132OUT_DIR=$(TESTBUILDDIR) 133TMP_DIR=$(TESTOUTDIR)/$(TESTDT) 134 135## Include the Python-generated rules 136 137include $(top_builddir)/$(subdir)/rules.mk 138 139 140build-testdata: build-dir $(TESTDATA_ALL_OUTPUT_FILES) 141 142testdata: build-testdata 143 144 145packagetest: build-dir testdata pkgdata.inc $(TMP_DIR)/testdata.lst 146 $(PKGDATA_INVOKE) $(PKGDATA) -T $(TESTBUILDDIR) -d $(TESTOUTDIR) -s $(TESTBUILDDIR) -p $(TESTDATA) -m common $(TMP_DIR)/testdata.lst 147 148build-dir: $(BUILD_DIRS) 149$(BUILD_DIRS): 150 -$(MKINSTALLDIRS) $(BUILD_DIRS) 151 152# Build the ICU4J testdata.jar. 153# Command line: 154# (Run this from the output testdata folder which may not be .../source/test/testdata in an out-of-source build.) 155# ~/svn.icu/trunk/source/test/testdata> make JAR=jar ICU4J_ROOT=~/svn.icu4j/trunk testdata.jar 156# You can omit the ICU4J_ROOT for just building the .jar files without copying them. 157# You can omit the JAR if it's just jar. 158JAR=jar 159 160# Build testdata.jar: 161# - swap the test data 162# - extract all data items 163# - package them into the .jar file 164$(OUTDIR)/icu4j/testdata.jar: build-dir testdata $(TESTOUTDIR)/testdata.dat 165 mkdir -p $(OUTDIR)/icu4j/com/ibm/icu/dev/data/testdata 166 $(INVOKE) $(TOOLBINDIR)/icupkg $(TESTOUTDIR)/testdata.dat -r test.icu -x '*' -tb -d $(OUTDIR)/icu4j/com/ibm/icu/dev/data/testdata 167 $(JAR) cf $(OUTDIR)/icu4j/testdata.jar -C $(OUTDIR)/icu4j com/ibm/icu/dev/data/testdata 168 169 170DEBUGUTILITIESDATA_DIR=main/core/src/test/java/com/ibm/icu/dev/test/util 171DEBUGUTILITIESDATA_SRC=DebugUtilitiesData.java 172 173ICU4J_DATA=$(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC) $(OUTDIR)/icu4j/testdata.jar 174 175$(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC): $(GENTEST) 176 mkdir -p $(OUTDIR)/icu4j/src 177 $(INVOKE) $(GENTEST) -j -d $(OUTDIR)/icu4j/src 178 179ifdef ICU4J_ROOT 180 181icu4j-data-install: $(ICU4J_ROOT)/main/shared/data/testdata.jar $(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)/$(DEBUGUTILITIESDATA_SRC) 182 @echo ICU4J test data installed in $(ICU4J_ROOT) 183 184$(ICU4J_ROOT)/main/shared/data/testdata.jar: $(OUTDIR)/icu4j/testdata.jar 185 mkdir -p $(ICU4J_ROOT)/main/shared/data 186 cp $(OUTDIR)/icu4j/testdata.jar $(ICU4J_ROOT)/main/shared/data 187 188$(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)/$(DEBUGUTILITIESDATA_SRC): $(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC) 189 mkdir -p $(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR) 190 cp $^ $@ 191 192else 193 194icu4j-data-install: $(ICU4J_DATA) 195 @echo ICU4J data was built into $(OUTDIR)/icu4j 196 @echo '** Error:' ICU4J_ROOT was not set, could not install 197 exit 1 198 199endif 200 201icu4j-data: $(ICU4J_DATA) 202