summaryrefslogtreecommitdiffstats
path: root/config/conclude.am
blob: 20ca133345adaf09c45e51f4e8af6a7b9685bf99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
## config/conclude.am
## Textually included at the end of most HDF5 Makefiles.am.
## Contains build rules.

# Automake needs to be taught how to build lib, progs, and tests targets.
# These will be filled in automatically for the most part (e.g.,
# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and
# EXTRA_TEST variables are supplied to allow the user to force targets to
# be built at certain times. 
LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
        $(EXTRA_PROG)
TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST) 


# lib/progs/tests targets recurse into subdirectories. build-* targets
# build files in this directory.
# BUILT_SOURCES contain targets that need to be built before anything else
# in the directory (e.g., Fortran type detection)
build-lib: $(BUILT_SOURCES) $(LIB)
build-progs: $(BUILT_SOURCES) $(LIB) $(PROGS)
build-tests: $(BUILT_SOURCES) $(LIB) $(PROGS) $(TESTS)

lib progs tests check-s check-p check-clean ::
	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
	@for d in X $(SUBDIRS); do                                             \
	    if test $$d != X && test $$d != .; then                           \
	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
	    fi;                                                               \
	done

# Tell Automake to build tests when the user types `make all' (this is
# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
# Automake won't build them automatically, either.
all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(TESTS)

# make install-doc doesn't do anything outside of doc directory, but
# Makefiles should recognize it.
# UPDATE: docs no longer reside in this build tree, so this target
# is depreciated.
install-doc uninstall-doc:
	@echo "Nothing to be done."

# clean up files generated by tests so they can be re-run.
build-check-clean:
	$(RM) $(CHECK_CLEANFILES)

# run check-clean whenever mostlyclean is run
mostlyclean-local: build-check-clean

# Run each test in order, passing $(TEST_FLAGS) to the program.
# Since tests are done in a shell loop, "make -i" does apply inside it.
# Set HDF5_Make_Ignore to a non-blank string to ignore errors inside the loop.
# The timestamps give a rough idea how much time the tests use.
#
# Note that targets in TESTS (defined above) will be built when the user
# types 'make tests' or 'make check', but only programs in TEST_PROG,
# TEST_PROG_PARA, or TEST_SCRIPT will actually be executed.
check-TESTS: test

test _test:
	@$(MAKE) build-check-s
	@$(MAKE) build-check-p

# Actual execution of check-s.
build-check-s: $(LIB) $(PROGS) $(TESTS)
	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
	fi
	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
	fi

TEST_PROG_CHKEXE=$(TEST_PROG:=.chkexe_)
TEST_PROG_PARA_CHKEXE=$(TEST_PROG_PARA:=.chkexe_)
TEST_SCRIPT_CHKSH=$(TEST_SCRIPT:=.chkexe_)
TEST_SCRIPT_PARA_CHKSH=$(TEST_SCRIPT_PARA:=.chkexe_)

_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)

# The dummy.chkexe here prevents the target from being
# empty if there are no tests in the current directory.
# $${log} is the log file.
# $${tname} is the name of test.
$(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
	   tname=$(@:.chkexe_=)$(EXEEXT);\
	   log=$(@:.chkexe_=.chklog); \
	   echo "============================"; \
	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
	      echo "No need to test $${tname} again."; \
	   else \
	      echo "============================" > $${log}; \
	      if test "X$(HDF_FORTRAN)" = "Xyes"; then \
	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
	      elif test "X$(HDF_CXX)" = "Xyes"; then \
	         echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \
	         echo "C++ API: $${tname} $(TEST_FLAGS) Test Log" >> $${log};\
	      else \
	         echo "Testing $${tname} $(TEST_FLAGS)"; \
	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
	      fi; \
	      echo "============================" >> $${log}; \
	      srcdir="$(srcdir)" \
	         $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
	         && touch $(@:.chkexe_=.chkexe) || \
	         (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
	         (cat $${log} && false) || exit 1; \
	      echo "" >> $${log}; \
	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
	      echo "============================" >> $${log}; \
	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
	      cat $${log}; \
	   fi; \
	   echo "============================"; \
	fi
 
# The dummysh.chkexe here prevents the target from being
# empty if there are no tests in the current directory.
# $${log} is the log file.
# $${tname} is the name of test.
$(TEST_SCRIPT_CHKSH) $(TEST_SCRIPT_PARA_CHKSH) dummysh.chkexe_:
	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
	   tname=`basename $(@:.chkexe_=)`;\
	   log=`basename $(@:.chkexe_=.chklog)`; \
	   echo "============================"; \
	   if $(top_srcdir)/bin/newer `basename $(@:.chkexe_=.chkexe)` $(SCRIPT_DEPEND); then \
	      echo "No need to test $${tname} again."; \
	   else \
	      echo "============================" > $${log}; \
	      if test "X$(HDF_FORTRAN)" = "Xyes"; then \
	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
	      elif test "X$(HDF_CXX)" = "Xyes"; then \
	         echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \
	         echo "C++ API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
	      else \
	         echo "Testing $${tname} $(TEST_FLAGS)"; \
	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
	      fi; \
	      echo "============================" >> $${log}; \
	      RUNSERIAL="$(RUNSERIAL)" RUNPARALLEL="$(RUNPARALLEL)"           \
	      srcdir="$(srcdir)" \
	         $(TIME) $(SHELL) $(@:.chkexe_=) $(TEST_FLAGS) >> $${log} 2>&1 \
	         && touch `basename $(@:.chkexe_=.chkexe)` || \
	         (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
	         (cat $${log} && false) || exit 1; \
	      echo "" >> $${log}; \
	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
	      echo "============================" >> $${log}; \
	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
	      cat $${log}; \
	   fi; \
	   echo "============================"; \
	fi

# Actual execution of check-p.
build-check-p: $(LIB) $(PROGS) $(TESTS)
	@if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then      \
	   echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
	fi
	@if test -n "$(TEST_PROG_PARA)"; then                                \
	    echo "**** Hint ****";                                            \
	    echo "Parallel test files reside in the current directory"        \
	         "by default.";                                               \
	    echo "Set HDF5_PARAPREFIX to use another directory. E.g.,";       \
	    echo "    HDF5_PARAPREFIX=/PFS/user/me";                          \
	    echo "    export HDF5_PARAPREFIX";                                \
	    echo "    make check";                                            \
	    echo "**** end of Hint ****";                                     \
	fi
	@for test in $(TEST_PROG_PARA) dummy; do                             \
	   if test $$test != dummy; then                                      \
	      $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
	      RUNTESTS="$(RUNPARALLEL)"; \
	   fi;                                                                \
	done;                                                                 \
	test $$test = dummy || false
	@for test in $(TEST_SCRIPT_PARA) dummy; do                           \
	  if test $$test != dummy; then                                      \
	    $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_; \
	  fi;                                                                 \
	done;                                                                 \
	test $$test = dummy || false
	@if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then      \
	    echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
	fi

# Run test with different Virtual File Driver
check-vfd:
	@for vfd in $(VFD_LIST) dummy; do                                     \
	    if test $$vfd != dummy; then                                      \
	        echo "============================";                          \
	        echo "Testing Virtual File Driver $$vfd";                     \
	        echo "============================";                          \
	        HDF5_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check;              \
	    fi;                                                               \
	done