2 ## Copyright (c) 1999-2004, International Business Machines Corporation and
3 ## others. All Rights Reserved.
6 ## THE PURPOSE OF THIS TEST
8 ## This tests all public header files (
10 ## To run it simply type 'make check'. You SHOULD see:
12 ## unicode/uchar.h - 0
13 ## unicode/uchriter.h - 0
16 ## .. etc. Anything other than zero is an error. (except for the deprecation tests, where '1' is the correct value)
19 ## If a header fails the C compile because it's a C++ header, add it to the
20 ## file named 'cxxfiles.txt' in this directory.
22 ## If a header fails because it is deprecated, add it to the 'dfiles.txt'
27 include $(shell icu-config --incfile)
29 DIRS=$(prefix)/include/unicode
30 LDIRS=$(prefix)/include/layout
33 @echo Please read this Makefile for more information.
34 @echo run \'$(MAKE) check\' to run the test
36 check: dtest ctest cpptest lotest doclean
37 @echo "All header tests have finished. If deprecation #errors appeared, "
38 @echo " add files to hdrtst/dfiles.txt"
39 @echo "#################################################################"
47 @echo "C++ test #######################################################"
49 @echo 'Testing all header files under C++'
50 @echo 'the number after the hyphen (-) refers to the exit code - should be zero!'
51 @for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
52 incfile=`basename $$file .h` ; \
53 echo -n "C++ unicode/$$incfile.h - " ; \
54 echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.cpp ; \
55 echo 'void junk(){}' >> ht_$$incfile.cpp ; \
56 $(COMPILE.cc) -c $(cppflags) ht_$$incfile.cpp ; \
61 @echo "Layout test #######################################################"
63 @echo 'Testing all layout files under C++'
64 @echo 'the number after the hyphen (-) refers to the exit code - should be zero!'
65 @for file in $(prefix)/include/layout/*.h; do \
66 incfile=`basename $$file .h` ; \
67 echo -n "C++ layout/$$incfile.h - " ; \
68 echo '#include "'layout/$$incfile'.h"' > ht_$$incfile.cpp ; \
69 echo 'void junk(){}' >> ht_$$incfile.cpp ; \
70 $(COMPILE.cc) -c $(cppflags) -I$(prefix)/include/layout ht_$$incfile.cpp ; \
76 @echo "Deprecation #######################################################"
77 @echo 'Should be 1 in each case if file is properly obsoleted.'
78 @for stub in `cat $(srcdir)/dfiles.txt | grep -v '^#'` ; do \
80 incfile=`basename $$file .h` ; \
81 echo -n "C++ unicode/$$incfile.h - " ; \
82 echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.cpp ; \
83 echo 'void junk(){}' >> ht_$$incfile.cpp ; \
84 echo > ht_dep.junk ; \
85 $(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" ; \
88 fgrep -q "$$incfile.h header is obsolete" ht_dep.junk || echo "** FAIL Header unicode/$$incfile.h is not obsoleted properly" ; \
89 rm -f unicode/$$stub ; \
92 # < ht_dep.junk && ; \
96 @echo "C Test #######################################################"
97 @echo " (if any C++ files show up here, stop the test and add them to hdrtst/cxxfiles.txt) "
99 @echo Building test harness for header files in ../../common and ../../i18n
100 @echo 'the number after the hyphen (-) refers to the exit code - should be zero!'
101 @for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/cxxfiles.txt | tee cfiles.txt`; do \
102 incfile=`basename $$file .h` ; \
103 echo -n "C unicode/$$incfile.h - " ; \
104 echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.c ; \
105 echo 'void junk(void);' >> ht_$$incfile.c ; \
106 echo 'void junk(){}' >> ht_$$incfile.c ; \
107 $(COMPILE.c) -c $(cppflags) ht_$$incfile.c ; \
113 -@rm -f *.h *.c *.cpp *.o *.junk