]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Copyright (c) 1999-2002, International Business Machines Corporation and | |
3 | # others. All Rights Reserved. | |
4 | # | |
5 | # | |
6 | # THE PURPOSE OF THIS TEST | |
7 | # | |
8 | # This tests all public header files ( | |
9 | # | |
10 | # To run it simply type 'make check'. You SHOULD see: | |
11 | # | |
12 | # unicode/uchar.h - 0 | |
13 | # unicode/uchriter.h - 0 | |
14 | # unicode/ucnv.h - 0 | |
15 | # | |
16 | # .. etc. Anything other than zero is an error. (except for the deprecation tests, where '1' is the correct value) | |
17 | # | |
18 | # | |
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. | |
21 | # | |
22 | # If a header fails because it is deprecated, add it to the 'dfiles.txt' | |
23 | # | |
24 | # | |
25 | ||
26 | ifeq ($(USE_ICU_CONFIG),1) | |
27 | include $(shell icu-config --incfile) | |
28 | DIRS=$(shell icu-config --prefix)/include/unicode | |
29 | else | |
30 | include ../../config/Makefile.inc | |
31 | DIRS=../../../common/unicode ../../../i18n/unicode ../../../extra/ustdio/unicode | |
32 | endif | |
33 | ||
34 | all: | |
35 | @echo Please read this Makefile for more information. | |
36 | @echo run \'$(MAKE) check\' to run the test | |
37 | ||
38 | check: hdrdir dtest ctest cpptest doclean | |
39 | @echo "All header tests have finished. If deprecation #errors appeared, " | |
40 | @echo " add files to hdrtst/dfiles.txt" | |
41 | @echo "#################################################################" | |
42 | @echo | |
43 | ||
44 | # break dependency | |
45 | doclean: | |
46 | make clean | |
47 | ||
48 | #layout not tested due to path dependencies | |
49 | ||
50 | hdrdir: | |
51 | @echo CPPFLAGS are $(CPPFLAGS) | |
52 | @-$(RMV) ./unicode | |
53 | @mkdir ./unicode | |
54 | @echo Preparing unicode/ directory .. | |
55 | @cd ./unicode ; \ | |
56 | for dir in $(DIRS); do \ | |
57 | echo "linking from " $$dir '(' `ls $$dir/*.h | wc -l` 'headers )' ; \ | |
58 | ln -s $$dir/*.h . ; \ | |
59 | done | |
60 | rm unicode/pwin32.h | |
61 | ||
62 | cpptest: | |
63 | @echo "C++ test #######################################################" | |
64 | @rm -f Makefile.sub | |
65 | @echo 'Testing all header files under C++' | |
66 | @echo 'the number after the hyphen (-) refers to the exit code - should be zero!' | |
67 | @for file in unicode/*.h; do \ | |
68 | incfile=`basename $$file .h` ; \ | |
69 | echo -n "C++ unicode/$$incfile.h - " ; \ | |
70 | echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.cpp ; \ | |
71 | echo 'void junk(){}' >> ht_$$incfile.cpp ; \ | |
72 | $(COMPILE.cc) -c -I. ht_$$incfile.cpp ; \ | |
73 | RES=$$? ; \ | |
74 | echo $$RES ; \ | |
75 | done | |
76 | ||
77 | dtest: | |
78 | @rm -f Makefile.sub | |
79 | @echo "Deprecation #######################################################" | |
80 | @echo 'Should be 1 in each case if file is properly obsoleted.' | |
81 | @for stub in `cat dfiles.txt | grep -v '^#'` ; do \ | |
82 | file=unicode/$$stub \ | |
83 | incfile=`basename $$file .h` ; \ | |
84 | echo -n "C++ unicode/$$incfile.h - " ; \ | |
85 | echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.cpp ; \ | |
86 | echo 'void junk(){}' >> ht_$$incfile.cpp ; \ | |
87 | echo > ht_dep.junk ; \ | |
88 | $(COMPILE.cc) -c -I. ht_$$incfile.cpp 2>&1 | sed -e 's/^.*#error[^"]*"//' | fgrep -v ht_ | tee ht_dep.junk | fgrep -v "$$incfile.h header is obsolete" ; \ | |
89 | RES=$$? ; \ | |
90 | echo $$RES ; \ | |
91 | fgrep -q "$$incfile.h header is obsolete" ht_dep.junk || echo "** FAIL Header unicode/$$incfile.h is not obsoleted properly" ; \ | |
92 | rm -f unicode/$$stub ; \ | |
93 | done | |
94 | ||
95 | # < ht_dep.junk && ; \ | |
96 | ||
97 | ||
98 | ctest: | |
99 | @echo "C Test #######################################################" | |
100 | @echo " (if any C++ files show up here, stop the test and add them to hdrtst/cxxfiles.txt) " | |
101 | @rm -f Makefile.sub | |
102 | @echo Building test harness for header files in ../../common and ../../i18n | |
103 | @echo 'the number after the hyphen (-) refers to the exit code - should be zero!' | |
104 | @for file in `ls unicode/*.h | fgrep -v -f ./cxxfiles.txt | tee cfiles.txt`; do \ | |
105 | incfile=`basename $$file .h` ; \ | |
106 | echo -n "C unicode/$$incfile.h - " ; \ | |
107 | echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.c ; \ | |
108 | echo 'void junk(){}' >> ht_$$incfile.c ; \ | |
109 | $(COMPILE.c) -c -I. ht_$$incfile.c ; \ | |
110 | RES=$$? ; \ | |
111 | echo $$RES ; \ | |
112 | done | |
113 | ||
114 | distclean clean: | |
115 | -@rm -f *.h *.c *.cpp *.o *.junk | |
116 | -@$(RMV) ./unicode | |
117 |