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