Home | History | Annotate | Download | only in testdata
      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
     11 srcdir = @srcdir@
     12 top_srcdir = @top_srcdir@
     13 
     14 top_builddir = ../..
     15 
     16 include $(top_builddir)/icudefs.mk
     17 
     18 ## Build directory information
     19 subdir = test/testdata
     20 
     21 ## Files to remove for 'make clean'
     22 CLEANFILES = *~ 
     23 
     24 SUBDIRS = 
     25 
     26 -include Makefile.local
     27 
     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 check-exhaustive
     33 
     34 xcheck: all-local
     35 
     36 .NOTPARALLEL: build-dir
     37 
     38 ## Clear suffix list
     39 .SUFFIXES :
     40 
     41 ## List of standard targets
     42 all: all-local
     43 install: install-local
     44 clean: clean-local
     45 distclean : distclean-local
     46 dist: dist-local
     47 check: all check-local
     48 
     49 check-exhaustive: check
     50 
     51 all-local: build-dir build-testdata testdata packagetest
     52 
     53 install-local: 
     54 
     55 dist-local:
     56 
     57 clean-local:
     58 	test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
     59 	$(RMV) $(TESTOUTDIR)
     60 
     61 distclean-local: clean-local
     62 	$(RMV) Makefile pkgdata.inc
     63 
     64 check-local:
     65 
     66 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     67 	cd $(top_builddir) \
     68 	&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
     69 
     70 pkgdata.inc: pkgdataMakefile
     71 	$(MAKE) -f pkgdataMakefile
     72 
     73 pkgdataMakefile:
     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
     81 GENRBOPTS=-k
     82 # use the cross root, in case we are cross compiling. Otherwise it is equal to top_builddir
     83 TOOLDIR=$(cross_buildroot)/tools
     84 SRCDATADIR=$(top_srcdir)/data
     85 UNICODEDATADIR=$(SRCDATADIR)/unidata
     86 OUTDIR=$(top_builddir)/data/out
     87 OUTTMPDIR=$(top_builddir)/data/out/tmp
     88 BUILDDIR=$(OUTDIR)/build/$(ICUDATA_PLATFORM_NAME)
     89 TESTSRCDATADIR=$(top_srcdir)/test/testdata
     90 TESTOUTDIR=$(top_builddir)/test/testdata/out
     91 BUILD_DIRS = $(TESTOUTDIR) $(TESTBUILDDIR) $(TESTOUTDIR)/$(TESTDT)
     92 GENTEST=$(TOOLDIR)/gentest/gentest$(TOOLEXEEXT)
     93 
     94 ifeq ($(PKGDATA_MODE),common)
     95 ICU_DATA_OPT = -i $(OUTDIR)
     96 else
     97 ifeq ($(PKGDATA_MODE),dll)
     98 ifneq ($(ENABLE_SHARED),YES)
     99 ICU_DATA_OPT = -i $(BUILDDIR)
    100 else
    101 ICU_DATA_OPT =
    102 endif
    103 else
    104 ICU_DATA_OPT = -i $(BUILDDIR)
    105 endif
    106 endif
    107 
    108 CURDIR:=$(CURR_FULL_DIR)
    109 # current directory should not be blank
    110 ifeq ($(CURDIR),)
    111 CURDIR=.
    112 endif
    113 
    114 PKGDATA = $(TOOLBINDIR)/pkgdata -q -c -s $(CURDIR)/out/build/$(ICUDATA_PLATFORM_NAME)
    115 PKGDATA_INVOKE:=$(INVOKE) $(PKGDATA_INVOKE_OPTS)
    116 
    117 # Contains all 'intermediate' files (and temp files) except for 'unpackaged data' below
    118 TESTBUILDDIR=$(TESTOUTDIR)/build
    119 
    120 # unpackaged files  - live in 'out' so that the path can find them as part of the pkg
    121 UNPACKAGEDTESTDATA=$(TESTOUTDIR)/$(TESTDT)/nam.typ
    122 
    123 # pkg name for testdata
    124 TESTDATA=testdata
    125 # prefix for files that are testdata
    126 TESTDT=$(TESTDATA)
    127 
    128 # File definitions 
    129 TEST_DAT_FILES=$(TESTBUILDDIR)/test.icu
    130 TEST_SPP_FILES=$(TESTBUILDDIR)/nfscsi.spp $(TESTBUILDDIR)/nfscss.spp $(TESTBUILDDIR)/nfscis.spp $(TESTBUILDDIR)/nfsmxs.spp $(TESTBUILDDIR)/nfsmxp.spp
    131 
    132 TEST_UCM_SOURCE= test1.ucm test1bmp.ucm test2.ucm test3.ucm test4.ucm test4x.ucm test5.ucm ibm9027.ucm
    133 TEST_UCM_FILES=$(TEST_UCM_SOURCE:%=$(TESTSRCDATADIR)/data/%)
    134 TEST_CNV_FILES=$(TEST_UCM_SOURCE:%.ucm=$(TESTBUILDDIR)/%.cnv)
    135 
    136 TEST_NRM_FILES=$(TESTBUILDDIR)/testnorm.nrm
    137 
    138 # import the shared .mk file
    139 include $(TESTSRCDATADIR)/tstfiles.mk
    140 -include $(TESTSRCDATADIR)/tstlocal.mk
    141 
    142 # TEST_RES_SOURCE comes from tstfiles.mk
    143 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 metaZones.txt timezoneTypes.txt windowsZones.txt zoneinfo64.txt
    144 TEST_RES_FILES=$(TEST_RES:%.txt=$(TESTBUILDDIR)/%.res) $(TESTBUILDDIR)/encoded.res $(TESTBUILDDIR)/old_l_testtypes.res $(TESTBUILDDIR)/old_e_testtypes.res
    145 
    146 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 $(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 
    158 build-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 
    221 testdata: build-dir $(ALL_TEST_FILES) $(UNPACKAGEDTESTDATA)
    222 
    223 #$(ALL_TEST_FILES) $(TESTBUILDDIR)/testtable32.txt $(TESTBUILDDIR)/testdata.lst: build-dir
    224 
    225 packagetest: 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 
    228 build-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.
    238 JAR=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 
    250 DEBUGUTILITIESDATA_DIR=main/tests/core/src/com/ibm/icu/dev/test/util
    251 DEBUGUTILITIESDATA_SRC=DebugUtilitiesData.java
    252 
    253 ICU4J_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 
    259 ifdef ICU4J_ROOT
    260 
    261 icu4j-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 
    272 else
    273 
    274 icu4j-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 
    279 endif
    280 
    281 icu4j-data: $(ICU4J_DATA)
    282