Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | ## |
michael@0 | 2 | ## Copyright (c) 1999-2011, International Business Machines Corporation and |
michael@0 | 3 | ## others. All Rights Reserved. |
michael@0 | 4 | ## |
michael@0 | 5 | ## |
michael@0 | 6 | ## THE PURPOSE OF THIS TEST |
michael@0 | 7 | ## |
michael@0 | 8 | ## This tests all public header files - as installed. icu-config needs to be on the PATH |
michael@0 | 9 | ## |
michael@0 | 10 | ## To run it simply type 'make check' after ICU is installed. You SHOULD see: |
michael@0 | 11 | ## |
michael@0 | 12 | ## unicode/uchar.h - 0 |
michael@0 | 13 | ## unicode/uchriter.h - 0 |
michael@0 | 14 | ## unicode/ucnv.h - 0 |
michael@0 | 15 | ## |
michael@0 | 16 | ## .. etc. Anything other than zero is an error. (except for the deprecation tests, where '1' is the correct value) |
michael@0 | 17 | ## |
michael@0 | 18 | ## |
michael@0 | 19 | ## If a header fails the C compile because it's a C++ header, add it to the |
michael@0 | 20 | ## file named 'cxxfiles.txt' in this directory. |
michael@0 | 21 | ## |
michael@0 | 22 | ## If a header fails because it is deprecated, add it to the 'dfiles.txt' |
michael@0 | 23 | ## |
michael@0 | 24 | ## |
michael@0 | 25 | |
michael@0 | 26 | ## Source directory information |
michael@0 | 27 | srcdir = @srcdir@ |
michael@0 | 28 | top_srcdir = @top_srcdir@ |
michael@0 | 29 | |
michael@0 | 30 | top_builddir = ../.. |
michael@0 | 31 | subdir = test/hdrtst |
michael@0 | 32 | |
michael@0 | 33 | include $(shell icu-config --incfile) |
michael@0 | 34 | DIRS=$(prefix)/include/unicode |
michael@0 | 35 | LDIRS=$(prefix)/include/layout |
michael@0 | 36 | ECHO_T=@ECHO_T@ |
michael@0 | 37 | ECHO_C=@ECHO_C@ |
michael@0 | 38 | ECHO_N=@ECHO_N@ |
michael@0 | 39 | |
michael@0 | 40 | all: |
michael@0 | 41 | @echo Please read this Makefile for more information. |
michael@0 | 42 | @echo run \'$(MAKE) check\' to run the test "(use -k if you don't want to stop on errs)" |
michael@0 | 43 | |
michael@0 | 44 | E_NUM=8 |
michael@0 | 45 | E_D="[1/$(E_NUM)] Deprecated: " |
michael@0 | 46 | E_C="[2/$(E_NUM)] C : " |
michael@0 | 47 | E_CXX="[3/$(E_NUM)] C++: " |
michael@0 | 48 | E_CXX_L="[4/$(E_NUM)] C++ layout: " |
michael@0 | 49 | E_DRF="[5/$(E_NUM)] Hide Draft: " |
michael@0 | 50 | E_DEP="[6/$(E_NUM)] Hide Deprecated: " |
michael@0 | 51 | E_INT="[7/$(E_NUM)] Hide Internal: " |
michael@0 | 52 | E_OBS="[8/$(E_NUM)] Hide Obsolete: " |
michael@0 | 53 | |
michael@0 | 54 | check: dtest ctest cpptest lotest doclean drafttest deprtest internaltest obsoletetest |
michael@0 | 55 | ifeq ($(MAKECMDGOALS),check) |
michael@0 | 56 | $(MAKE) clean |
michael@0 | 57 | else |
michael@0 | 58 | @echo "(not cleaning automatically)" |
michael@0 | 59 | endif |
michael@0 | 60 | |
michael@0 | 61 | # break dependency |
michael@0 | 62 | doclean: |
michael@0 | 63 | make clean |
michael@0 | 64 | |
michael@0 | 65 | cpptest: |
michael@0 | 66 | @FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \ |
michael@0 | 67 | incfile=`basename $$file .h` ; \ |
michael@0 | 68 | echo "$@ unicode/$$incfile.h" ; \ |
michael@0 | 69 | echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.cpp ; \ |
michael@0 | 70 | echo 'void junk(){}' >> ht_$$incfile.cpp ; \ |
michael@0 | 71 | $(COMPILE.cc) -c $(cppflags) ht_$$incfile.cpp || FAIL=1 ; \ |
michael@0 | 72 | done ;\ |
michael@0 | 73 | exit $$FAIL |
michael@0 | 74 | |
michael@0 | 75 | lotest: |
michael@0 | 76 | @FAIL=0;for file in $(prefix)/include/layout/*.h; do \ |
michael@0 | 77 | incfile=`basename $$file .h` ; \ |
michael@0 | 78 | echo "$@ layout/$$incfile.h" ; \ |
michael@0 | 79 | echo '#include "'layout/$$incfile'.h"' > ht_$$incfile.cpp ; \ |
michael@0 | 80 | echo 'void junk(){}' >> ht_$$incfile.cpp ; \ |
michael@0 | 81 | $(COMPILE.cc) -c $(cppflags) -I$(prefix)/include/layout ht_$$incfile.cpp || FAIL=1; \ |
michael@0 | 82 | done ;\ |
michael@0 | 83 | exit $$FAIL |
michael@0 | 84 | |
michael@0 | 85 | dtest: |
michael@0 | 86 | @FAIL=0;NONE="(No deprecated headers)";for stub in `cat $(srcdir)/dfiles.txt | grep -v '^#'` ; do \ |
michael@0 | 87 | file=unicode/$$stub ; \ |
michael@0 | 88 | NONE="" ; \ |
michael@0 | 89 | incfile=`basename $$file .h` ; \ |
michael@0 | 90 | echo "$@ unicode/$$incfile.h" ; \ |
michael@0 | 91 | echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.cpp ; \ |
michael@0 | 92 | echo 'void junk(){}' >> ht_$$incfile.cpp ; \ |
michael@0 | 93 | echo > ht_dep.junk ; \ |
michael@0 | 94 | $(COMPILE.cc) -c $(cppflags) ht_$$incfile.cpp 2>&1 | sed -e 's/^.*#error[^"]*"//' | fgrep -v ht_ | tee ht_dep.junk | fgrep -v "$$incfile.h header is obsolete" ; \ |
michael@0 | 95 | RES=$$? ; \ |
michael@0 | 96 | echo $$RES ; \ |
michael@0 | 97 | fgrep -q "$$incfile.h header is obsolete" ht_dep.junk || echo "** FAIL Header unicode/$$incfile.h is not obsoleted properly" ; \ |
michael@0 | 98 | fgrep -q "$$incfile.h header is obsolete" ht_dep.junk || FAIL=1 ; \ |
michael@0 | 99 | rm -f unicode/$$stub ; \ |
michael@0 | 100 | done ; \ |
michael@0 | 101 | echo "$@: $$NONE - exit status $$FAIL" ; \ |
michael@0 | 102 | exit $$FAIL |
michael@0 | 103 | |
michael@0 | 104 | # < ht_dep.junk && ; \ |
michael@0 | 105 | |
michael@0 | 106 | |
michael@0 | 107 | ctest: |
michael@0 | 108 | @echo Building test harness for header files in ../../common and ../../i18n |
michael@0 | 109 | @FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/cxxfiles.txt | tee cfiles.txt`; do \ |
michael@0 | 110 | incfile=`basename $$file .h` ; \ |
michael@0 | 111 | echo "$@ unicode/$$incfile.h" ; \ |
michael@0 | 112 | echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.c ; \ |
michael@0 | 113 | echo 'void junk(void);' >> ht_$$incfile.c ; \ |
michael@0 | 114 | echo 'void junk(){}' >> ht_$$incfile.c ; \ |
michael@0 | 115 | $(COMPILE.c) -c $(cppflags) ht_$$incfile.c || FAIL=1 ; \ |
michael@0 | 116 | done ;\ |
michael@0 | 117 | exit $$FAIL |
michael@0 | 118 | |
michael@0 | 119 | drafttest: |
michael@0 | 120 | @FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \ |
michael@0 | 121 | incfile=`basename $$file .h` ; \ |
michael@0 | 122 | echo "$@ unicode/$$incfile.h" ; \ |
michael@0 | 123 | echo '#define U_HIDE_DRAFT_API' > hd_$$incfile.c; \ |
michael@0 | 124 | echo '#include "'unicode/$$incfile'.h"' >> hd_$$incfile.c ; \ |
michael@0 | 125 | echo 'void junk(void);' >> hd_$$incfile.c ; \ |
michael@0 | 126 | echo 'void junk(){}' >> hd_$$incfile.c ; \ |
michael@0 | 127 | $(COMPILE.cc) -c $(cppflags) hd_$$incfile.c ||FAIL=1 ; \ |
michael@0 | 128 | done ;\ |
michael@0 | 129 | exit $$FAIL |
michael@0 | 130 | |
michael@0 | 131 | deprtest: |
michael@0 | 132 | @FAIL=0; for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \ |
michael@0 | 133 | incfile=`basename $$file .h` ; \ |
michael@0 | 134 | echo "$@ unicode/$$incfile.h" ; \ |
michael@0 | 135 | echo '#define U_HIDE_DEPRECATED_API' > hdp_$$incfile.c; \ |
michael@0 | 136 | echo '#include "'unicode/$$incfile'.h"' >> hdp_$$incfile.c ; \ |
michael@0 | 137 | echo 'void junk(void);' >> hdp_$$incfile.c ; \ |
michael@0 | 138 | echo 'void junk(){}' >> hdp_$$incfile.c ; \ |
michael@0 | 139 | $(COMPILE.cc) -c $(cppflags) hdp_$$incfile.c || FAIL=1; \ |
michael@0 | 140 | done ; \ |
michael@0 | 141 | exit $$FAIL |
michael@0 | 142 | |
michael@0 | 143 | internaltest: |
michael@0 | 144 | @FAIL=0;\ |
michael@0 | 145 | for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \ |
michael@0 | 146 | incfile=`basename $$file .h` ; \ |
michael@0 | 147 | echo "$@ unicode/$$incfile.h" ; \ |
michael@0 | 148 | echo '#define U_HIDE_INTERNAL_API' > hin_$$incfile.c; \ |
michael@0 | 149 | echo '#include "'unicode/$$incfile'.h"' >> hin_$$incfile.c ; \ |
michael@0 | 150 | echo 'void junk(void);' >> hin_$$incfile.c ; \ |
michael@0 | 151 | echo 'void junk(){}' >> hin_$$incfile.c ; \ |
michael@0 | 152 | $(COMPILE.cc) -c $(cppflags) hin_$$incfile.c || FAIL=1 ; \ |
michael@0 | 153 | done ; \ |
michael@0 | 154 | exit $$FAIL |
michael@0 | 155 | |
michael@0 | 156 | obsoletetest: |
michael@0 | 157 | @FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \ |
michael@0 | 158 | incfile=`basename $$file .h` ; \ |
michael@0 | 159 | echo "$@ unicode/$$incfile.h" ; \ |
michael@0 | 160 | echo '#define U_HIDE_OBSOLETE_API' > hob_$$incfile.c; \ |
michael@0 | 161 | echo '#include "'unicode/$$incfile'.h"' >> hob_$$incfile.c ; \ |
michael@0 | 162 | echo 'void junk(void);' >> hob_$$incfile.c ; \ |
michael@0 | 163 | echo 'void junk(){}' >> hob_$$incfile.c ; \ |
michael@0 | 164 | $(COMPILE.cc) -c $(cppflags) hob_$$incfile.c || FAIL=1 ; \ |
michael@0 | 165 | done ; \ |
michael@0 | 166 | exit $$FAIL |
michael@0 | 167 | |
michael@0 | 168 | clean: |
michael@0 | 169 | -@echo cleaning.. |
michael@0 | 170 | -@rm -f *.h *.c *.cpp *.o *.junk cfiles.txt |
michael@0 | 171 | |
michael@0 | 172 | distclean: clean |
michael@0 | 173 | -@rm -f Makefile |
michael@0 | 174 | |
michael@0 | 175 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status |
michael@0 | 176 | cd $(top_builddir) \ |
michael@0 | 177 | && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status |
michael@0 | 178 | |
michael@0 | 179 | .PHONY: doclean check all cpptest lotest dtest ctest clean distclean |
michael@0 | 180 |