2 ## Copyright (c) 1999-2011, International Business Machines Corporation and
3 ## others. All Rights Reserved.
6 ## THE PURPOSE OF THIS TEST
8 ## This tests all public header files - as installed. icu-config needs to be on the PATH
10 ## To run it simply type 'make check' after ICU is installed. 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'
26 ## Source directory information
28 top_srcdir = @top_srcdir@
33 include $(shell icu-config --incfile)
34 DIRS=$(prefix)/include/unicode
35 LDIRS=$(prefix)/include/layout
41 @echo Please read this Makefile for more information.
42 @echo run \'$(MAKE) check\' to run the test "(use -k if you don't want to stop on errs)"
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: "
54 check: dtest ctest cpptest lotest doclean drafttest deprtest internaltest obsoletetest
55 ifeq ($(MAKECMDGOALS),check)
58 @echo "(not cleaning automatically)"
66 @FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
67 incfile=`basename $$file .h` ; \
68 echo "$@ unicode/$$incfile.h" ; \
69 echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.cpp ; \
70 echo 'void junk(){}' >> ht_$$incfile.cpp ; \
71 $(COMPILE.cc) -c $(cppflags) ht_$$incfile.cpp || FAIL=1 ; \
76 @FAIL=0;for file in $(prefix)/include/layout/*.h; do \
77 incfile=`basename $$file .h` ; \
78 echo "$@ layout/$$incfile.h" ; \
79 echo '#include "'layout/$$incfile'.h"' > ht_$$incfile.cpp ; \
80 echo 'void junk(){}' >> ht_$$incfile.cpp ; \
81 $(COMPILE.cc) -c $(cppflags) -I$(prefix)/include/layout ht_$$incfile.cpp || FAIL=1; \
86 @FAIL=0;NONE="(No deprecated headers)";for stub in `cat $(srcdir)/dfiles.txt | grep -v '^#'` ; do \
87 file=unicode/$$stub ; \
89 incfile=`basename $$file .h` ; \
90 echo "$@ unicode/$$incfile.h" ; \
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" ; \
97 fgrep -q "$$incfile.h header is obsolete" ht_dep.junk || echo "** FAIL Header unicode/$$incfile.h is not obsoleted properly" ; \
98 fgrep -q "$$incfile.h header is obsolete" ht_dep.junk || FAIL=1 ; \
99 rm -f unicode/$$stub ; \
101 echo "$@: $$NONE - exit status $$FAIL" ; \
104 # < ht_dep.junk && ; \
108 @echo Building test harness for header files in ../../common and ../../i18n
109 @FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/cxxfiles.txt | tee cfiles.txt`; do \
110 incfile=`basename $$file .h` ; \
111 echo "$@ unicode/$$incfile.h" ; \
112 echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.c ; \
113 echo 'void junk(void);' >> ht_$$incfile.c ; \
114 echo 'void junk(){}' >> ht_$$incfile.c ; \
115 $(COMPILE.c) -c $(cppflags) ht_$$incfile.c || FAIL=1 ; \
120 @FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
121 incfile=`basename $$file .h` ; \
122 echo "$@ unicode/$$incfile.h" ; \
123 echo '#define U_HIDE_DRAFT_API' > hd_$$incfile.c; \
124 echo '#include "'unicode/$$incfile'.h"' >> hd_$$incfile.c ; \
125 echo 'void junk(void);' >> hd_$$incfile.c ; \
126 echo 'void junk(){}' >> hd_$$incfile.c ; \
127 $(COMPILE.cc) -c $(cppflags) hd_$$incfile.c ||FAIL=1 ; \
132 @FAIL=0; for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
133 incfile=`basename $$file .h` ; \
134 echo "$@ unicode/$$incfile.h" ; \
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 ; \
139 $(COMPILE.cc) -c $(cppflags) hdp_$$incfile.c || FAIL=1; \
145 for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
146 incfile=`basename $$file .h` ; \
147 echo "$@ unicode/$$incfile.h" ; \
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 ; \
152 $(COMPILE.cc) -c $(cppflags) hin_$$incfile.c || FAIL=1 ; \
157 @FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
158 incfile=`basename $$file .h` ; \
159 echo "$@ unicode/$$incfile.h" ; \
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 ; \
164 $(COMPILE.cc) -c $(cppflags) hob_$$incfile.c || FAIL=1 ; \
170 -@rm -f *.h *.c *.cpp *.o *.junk cfiles.txt
175 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
177 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
179 .PHONY: doclean check all cpptest lotest dtest ctest clean distclean