+# Build the ICU4J testdata.jar.
+# Command line:
+# (Run this from the output testdata folder which may not be .../source/test/testdata in an out-of-source build.)
+# ~/svn.icu/trunk/source/test/testdata> make JAR=jar ICU4J_ROOT=~/svn.icu4j/trunk testdata.jar
+# You can omit the ICU4J_ROOT for just building the .jar files without copying them.
+# You can omit the JAR if it's just jar.
+JAR=jar
+
+# Build testdata.jar:
+# - swap the test data
+# - extract all data items
+# - package them into the .jar file
+$(OUTDIR)/icu4j/testdata.jar: build-dir testdata $(TESTOUTDIR)/testdata.dat
+ mkdir -p $(OUTDIR)/icu4j/com/ibm/icu/dev/data/testdata
+ $(INVOKE) $(TOOLBINDIR)/icupkg $(TESTOUTDIR)/testdata.dat -r test.icu -x '*' -tb -d $(OUTDIR)/icu4j/com/ibm/icu/dev/data/testdata
+ $(JAR) cf $(OUTDIR)/icu4j/testdata.jar -C $(OUTDIR)/icu4j com/ibm/icu/dev/data/testdata
+
+
+DEBUGUTILITIESDATA_DIR=main/tests/core/src/com/ibm/icu/dev/test/util
+DEBUGUTILITIESDATA_SRC=DebugUtilitiesData.java
+
+ICU4J_DATA=$(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC) $(OUTDIR)/icu4j/testdata.jar
+
+$(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC): $(GENTEST)
+ mkdir -p $(OUTDIR)/icu4j/src
+ $(INVOKE) $(GENTEST) -j -d $(OUTDIR)/icu4j/src
+
+ifdef ICU4J_ROOT
+
+icu4j-data-install: $(ICU4J_ROOT)/main/shared/data/testdata.jar $(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)/$(DEBUGUTILITIESDATA_SRC)
+ @echo ICU4J test data installed in $(ICU4J_ROOT)
+
+$(ICU4J_ROOT)/main/shared/data/testdata.jar: $(OUTDIR)/icu4j/testdata.jar
+ mkdir -p $(ICU4J_ROOT)/main/shared/data
+ cp $(OUTDIR)/icu4j/testdata.jar $(ICU4J_ROOT)/main/shared/data
+
+$(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)/$(DEBUGUTILITIESDATA_SRC): $(OUTDIR)/icu4j/src/$(DEBUGUTILITIESDATA_SRC)
+ mkdir -p $(ICU4J_ROOT)/$(DEBUGUTILITIESDATA_DIR)
+ cp $^ $@
+
+else
+
+icu4j-data-install: $(ICU4J_DATA)
+ @echo ICU4J data was built into $(OUTDIR)/icu4j
+ @echo '** Error:' ICU4J_ROOT was not set, could not install
+ exit 1
+
+endif