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