1 ########################################################-*-mode:Makefile-*- 2 ## ## 3 ## Centre for Speech Technology Research ## 4 ## University of Edinburgh, UK ## 5 ## Copyright (c) 1996,1997 ## 6 ## All Rights Reserved. ## 7 ## ## 8 ## Permission is hereby granted, free of charge, to use and distribute ## 9 ## this software and its documentation without restriction, including ## 10 ## without limitation the rights to use, copy, modify, merge, publish, ## 11 ## distribute, sublicense, and/or sell copies of this work, and to ## 12 ## permit persons to whom this work is furnished to do so, subject to ## 13 ## the following conditions: ## 14 ## 1. The code must retain the above copyright notice, this list of ## 15 ## conditions and the following disclaimer. ## 16 ## 2. Any modifications must be clearly marked as such. ## 17 ## 3. Original authors' names are not deleted. ## 18 ## 4. The authors' names are not used to endorse or promote products ## 19 ## derived from this software without specific prior written ## 20 ## permission. ## 21 ## ## 22 ## THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ## 23 ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 24 ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 25 ## SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ## 26 ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 27 ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 28 ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 29 ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 30 ## THIS SOFTWARE. ## 31 ## ## 32 ########################################################################### 33 # Makefile rules for testing things # 34 ########################################################################### 35 36TEST_PROGRAMS = $(TEST_MODULES:%=%_example) $(TEST_MODULES:%=%_regression) 37TSRCS = $(TEST_PROGRAMS:%=%.cc) 38SRCS = $(TSRCS) 39OBJS = $(SRCS:%.cc=%.o) 40SCRIPTS = $(TEST_SCRIPTS:%=%.sh) 41FILES = Makefile \ 42 $(SRCS) \ 43 $(SCRIPTS) \ 44 $(OTHERS) 45 46LOCAL_DEFINES += -DDATA="\"$(DATA)\"" 47 48include $(TOP)/config/common_make_rules 49 50test_scripts: $(TEST_SCRIPTS:%=%_script_test) 51 52test_modules: $(PROJECT_LIBDEPS) $(TEST_MODULES:%=%_module_build_and_test) 53 54just_test_scripts: test_scripts 55 56just_test_modules: $(TEST_MODULES:%=%_module_test) 57 58 59$(TEST_MODULES:%=%_module_build_and_test) : %_module_build_and_test : %_module_rebuild %_module_test 60 61$(TEST_MODULES:%=%_module_rebuild) : %_module_rebuild : 62 @echo 'build $* (module)' 63 @$(RM) -f $(OBJS) 64 @if $(MAKE) --no-print-directory PROJECT_LIBDEPS= OPTIMISE=$(TEST_OPTIMISE) WARN=1 $*_example $*_regression ;\ 65 then \ 66 : ;\ 67 else \ 68 echo $* example status: FAILED ; exit 1 ;\ 69 fi 70 71$(TEST_MODULES:%=%_module_test) : %_module_test : correct/%_example.out correct/%_regression.out 72 @echo 'test $* (module)' 73 @LD_LIBRARY_PATH='$(TOP)/lib:$(LD_LIBRARY_PATH)' ; export LD_LIBRARY_PATH;\ 74 if ./$*_example $($(*:=_example_args)) > $*_example.out ;\ 75 then \ 76 echo $*_example completed ;\ 77 if [ ! -f $*_example.out ] || diff correct/$*_example.out $*_example.out ;\ 78 then \ 79 echo $* example status: CORRECT ;\ 80 else \ 81 echo $* example status: INCORRECT ;\ 82 fi ;\ 83 else \ 84 echo $* example status: FAILED ;\ 85 fi ;\ 86 if ./$*_regression $($(*:=_regression_args)) > $*_regression.out ;\ 87 then \ 88 echo $*_regression completed ;\ 89 if [ ! -f $*_regression.out ] || diff correct/$*_regression.out $*_regression.out ;\ 90 then \ 91 echo $* regression status: CORRECT ;\ 92 else \ 93 echo $* regression status: INCORRECT ;\ 94 fi ;\ 95 else \ 96 echo $* regression status: FAILED ;\ 97 fi 98 @echo 99 @echo 100 101$(TEST_SCRIPTS:%=%_script_test) : %_script_test : %.sh correct/%_script.out 102 @echo 'test $* (script)' 103 @OUTPUT='$*_script.out' ;\ 104 TOP='$(TOP)' ;\ 105 DATA='$(DATA)' ;\ 106 export TOP OUTPUT DATA ;\ 107 LD_LIBRARY_PATH='$(TOP)/lib:$(LD_LIBRARY_PATH)' ; export LD_LIBRARY_PATH;\ 108 if /bin/sh $*.sh $($(*:=_script_args)) ;\ 109 then \ 110 echo $* script completed ;\ 111 if [ ! -f $*_script.out ] || diff correct/$*_script.out $*_script.out ;\ 112 then \ 113 echo $* script status: CORRECT ;\ 114 else \ 115 echo $* script status: INCORRECT ;\ 116 fi ;\ 117 else \ 118 echo $* script status: FAILED ;\ 119 fi 120 @echo 121 @echo 122 123$(SRCS:%.cc=%.o) : %.o : %.cc 124 125TEMPS = $(wildcard *_temp.cc) 126 127$(TEMPS:%.cc=%.o) : %.o : %.cc 128 129 130% : %.o $(PROJECT_LIBDEPS) 131 $(CXX) $(CXXFLAGS) $(TEMPLATES) -o $@ $@.o $($(@:=_LIBS)) $(LIBS) 132 133 134