]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/hdrtst/Makefile.in
ICU-511.32.tar.gz
[apple/icu.git] / icuSources / test / hdrtst / Makefile.in
1 ##
2 ## Copyright (c) 1999-2011, 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 - as installed. icu-config needs to be on the PATH
9 ##
10 ## To run it simply type 'make check' after ICU is installed. 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 ## Source directory information
27 srcdir = @srcdir@
28 top_srcdir = @top_srcdir@
29
30 top_builddir = ../..
31 subdir = test/hdrtst
32
33 include $(shell icu-config --incfile)
34 DIRS=$(prefix)/include/unicode
35 LDIRS=$(prefix)/include/layout
36 ECHO_T=@ECHO_T@
37 ECHO_C=@ECHO_C@
38 ECHO_N=@ECHO_N@
39
40 all:
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)"
43
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: "
53
54 check: dtest ctest cpptest lotest doclean drafttest deprtest internaltest obsoletetest
55 ifeq ($(MAKECMDGOALS),check)
56 $(MAKE) clean
57 else
58 @echo "(not cleaning automatically)"
59 endif
60
61 # break dependency
62 doclean:
63 make clean
64
65 cpptest:
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 ; \
72 done ;\
73 exit $$FAIL
74
75 lotest:
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; \
82 done ;\
83 exit $$FAIL
84
85 dtest:
86 @FAIL=0;NONE="(No deprecated headers)";for stub in `cat $(srcdir)/dfiles.txt | grep -v '^#'` ; do \
87 file=unicode/$$stub ; \
88 NONE="" ; \
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" ; \
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" ; \
98 fgrep -q "$$incfile.h header is obsolete" ht_dep.junk || FAIL=1 ; \
99 rm -f unicode/$$stub ; \
100 done ; \
101 echo "$@: $$NONE - exit status $$FAIL" ; \
102 exit $$FAIL
103
104 # < ht_dep.junk && ; \
105
106
107 ctest:
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 ; \
116 done ;\
117 exit $$FAIL
118
119 drafttest:
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 ; \
128 done ;\
129 exit $$FAIL
130
131 deprtest:
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; \
140 done ; \
141 exit $$FAIL
142
143 internaltest:
144 @FAIL=0;\
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 ; \
153 done ; \
154 exit $$FAIL
155
156 obsoletetest:
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 ; \
165 done ; \
166 exit $$FAIL
167
168 clean:
169 -@echo cleaning..
170 -@rm -f *.h *.c *.cpp *.o *.junk cfiles.txt
171
172 distclean: clean
173 -@rm -f Makefile
174
175 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
176 cd $(top_builddir) \
177 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
178
179 .PHONY: doclean check all cpptest lotest dtest ctest clean distclean
180