michael@0: ## michael@0: ## Copyright (c) 1999-2011, International Business Machines Corporation and michael@0: ## others. All Rights Reserved. michael@0: ## michael@0: ## michael@0: ## THE PURPOSE OF THIS TEST michael@0: ## michael@0: ## This tests all public header files - as installed. icu-config needs to be on the PATH michael@0: ## michael@0: ## To run it simply type 'make check' after ICU is installed. You SHOULD see: michael@0: ## michael@0: ## unicode/uchar.h - 0 michael@0: ## unicode/uchriter.h - 0 michael@0: ## unicode/ucnv.h - 0 michael@0: ## michael@0: ## .. etc. Anything other than zero is an error. (except for the deprecation tests, where '1' is the correct value) michael@0: ## michael@0: ## michael@0: ## If a header fails the C compile because it's a C++ header, add it to the michael@0: ## file named 'cxxfiles.txt' in this directory. michael@0: ## michael@0: ## If a header fails because it is deprecated, add it to the 'dfiles.txt' michael@0: ## michael@0: ## michael@0: michael@0: ## Source directory information michael@0: srcdir = @srcdir@ michael@0: top_srcdir = @top_srcdir@ michael@0: michael@0: top_builddir = ../.. michael@0: subdir = test/hdrtst michael@0: michael@0: include $(shell icu-config --incfile) michael@0: DIRS=$(prefix)/include/unicode michael@0: LDIRS=$(prefix)/include/layout michael@0: ECHO_T=@ECHO_T@ michael@0: ECHO_C=@ECHO_C@ michael@0: ECHO_N=@ECHO_N@ michael@0: michael@0: all: michael@0: @echo Please read this Makefile for more information. michael@0: @echo run \'$(MAKE) check\' to run the test "(use -k if you don't want to stop on errs)" michael@0: michael@0: E_NUM=8 michael@0: E_D="[1/$(E_NUM)] Deprecated: " michael@0: E_C="[2/$(E_NUM)] C : " michael@0: E_CXX="[3/$(E_NUM)] C++: " michael@0: E_CXX_L="[4/$(E_NUM)] C++ layout: " michael@0: E_DRF="[5/$(E_NUM)] Hide Draft: " michael@0: E_DEP="[6/$(E_NUM)] Hide Deprecated: " michael@0: E_INT="[7/$(E_NUM)] Hide Internal: " michael@0: E_OBS="[8/$(E_NUM)] Hide Obsolete: " michael@0: michael@0: check: dtest ctest cpptest lotest doclean drafttest deprtest internaltest obsoletetest michael@0: ifeq ($(MAKECMDGOALS),check) michael@0: $(MAKE) clean michael@0: else michael@0: @echo "(not cleaning automatically)" michael@0: endif michael@0: michael@0: # break dependency michael@0: doclean: michael@0: make clean michael@0: michael@0: cpptest: michael@0: @FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \ michael@0: incfile=`basename $$file .h` ; \ michael@0: echo "$@ unicode/$$incfile.h" ; \ michael@0: echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.cpp ; \ michael@0: echo 'void junk(){}' >> ht_$$incfile.cpp ; \ michael@0: $(COMPILE.cc) -c $(cppflags) ht_$$incfile.cpp || FAIL=1 ; \ michael@0: done ;\ michael@0: exit $$FAIL michael@0: michael@0: lotest: michael@0: @FAIL=0;for file in $(prefix)/include/layout/*.h; do \ michael@0: incfile=`basename $$file .h` ; \ michael@0: echo "$@ layout/$$incfile.h" ; \ michael@0: echo '#include "'layout/$$incfile'.h"' > ht_$$incfile.cpp ; \ michael@0: echo 'void junk(){}' >> ht_$$incfile.cpp ; \ michael@0: $(COMPILE.cc) -c $(cppflags) -I$(prefix)/include/layout ht_$$incfile.cpp || FAIL=1; \ michael@0: done ;\ michael@0: exit $$FAIL michael@0: michael@0: dtest: michael@0: @FAIL=0;NONE="(No deprecated headers)";for stub in `cat $(srcdir)/dfiles.txt | grep -v '^#'` ; do \ michael@0: file=unicode/$$stub ; \ michael@0: NONE="" ; \ michael@0: incfile=`basename $$file .h` ; \ michael@0: echo "$@ unicode/$$incfile.h" ; \ michael@0: echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.cpp ; \ michael@0: echo 'void junk(){}' >> ht_$$incfile.cpp ; \ michael@0: echo > ht_dep.junk ; \ michael@0: $(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" ; \ michael@0: RES=$$? ; \ michael@0: echo $$RES ; \ michael@0: fgrep -q "$$incfile.h header is obsolete" ht_dep.junk || echo "** FAIL Header unicode/$$incfile.h is not obsoleted properly" ; \ michael@0: fgrep -q "$$incfile.h header is obsolete" ht_dep.junk || FAIL=1 ; \ michael@0: rm -f unicode/$$stub ; \ michael@0: done ; \ michael@0: echo "$@: $$NONE - exit status $$FAIL" ; \ michael@0: exit $$FAIL michael@0: michael@0: # < ht_dep.junk && ; \ michael@0: michael@0: michael@0: ctest: michael@0: @echo Building test harness for header files in ../../common and ../../i18n michael@0: @FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/cxxfiles.txt | tee cfiles.txt`; do \ michael@0: incfile=`basename $$file .h` ; \ michael@0: echo "$@ unicode/$$incfile.h" ; \ michael@0: echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.c ; \ michael@0: echo 'void junk(void);' >> ht_$$incfile.c ; \ michael@0: echo 'void junk(){}' >> ht_$$incfile.c ; \ michael@0: $(COMPILE.c) -c $(cppflags) ht_$$incfile.c || FAIL=1 ; \ michael@0: done ;\ michael@0: exit $$FAIL michael@0: michael@0: drafttest: michael@0: @FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \ michael@0: incfile=`basename $$file .h` ; \ michael@0: echo "$@ unicode/$$incfile.h" ; \ michael@0: echo '#define U_HIDE_DRAFT_API' > hd_$$incfile.c; \ michael@0: echo '#include "'unicode/$$incfile'.h"' >> hd_$$incfile.c ; \ michael@0: echo 'void junk(void);' >> hd_$$incfile.c ; \ michael@0: echo 'void junk(){}' >> hd_$$incfile.c ; \ michael@0: $(COMPILE.cc) -c $(cppflags) hd_$$incfile.c ||FAIL=1 ; \ michael@0: done ;\ michael@0: exit $$FAIL michael@0: michael@0: deprtest: michael@0: @FAIL=0; for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \ michael@0: incfile=`basename $$file .h` ; \ michael@0: echo "$@ unicode/$$incfile.h" ; \ michael@0: echo '#define U_HIDE_DEPRECATED_API' > hdp_$$incfile.c; \ michael@0: echo '#include "'unicode/$$incfile'.h"' >> hdp_$$incfile.c ; \ michael@0: echo 'void junk(void);' >> hdp_$$incfile.c ; \ michael@0: echo 'void junk(){}' >> hdp_$$incfile.c ; \ michael@0: $(COMPILE.cc) -c $(cppflags) hdp_$$incfile.c || FAIL=1; \ michael@0: done ; \ michael@0: exit $$FAIL michael@0: michael@0: internaltest: michael@0: @FAIL=0;\ michael@0: for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \ michael@0: incfile=`basename $$file .h` ; \ michael@0: echo "$@ unicode/$$incfile.h" ; \ michael@0: echo '#define U_HIDE_INTERNAL_API' > hin_$$incfile.c; \ michael@0: echo '#include "'unicode/$$incfile'.h"' >> hin_$$incfile.c ; \ michael@0: echo 'void junk(void);' >> hin_$$incfile.c ; \ michael@0: echo 'void junk(){}' >> hin_$$incfile.c ; \ michael@0: $(COMPILE.cc) -c $(cppflags) hin_$$incfile.c || FAIL=1 ; \ michael@0: done ; \ michael@0: exit $$FAIL michael@0: michael@0: obsoletetest: michael@0: @FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \ michael@0: incfile=`basename $$file .h` ; \ michael@0: echo "$@ unicode/$$incfile.h" ; \ michael@0: echo '#define U_HIDE_OBSOLETE_API' > hob_$$incfile.c; \ michael@0: echo '#include "'unicode/$$incfile'.h"' >> hob_$$incfile.c ; \ michael@0: echo 'void junk(void);' >> hob_$$incfile.c ; \ michael@0: echo 'void junk(){}' >> hob_$$incfile.c ; \ michael@0: $(COMPILE.cc) -c $(cppflags) hob_$$incfile.c || FAIL=1 ; \ michael@0: done ; \ michael@0: exit $$FAIL michael@0: michael@0: clean: michael@0: -@echo cleaning.. michael@0: -@rm -f *.h *.c *.cpp *.o *.junk cfiles.txt michael@0: michael@0: distclean: clean michael@0: -@rm -f Makefile michael@0: michael@0: Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status michael@0: cd $(top_builddir) \ michael@0: && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status michael@0: michael@0: .PHONY: doclean check all cpptest lotest dtest ctest clean distclean michael@0: