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.
8 ## THE PURPOSE OF THIS TEST
10 ## This tests all public header files - as installed. icu-config needs to be on the PATH
12 ## To run it simply type 'make check' after ICU is installed. You SHOULD see:
14 ## unicode/uchar.h - 0
15 ## unicode/uchriter.h - 0
18 ## .. etc. Anything other than zero is an error. (except for the deprecation tests, where '1' is the correct value)
20 ## If a header fails the C compile test it is likely because the header is a
21 ## C++ header and it isn't properly guarded by the U_SHOW_CPLUSPLUS_API macro.
23 ## If a header fails the cppguardtest test it is likely because the header doesn't
24 ## include the utypes.h header first *before* using the macro U_SHOW_CPLUSPLUS_API.
26 ## If a header fails because it is deprecated, add it to the 'dfiles.txt'
30 ## Source directory information
32 top_srcdir = @top_srcdir@
37 include $(shell icu-config --incfile)
40 @echo Please read this Makefile for more information.
41 @echo run \'$(MAKE) check\' to run the test "(use -k if you don't want to stop on errs)"
43 check: dtest ctest cpptest drafttest deprtest internaltest obsoletetest cppguardtest
46 @FAIL=0;stub=ht_stub_$(NAME.headers).$(SUFFIX.headers); for file in "$(prefix)/include/unicode"/*.h ; do \
47 incfile=`basename $$file` ; \
48 echo "$(NAME.headers) unicode/$$incfile" ; \
49 echo "#include <unicode/$$incfile>" > $$stub ; \
50 echo 'void junk(){}' >> $$stub ; \
51 $(COMPILE.headers) $(cppflags) $(FLAGS.headers) $$stub || FAIL=1 ; \
59 COMPILE.headers="$(COMPILE.c)" \
66 COMPILE.headers="$(COMPILE.cc)" \
73 COMPILE.headers="$(COMPILE.cc)" \
75 FLAGS.headers="-DU_HIDE_DRAFT_API"
80 COMPILE.headers="$(COMPILE.cc)" \
82 FLAGS.headers="-DU_HIDE_DEPRECATED_API"
87 COMPILE.headers="$(COMPILE.cc)" \
89 FLAGS.headers="-DU_HIDE_INTERNAL_API"
94 COMPILE.headers="$(COMPILE.cc)" \
96 FLAGS.headers="-DU_HIDE_OBSOLETE_API"
99 @FAIL=0;NONE="(No deprecated headers)";stub=ht_stub_dtest.cpp;for incfile in `cat $(srcdir)/dfiles.txt | grep -v '^#' | sort` ; do \
101 echo "$@ unicode/$$incfile" ; \
102 echo "#include <unicode/$$incfile>" > $$stub ; \
103 echo 'void junk(){}' >> $$stub ; \
104 $(COMPILE.cc) $(cppflags) $$stub 2>&1 | tee $$stub.out || FAIL=1 ; \
105 if ! cat $$stub.out | sed -e 's/^.*#error[^"]*"//' | grep -v ht_ | grep -v "$$incfile header is obsolete"; then \
106 echo "** FAIL Header unicode/$$incfile is not obsoleted properly" ; \
111 echo "$@: $$NONE - exit status $$FAIL" ; \
115 @FAIL=0;stub=ht_stub_cppguardtest.cpp; for file in "$(prefix)/include/unicode"/*.h ; do \
116 incfile=`basename $$file` ; \
117 if grep -q "U_SHOW_CPLUSPLUS_API" $$file ; then \
118 echo "$@ unicode/$$incfile" ; \
119 echo "#include <unicode/$$incfile>" > $$stub ; \
120 echo 'void junk(){}' >> $$stub ; \
121 echo '#if !defined(U_SHOW_CPLUSPLUS_API)' >> $$stub ; \
122 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 ; \
123 echo '#endif' >> $$stub ; \
124 $(COMPILE.cc) $(cppflags) $$stub || FAIL=1 ; \
127 echo "$@ skipping unicode/$$incfile" ; \
138 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
140 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
142 .PHONY: doclean check all headertest cpptest dtest cppguardtest ctest clean distclean