]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/hdrtst/Makefile.in
ICU-66108.tar.gz
[apple/icu.git] / icuSources / test / hdrtst / Makefile.in
CommitLineData
374ca955 1##
f3c0d7a5
A
2## Copyright (C) 2016 and later: Unicode, Inc. and others.
3## License & terms of use: http://www.unicode.org/copyright.html
4388f060 4## Copyright (c) 1999-2011, International Business Machines Corporation and
374ca955
A
5## others. All Rights Reserved.
6##
7##
8## THE PURPOSE OF THIS TEST
9##
4388f060 10## This tests all public header files - as installed. icu-config needs to be on the PATH
374ca955 11##
4388f060 12## To run it simply type 'make check' after ICU is installed. You SHOULD see:
374ca955
A
13##
14## unicode/uchar.h - 0
15## unicode/uchriter.h - 0
16## unicode/ucnv.h - 0
17##
18## .. etc. Anything other than zero is an error. (except for the deprecation tests, where '1' is the correct value)
374ca955 19##
340931cb
A
20## If a header fails the C compile test it is likely because the header is a
21## C++ header and it isn't properly guarded by the U_SHOW_CPLUSPLUS_API macro.
22##
23## If a header fails the cppguardtest test it is likely because the header doesn't
24## include the utypes.h header first *before* using the macro U_SHOW_CPLUSPLUS_API.
374ca955
A
25##
26## If a header fails because it is deprecated, add it to the 'dfiles.txt'
27##
28##
29
46f4442e
A
30## Source directory information
31srcdir = @srcdir@
32top_srcdir = @top_srcdir@
33
34top_builddir = ../..
35subdir = test/hdrtst
374ca955
A
36
37include $(shell icu-config --incfile)
374ca955
A
38
39all:
40 @echo Please read this Makefile for more information.
4388f060
A
41 @echo run \'$(MAKE) check\' to run the test "(use -k if you don't want to stop on errs)"
42
340931cb 43check: dtest ctest cpptest drafttest deprtest internaltest obsoletetest cppguardtest
374ca955 44
340931cb
A
45headertest:
46 @FAIL=0;stub=ht_stub_$(NAME.headers).$(SUFFIX.headers); for file in "$(prefix)/include/unicode"/*.h ; do \
47 incfile=`basename $$file` ; \
48 echo "$(NAME.headers) unicode/$$incfile" ; \
49 echo "#include <unicode/$$incfile>" > $$stub ; \
50 echo 'void junk(){}' >> $$stub ; \
51 $(COMPILE.headers) $(cppflags) $(FLAGS.headers) $$stub || FAIL=1 ; \
52 rm -f $$stub; \
4388f060 53 done ; \
4388f060 54 exit $$FAIL
374ca955 55
374ca955 56ctest:
340931cb
A
57 $(MAKE) headertest \
58 NAME.headers=$@ \
59 COMPILE.headers="$(COMPILE.c)" \
60 SUFFIX.headers=c \
61 FLAGS.headers=
62
63cpptest:
64 $(MAKE) headertest \
65 NAME.headers=$@ \
66 COMPILE.headers="$(COMPILE.cc)" \
67 SUFFIX.headers=cpp \
68 FLAGS.headers=
4388f060 69
73c04bcf 70drafttest:
340931cb
A
71 $(MAKE) headertest \
72 NAME.headers=$@ \
73 COMPILE.headers="$(COMPILE.cc)" \
74 SUFFIX.headers=cpp \
75 FLAGS.headers="-DU_HIDE_DRAFT_API"
4388f060 76
73c04bcf 77deprtest:
340931cb
A
78 $(MAKE) headertest \
79 NAME.headers=$@ \
80 COMPILE.headers="$(COMPILE.cc)" \
81 SUFFIX.headers=cpp \
82 FLAGS.headers="-DU_HIDE_DEPRECATED_API"
374ca955 83
73c04bcf 84internaltest:
340931cb
A
85 $(MAKE) headertest \
86 NAME.headers=$@ \
87 COMPILE.headers="$(COMPILE.cc)" \
88 SUFFIX.headers=cpp \
89 FLAGS.headers="-DU_HIDE_INTERNAL_API"
90
91obsoletetest:
92 $(MAKE) headertest \
93 NAME.headers=$@ \
94 COMPILE.headers="$(COMPILE.cc)" \
95 SUFFIX.headers=cpp \
96 FLAGS.headers="-DU_HIDE_OBSOLETE_API"
97
98dtest:
99 @FAIL=0;NONE="(No deprecated headers)";stub=ht_stub_dtest.cpp;for incfile in `cat $(srcdir)/dfiles.txt | grep -v '^#' | sort` ; do \
100 NONE= ; \
101 echo "$@ unicode/$$incfile" ; \
102 echo "#include <unicode/$$incfile>" > $$stub ; \
103 echo 'void junk(){}' >> $$stub ; \
104 $(COMPILE.cc) $(cppflags) $$stub 2>&1 | tee $$stub.out || FAIL=1 ; \
105 if ! cat $$stub.out | sed -e 's/^.*#error[^"]*"//' | grep -v ht_ | grep -v "$$incfile header is obsolete"; then \
106 echo "** FAIL Header unicode/$$incfile is not obsoleted properly" ; \
107 FAIL=1 ; \
108 fi ; \
109 rm -f $$stub*; \
4388f060 110 done ; \
340931cb 111 echo "$@: $$NONE - exit status $$FAIL" ; \
4388f060 112 exit $$FAIL
73c04bcf 113
340931cb
A
114cppguardtest:
115 @FAIL=0;stub=ht_stub_cppguardtest.cpp; for file in "$(prefix)/include/unicode"/*.h ; do \
116 incfile=`basename $$file` ; \
117 if grep -q "U_SHOW_CPLUSPLUS_API" $$file ; then \
118 echo "$@ unicode/$$incfile" ; \
119 echo "#include <unicode/$$incfile>" > $$stub ; \
120 echo 'void junk(){}' >> $$stub ; \
121 echo '#if !defined(U_SHOW_CPLUSPLUS_API)' >> $$stub ; \
122 echo "#error The header '$$incfile' refers to the macro U_SHOW_CPLUSPLUS_API (defined in utypes.h) but either does not include utypes.h or does so incorrectly." >> $$stub ; \
123 echo '#endif' >> $$stub ; \
124 $(COMPILE.cc) $(cppflags) $$stub || FAIL=1 ; \
125 rm -f $$stub; \
126 else \
127 echo "$@ skipping unicode/$$incfile" ; \
128 fi ; \
4388f060
A
129 done ; \
130 exit $$FAIL
131
374ca955 132clean:
340931cb 133 -@rm -f ht_*
374ca955
A
134
135distclean: clean
136 -@rm -f Makefile
137
46f4442e
A
138Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
139 cd $(top_builddir) \
140 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
141
340931cb 142.PHONY: doclean check all headertest cpptest dtest cppguardtest ctest clean distclean