Makefile.in (4741B)
1 ## 2 ## Copyright (C) 2016 and later: Unicode, Inc. and others. 3 ## License & terms of use: http://www.unicode.org/copyright.html 4 ## Copyright (c) 1999-2011, International Business Machines Corporation and 5 ## others. All Rights Reserved. 6 ## 7 ## 8 ## THE PURPOSE OF THIS TEST 9 ## 10 ## This tests all public header files - as installed. icu-config needs to be on the PATH 11 ## 12 ## To run it simply type 'make check' after ICU is installed. You SHOULD see: 13 ## 14 ## unicode/uchar.h - 0 15 ## unicode/uchriter.h - 0 16 ## unicode/ucnv.h - 0 17 ## 18 ## .. etc. Anything other than zero is an error. (except for the deprecation tests, where '1' is the correct value) 19 ## 20 ## If the header test is run for a particular UCONFIG_NO_XXX=1 variation (see uconfig.h) 21 ## then invoke the test with 'make UCONFIG_NO="-DUCONFIG_NO_XXX=1 check'. 22 ## For standard header test run the UCONFIG_NO variable will evaluate to empty string. 23 ## 24 ## If a header fails the C compile test it is likely because the header is a 25 ## C++ header and it isn't properly guarded by the U_SHOW_CPLUSPLUS_API macro. 26 ## 27 ## If a header fails the cppguardtest test it is likely because the header doesn't 28 ## include the utypes.h header first *before* using the macro U_SHOW_CPLUSPLUS_API. 29 ## 30 ## If a header fails because it is deprecated, add it to the 'dfiles.txt' 31 ## 32 ## 33 34 ## Source directory information 35 srcdir = @srcdir@ 36 top_srcdir = @top_srcdir@ 37 38 top_builddir = ../.. 39 subdir = test/hdrtst 40 41 include $(shell icu-config --incfile) 42 43 all: 44 @echo Please read this Makefile for more information. 45 @echo run \'$(MAKE) check\' to run the test "(use -k if you don't want to stop on errs)" 46 47 check: dtest ctest cpptest drafttest deprtest internaltest obsoletetest cppguardtest 48 49 headertest: 50 @FAIL=0; for file in "$(prefix)/include/unicode"/*.h ; do \ 51 incfile=`basename $$file` ; \ 52 echo "$(NAME.headers) unicode/$$incfile" ; \ 53 testfile=ht_stub_$(NAME.headers)_$$incfile.$(SUFFIX.headers); \ 54 echo "#include <unicode/$$incfile>" > $$testfile ; \ 55 echo 'void junk(){}' >> $$testfile ; \ 56 $(COMPILE.headers) $(cppflags) $(FLAGS.headers) $(UCONFIG_NO) $$testfile || FAIL=1 ; \ 57 rm -f $$testfile; \ 58 done ; \ 59 exit $$FAIL 60 61 ctest: 62 $(MAKE) headertest \ 63 NAME.headers=$@ \ 64 COMPILE.headers="$(COMPILE.c)" \ 65 SUFFIX.headers=c \ 66 FLAGS.headers= 67 68 cpptest: 69 $(MAKE) headertest \ 70 NAME.headers=$@ \ 71 COMPILE.headers="$(COMPILE.cc)" \ 72 SUFFIX.headers=cpp \ 73 FLAGS.headers= 74 75 drafttest: 76 $(MAKE) headertest \ 77 NAME.headers=$@ \ 78 COMPILE.headers="$(COMPILE.cc)" \ 79 SUFFIX.headers=cpp \ 80 FLAGS.headers="-DU_HIDE_DRAFT_API" 81 82 deprtest: 83 $(MAKE) headertest \ 84 NAME.headers=$@ \ 85 COMPILE.headers="$(COMPILE.cc)" \ 86 SUFFIX.headers=cpp \ 87 FLAGS.headers="-DU_HIDE_DEPRECATED_API" 88 89 internaltest: 90 $(MAKE) headertest \ 91 NAME.headers=$@ \ 92 COMPILE.headers="$(COMPILE.cc)" \ 93 SUFFIX.headers=cpp \ 94 FLAGS.headers="-DU_HIDE_INTERNAL_API" 95 96 obsoletetest: 97 $(MAKE) headertest \ 98 NAME.headers=$@ \ 99 COMPILE.headers="$(COMPILE.cc)" \ 100 SUFFIX.headers=cpp \ 101 FLAGS.headers="-DU_HIDE_OBSOLETE_API" 102 103 dtest: 104 @FAIL=0;NONE="(No deprecated headers)";stub=ht_stub_dtest.cpp;for incfile in `cat $(srcdir)/dfiles.txt | grep -v '^#' | sort` ; do \ 105 NONE= ; \ 106 echo "$@ unicode/$$incfile" ; \ 107 echo "#include <unicode/$$incfile>" > $$stub ; \ 108 echo 'void junk(){}' >> $$stub ; \ 109 $(COMPILE.cc) $(cppflags) $$stub 2>&1 | tee $$stub.out || FAIL=1 ; \ 110 if ! cat $$stub.out | sed -e 's/^.*#error[^"]*"//' | grep -v ht_ | grep -v "$$incfile header is obsolete"; then \ 111 echo "** FAIL Header unicode/$$incfile is not obsoleted properly" ; \ 112 FAIL=1 ; \ 113 fi ; \ 114 rm -f $$stub*; \ 115 done ; \ 116 echo "$@: $$NONE - exit status $$FAIL" ; \ 117 exit $$FAIL 118 119 cppguardtest: 120 @FAIL=0;stub=ht_stub_cppguardtest.cpp; for file in "$(prefix)/include/unicode"/*.h ; do \ 121 incfile=`basename $$file` ; \ 122 if grep -q "U_SHOW_CPLUSPLUS_API" $$file ; then \ 123 echo "$@ unicode/$$incfile" ; \ 124 echo "#include <unicode/$$incfile>" > $$stub ; \ 125 echo 'void junk(){}' >> $$stub ; \ 126 echo '#if !defined(U_SHOW_CPLUSPLUS_API)' >> $$stub ; \ 127 echo "#error The header '$$incfile' refers to the macro U_SHOW_CPLUSPLUS_API (defined in utypes.h) but either does not include utypes.h or does so incorrectly." >> $$stub ; \ 128 echo '#endif' >> $$stub ; \ 129 $(COMPILE.cc) $(cppflags) $(UCONFIG_NO) $$stub || FAIL=1 ; \ 130 rm -f $$stub; \ 131 else \ 132 echo "$@ skipping unicode/$$incfile" ; \ 133 fi ; \ 134 done ; \ 135 exit $$FAIL 136 137 clean: 138 -@rm -f ht_* 139 140 distclean: clean 141 -@rm -f Makefile 142 143 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 144 cd $(top_builddir) \ 145 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status 146 147 .PHONY: doclean check all headertest cpptest dtest cppguardtest ctest clean distclean