xref: /petsc/gmakefile.test (revision b698fc57f0bea7237255b29c1b77df0acc362ffd)
1# -*- mode: makefile-gmake -*-
2-include petscdir.mk
3
4.SUFFIXES: .F  .F90 .f90 ${SUFFIXES} .PETSc .C .cc .cpp .cxx .r .rm .so .html .ad .m .tex .mtex .make  .fig .svg .eps .pdf .jpg .png .dvi .ps .F95 .f95 .fiat .cu .kokkos.cxx
5
6CONFIGDIR := $(PETSC_DIR)/config
7
8# TESTSRCDIR is always relative to gmakefile.test
9#  This must be before includes
10mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
11TESTSRCDIR := $(dir $(mkfile_path))src
12
13-include $(PETSC_DIR)/$(PETSC_ARCH)/lib/petsc/conf/petscvariables
14-include $(PETSC_DIR)/lib/petsc/conf/variables
15
16TESTDIR ?= ./$(PETSC_ARCH)/tests
17MODDIR := $(PETSC_DIR)/$(PETSC_ARCH)/include
18TESTLOGTAPFILE ?= $(TESTDIR)/test_$(PETSC_ARCH)_tap.log
19TESTLOGERRFILE ?= $(TESTDIR)/test_$(PETSC_ARCH)_err.log
20EXAMPLESDIR := $(TESTSRCDIR)
21
22pkgs := sys vec mat dm ksp snes ts tao
23
24petscconf      := $(PETSC_DIR)/$(PETSC_ARCH)/include/petscconf.h
25petscvariables := $(PETSC_DIR)/$(PETSC_ARCH)/lib/petsc/conf/petscvariables
26generatedtest  := $(TESTDIR)/testfiles
27
28.SECONDEXPANSION:		# to expand $$(@D)/.DIR
29
30TESTFLAGS :=             # Initialize as simple variable
31
32#workarround old cygwin versions
33ifeq ($(PETSC_CYGWIN_BROKEN_PIPE),1)
34ifeq ($(shell basename $(AR)),ar)
35  V ?=1
36endif
37endif
38V ?= $(if $(findstring s,$(MAKEFLAGS)),0)
39ifeq ($(V),)  # Default
40  quiet_HELP := "Use \"$(MAKE) V=1\" to see verbose compile lines, \"$(MAKE) V=0\" to suppress.\n"
41  quiet = @printf $(quiet_HELP)$(eval quiet_HELP:=)"  %10s %s\n" "$1$2" "$@"; $($1)
42  quiettest = @printf "  %10s %s\n" "TEST" "$(@:$(TESTDIR)/counts/%.counts=%)";
43else ifeq ($(V),0)		# Suppress entire command
44  quiet = @$($1)
45  quiettest = @
46  TESTFLAGS += -o err_only
47else				# Show the full command line
48  quiet = $($1)
49  quiettest =
50  TESTFLAGS += -v
51endif
52
53ifeq ($(FORCE),1)
54  TESTFLAGS += -f    # force test execution
55endif
56ifeq ($(CUDAMEMCHECK),1)
57  TESTFLAGS += -U    # Add cuda-memcheck option to the flags
58endif
59ifeq ($(VALGRIND),1)
60  TESTFLAGS += -V    # Add valgrind option to the flags
61endif
62ifeq ($(DEBUG),1)
63  TESTFLAGS += -d    # Launch test in debugger
64endif
65ifeq ($(REPLACE),1)
66  TESTFLAGS += -m    # Replace results by passing -m to petscdiff
67endif
68ifeq ($(OUTPUT),1)
69  TESTFLAGS += -o 'err_only'    # Show only the errors on stdout
70endif
71ifeq ($(ALT),1)
72  TESTFLAGS += -M    # Replace alt files by passing -M to petscdiff
73endif
74PRINTONLY ?= 0
75ifeq ($(PRINTONLY),1)
76  TESTFLAGS += -p    # Pass -p to petscdiff to print only command
77endif
78ifeq ($(DIFF_NUMBERS),1)
79  TESTFLAGS += -j    # Pass -j to petscdiff to diff the actual numbers
80endif
81ifdef OPTIONS
82  TESTFLAGS += -a '$(OPTIONS)'   # override arguments
83endif
84ifdef EXTRA_OPTIONS
85  TESTFLAGS += -e '$(EXTRA_OPTIONS)'  # add extra arguments
86endif
87ifdef NP
88  TESTFLAGS += -n $(NP)  # set number of processes
89endif
90# Override the default timeout that may be found at the top of config/petsc_harness.sh
91# This must be an integer.  It is given in seconds.
92ifdef TIMEOUT
93  TESTFLAGS += -t $(TIMEOUT)  # Override the default timeout
94endif
95
96$(generatedtest) : $(petscconf) $(petscvariables) $(CONFIGDIR)/gmakegentest.py $(TESTDIR)/.DIR | $$(@D)/.DIR
97	$(PYTHON) $(CONFIGDIR)/gmakegentest.py --petsc-dir=$(PETSC_DIR) --petsc-arch=$(PETSC_ARCH) --testdir=$(TESTDIR)
98
99ifneq ($(filter-out clean check,$(MAKECMDGOALS:clean%=clean)),)
100include $(generatedtest)
101endif
102
103ifeq ($(PETSC_LANGUAGE),CXXONLY)
104  cc_name := CXX
105else
106  cc_name := CC
107endif
108
109PETSC_COMPILE.c = $(call quiet,$(cc_name)) -c $(PCC_FLAGS) $(PFLAGS) $(CCPPFLAGS) $(C_DEPFLAGS)
110PETSC_COMPILE.cxx = $(call quiet,CXX) -c $(CXX_FLAGS) $(CXXFLAGS) $(CXXCPPFLAGS) $(CXX_DEPFLAGS)
111ifneq ($(KOKKOS_BIN),)
112# Kokkos requires nvcc to be in PATH and the C++ compiler to be given in an environmental variable
113PETSC_COMPILE.kokkos.cxx = PATH=$(PATH):`dirname $(CUDAC)` NVCC_WRAPPER_DEFAULT_COMPILER=$(CXX_LINKER) $(KOKKOS_BIN)/nvcc_wrapper --expt-extended-lambda -c $(CXX_FLAGS) $(CXXFLAGS) $(CXXCPPFLAGS)
114PETSC_LINK.kokkos.cxx = PATH=$(PATH):`dirname $(CUDAC)` NVCC_WRAPPER_DEFAULT_COMPILER=$(CXX_LINKER) $(KOKKOS_BIN)/nvcc_wrapper --expt-extended-lambda  $(CXX_LINKER_FLAGS) $(PETSC_CCPPFLAGS) $(CPPFLAGS) $(LDFLAGS)
115else
116PETSC_COMPILE.kokkos.cxx = $(call quiet,CXX) -c $(CXX_FLAGS) $(CXXFLAGS) $(CXXCPPFLAGS) $(CXX_DEPFLAGS)
117PETSC_LINK.kokkos.cxx = $(CXXLINKER) $(CXX_LINKER_FLAGS) $(CXXFLAGS) $(PETSC_CCPPFLAGS) $(CPPFLAGS) $(LDFLAGS)
118endif
119PETSC_COMPILE.cu = $(call quiet,CUDAC) -c $(CUDAC_FLAGS) $(CUFLAGS) --compiler-options="$(PCC_FLAGS) $(CXXFLAGS) $(CCPPFLAGS)"
120PETSC_COMPILE.hip.cpp = $(call quiet,HIPCC) -c $(HIPCC_FLAGS) $(HIPCCFLAGS) $(HIPCCPPFLAGS) $(HIPCC_DEPFLAGS) $(CXXFLAGS) $(CXXCPPFLAGS) $(CXX_DEPFLAGS)
121PETSC_COMPILE.sycl.cpp = $(call quiet,SYCLCPP) -c $(SYCLCPP_FLAGS) $(SYCLCPPFLAGS) $(SYCLCPPCPPFLAGS) $(SYCLCPP_DEPFLAGS)
122PETSC_GENDEPS.cu = $(call quiet,CUDAC,.dep) --generate-dependencies --output-directory=$(@D) $(CUDAC_FLAGS) $(CUFLAGS) --compiler-options="$(PCC_FLAGS) $(CXXFLAGS) $(CCPPFLAGS)"
123PETSC_COMPILE.F = $(call quiet,FC) -c $(FC_FLAGS) $(FFLAGS) $(FCPPFLAGS) $(FC_DEPFLAGS)
124
125testlangs := c cu cxx F F90 kokkos.cxx hip.cpp sycl.cpp
126$(foreach lang, $(testlangs), $(eval \
127  testexe.$(lang) = $(foreach pkg, $(pkgs), $(testsrcs-$(pkg).$(lang):%.$(lang)=$(TESTDIR)/%))))
128concattestlang = $(foreach lang, $(2), $(testsrcs-$(1).$(lang):%.$(lang)=$(TESTDIR)/%.o))
129testsrcs.o := $(foreach pkg, $(pkgs), $(call concattestlang,$(pkg),$(testlangs)))
130testsrcs-rel := $(foreach pkg, $(pkgs), $(foreach lang, $(testlangs), $(testsrcs-$(pkg).$(lang))))
131testsrcs := $(foreach sfile, $(testsrcs-rel), $(TESTSRCDIR)/$(sfile))
132
133# workaround win32fe failure
134ifneq (,$(findstring win32fe,$(call quiet,$(cc_name))))
135$(TESTDIR)/ts/tutorials/multirate/ex6: | $(TESTDIR)/ts/tutorials/multirate/ex5
136$(TESTDIR)/ts/tutorials/multirate/ex8: | $(TESTDIR)/ts/tutorials/multirate/ex6
137endif
138
139# Refresh testfiles when sources change, but don't balk if the source file is nonexistent (deleted)
140$(generatedtest) : $(testsrcs)
141$(testsrcs) :
142
143$(TESTDIR)/%.o : $(EXAMPLESDIR)/%.c | $$(@D)/.DIR
144	$(PETSC_COMPILE.c) $(abspath $<) -o $@
145
146$(TESTDIR)/%.o : $(EXAMPLESDIR)/%.kokkos.cxx | $$(@D)/.DIR
147	$(PETSC_COMPILE.kokkos.cxx) $(abspath $<) -o $@
148
149$(TESTDIR)/%.o : $(EXAMPLESDIR)/%.cxx | $$(@D)/.DIR
150	$(PETSC_COMPILE.cxx) $(abspath $<) -o $@
151
152$(TESTDIR)/%.o : $(EXAMPLESDIR)/%.cu | $$(@D)/.DIR
153	$(PETSC_COMPILE.cu) $(abspath $<) -o $@ # Compile first so that if there is an error, it comes from a normal compile
154	@$(PETSC_GENDEPS.cu) $(abspath $<) -o $(@:%.o=%.d) # Generate the dependencies for later
155
156# Test modules go in the same directory as the target *.o
157TESTMODDIR = $(@D)
158FCMOD = cd
159$(TESTDIR)/%.o : $(EXAMPLESDIR)/%.F | $$(@D)/.DIR
160ifeq ($(FC_MODULE_OUTPUT_FLAG),)
161	$(call quiet,FCMOD) $(TESTMODDIR) && $(FC) -c $(FC_FLAGS) $(FFLAGS) $(FCPPFLAGS) $(FC_DEPFLAGS) -I$(dir $<) $(abspath $<) -o $(abspath $@)
162else
163	$(PETSC_COMPILE.F) -I$(dir $<) $(abspath $<) -o $@ $(FC_MODULE_OUTPUT_FLAG)$(TESTMODDIR) $(FC_MODULE_FLAG)$(TESTMODDIR)
164endif
165	-@$(GFORTRAN_DEP_CLEANUP)
166
167$(TESTDIR)/%.o : $(EXAMPLESDIR)/%.F90 | $$(@D)/.DIR
168ifeq ($(FC_MODULE_OUTPUT_FLAG),)
169	$(call quiet,FCMOD) $(TESTMODDIR) && $(FC) -c $(FC_FLAGS) $(FFLAGS) $(FCPPFLAGS) $(FC_DEPFLAGS) -I$(dir $<) $(abspath $<) -o $(abspath $@)
170else
171	$(PETSC_COMPILE.F) -I$(dir $<) $(abspath $<) -o $@ $(FC_MODULE_OUTPUT_FLAG)$(TESTMODDIR) $(FC_MODULE_FLAG)$(TESTMODDIR)
172endif
173	-@$(GFORTRAN_DEP_CLEANUP)
174
175#   This is a hack to fix a broken gfortran.
176define GFORTRAN_DEP_CLEANUP
177  if test -e "$(@:%.o=%.d)" && head -1 "$(@:%.o=%.d)" | fgrep -q -v : ; then\
178    echo "$(@): \\" > $(@:%.o=%.dtemp) ; \
179    tr '\n' '@' < $(@:%.o=%.d) | cut -d: -f2- | tr '@' '\n' >> $(@:%.o=%.dtemp) ; \
180    mv $(@:%.o=%.dtemp) $(@:%.o=%.d); \
181  fi
182endef
183
184# link line constructed differently for gmakefile vs gmakefile.test invocation
185ifeq ($(libpetscall),)
186PETSC_TEST_LIB = $(PETSC_LIB)
187else
188PETSC_TEST_LIB = $(C_SH_LIB_PATH) $(PETSC_EXTERNAL_LIB_BASIC)
189endif
190
191# manually list some some library dependencies to check for circular dependencies
192$(TESTDIR)/sys/tests/ex9: PETSC_TEST_LIB = $(PETSC_SYS_LIB)
193$(TESTDIR)/vec/vec/tests/ex1: PETSC_TEST_LIB = $(PETSC_VEC_LIB)
194$(TESTDIR)/mat/tests/ex1: PETSC_TEST_LIB = $(PETSC_MAT_LIB)
195$(TESTDIR)/dm/tests/ex1: PETSC_TEST_LIB = $(PETSC_DM_LIB)
196$(TESTDIR)/ksp/ksp/tests/ex1: PETSC_TEST_LIB = $(PETSC_KSP_LIB)
197$(TESTDIR)/snes/tests/ex1: PETSC_TEST_LIB = $(PETSC_SNES_LIB)
198$(TESTDIR)/ts/tests/ex2: PETSC_TEST_LIB = $(PETSC_TS_LIB)
199$(TESTDIR)/tao/tutorials/ex1: PETSC_TEST_LIB = $(PETSC_TAO_LIB)
200
201# if run with MACOS_FIREWALL=1 or MACOS_FIREWALL_REFRESH=1, ensure mpiexec.hydra and test executable is on firewall list
202ifeq ($(MACOS_FIREWALL_REFRESH),1)
203# MACOS_FIREWALL_REFRESH=1 imply MACOS_FIREWALL=1
204MACOS_FIREWALL := 1
205endif
206
207ifeq ($(MACOS_FIREWALL),1)
208MACOS_FIREWALL_MPIEXEC := $(shell $(PYTHON) -c "import os; print(os.path.realpath('$(MPIEXEC)'))")
209FW := /usr/libexec/ApplicationFirewall/socketfilterfw
210ifeq ($(MACOS_FIREWALL_REFRESH),1)
211define macos-firewall-register
212  @APP=$(call abspath, $(1)); \
213    echo "MACOS_FIREWALL_REFRESH set => refresh firewall rule"; \
214    if ! sudo -n true 2>/dev/null; then echo "Asking for sudo password to add new firewall rule for\n  $$APP:"; fi; \
215    sudo $(FW) --remove $$APP && \
216    sudo $(FW) --add $$APP && \
217    sudo $(FW) --blockapp $$APP
218endef
219else
220define macos-firewall-register
221  @APP=$(call abspath, $(1)); \
222    ANS=`$(FW) --getappblocked $$APP`; \
223    if ! echo $$ANS | grep "$$APP" &> /dev/null; then \
224      if ! sudo -n true 2>/dev/null; then echo "Asking for sudo password to add new firewall rule for\n  $$APP:"; fi; \
225      sudo $(FW) --add $$APP && \
226      sudo $(FW) --blockapp $$APP; \
227    else \
228      echo $$ANS; \
229    fi
230endef
231endif
232define macos-firewall-fix
233  $(call macos-firewall-register, $(MACOS_FIREWALL_MPIEXEC))
234  $(call macos-firewall-register, $(1))
235endef
236endif
237
238# Test executables
239$(testexe.F) $(testexe.F90) : $(TESTDIR)/% : $(TESTDIR)/%.o $$^ $(libpetscall)
240	$(call quiet,FLINKER) -o $@ $^ $(PETSC_TEST_LIB)
241	-$(call macos-firewall-fix,$@)
242
243$(testexe.c) $(testexe.cu) : $(TESTDIR)/% : $(TESTDIR)/%.o $$^ $(libpetscall)
244	$(call quiet,CLINKER) -o $@ $^ $(PETSC_TEST_LIB)
245	-$(call macos-firewall-fix,$@)
246
247$(testexe.kokkos.cxx) : $(TESTDIR)/% : $(TESTDIR)/%.o $$^ $(libpetscall)
248	$(call quiet,PETSC_LINK.kokkos.cxx) -o $@ $^ $(PETSC_TEST_LIB)
249	-$(call macos-firewall-fix,$@)
250
251$(testexe.cxx) : $(TESTDIR)/% : $(TESTDIR)/%.o $$^ $(libpetscall)
252	$(call quiet,CXXLINKER) -o $@ $^ $(PETSC_TEST_LIB)
253	-$(call macos-firewall-fix,$@)
254
255# Fortran source files need petsc*.mod, which isn't explicitly managed in the makefile.
256$(foreach pkg, $(pkgs), $(call concattestlang,$(pkg),F F90)) : $(libpetscall)
257
258# Testing convenience targets
259.PHONY: test pre-clean
260
261test: report_tests
262
263pre-clean:
264	@$(RM) -rf $(TESTDIR)/counts $(TESTLOGTAPFILE) $(TESTLOGERRFILE)
265	@touch $(TESTLOGTAPFILE) $(TESTLOGERRFILE)
266	@echo "Using MAKEFLAGS:" ${MAKEFLAGS}
267
268check-test-errors:
269	@grep '^not ok' $(TESTLOGTAPFILE) | grep -v 'Exceeded timeout' | tee $(TESTDIR)/allgtests-tap-err.log
270	@test ! -s $(TESTDIR)/allgtests-tap-err.log
271
272.PHONY: $(foreach pkg, $(pkgs), test-$(pkg) $(foreach lang, $(testlangs), test-$(pkg).$(lang) test-rm-$(pkg).$(lang)))
273testpkgs := $(foreach pkg, $(pkgs), test-$(pkg))
274# Targets to run tests in test-$pkg.$lang and delete the executables, language by language
275$(testpkgs) : test-% : $(foreach lang, $(testlangs), test-rm-%.$(lang))
276# List of raw test run targets
277alltesttargets := $(foreach tp, $(testpkgs), $(foreach lang, $(testlangs), $($(tp).$(lang))))
278
279# Run targets
280$(alltesttargets) : % : $(TESTDIR)/counts/%.counts
281.PHONY: $(alltesttargets)
282
283$(TESTDIR)/counts/%.counts :
284	$(quiettest) $< $(TESTFLAGS)
285
286# Targets to run tests and remove executables, by package-lang pairs.
287# Run the tests in each batch using recursive invocation of make because
288# we need all of them to complete before removing the executables.  Make
289# doesn't guarantee an exploration order for the graph.  Only recursive
290# if there is something to be done.
291alltest-rm := $(foreach pkg, $(pkgs), $(foreach lang, $(testlangs), test-rm-$(pkg).$(lang)))
292$(alltest-rm) : test-rm-% : test-%
293ifneq ($(NO_RM),1)
294	$(call quiet,RM) $(addprefix $(TESTDIR)/,$(basename $($(@:test-rm-%=testsrcs-%))))
295endif
296
297# Remove intermediate .o files
298# This only removes the files at the end which is insufficient
299#.INTERMEDIATE: $(testsrcs.o:%.o=%)
300
301# all sources should get recompiled when petscvariables changes (i.e when configure is rerun or when petscvariables is manually edited.)
302$(testsrcs.o) : $(petscvariables)
303
304%/.DIR :
305	@mkdir -p $(@D)
306	@touch $@
307
308.PRECIOUS: %/.DIR
309
310.SUFFIXES: # Clear .SUFFIXES because we don't use implicit rules
311.DELETE_ON_ERROR:               # Delete likely-corrupt target file if rule fails
312
313.PHONY: clean cleantest all
314
315cleantest:
316	${RM} -r $(TESTDIR) $(generatedtest)
317
318clean: cleantest
319
320alltest.d := $(testsrcs.o:%.o=%.d)
321# Tell make that alltest.d are all up to date.  Without this, the include
322# below has quadratic complexity, taking more than one second for a
323# do-nothing build of PETSc (much worse for larger projects)
324$(alltest.d) : ;
325
326-include $(alltest.d)
327
328# Tests can be generated by searching -- see documentation below
329ifndef searchin
330   searchin = " "
331endif
332ifdef i
333   searchin = $(i)
334endif
335ifdef gmakesearch
336  TESTTARGETS := $(filter $(search),$(alltesttargets))
337  ifdef gmakesearchin
338    TESTTARGETS2 := $(foreach v,$(TESTTARGETS),$(if $(findstring $(gmakesearchin),$(v)),$(v)))
339    TESTTARGETS := $(TESTTARGETS2)
340  endif
341else ifdef gmakesearchin
342  TESTTARGETS := $(foreach v,$(alltesttargets),$(if $(findstring $(gmakesearchin),$(v)),$(v)))
343else ifdef argsearch
344  TESTTARGETS := $(foreach v,$(alltesttargets),$(if $(findstring $(argsearch),$($(v)_ARGS)),$(v)))
345else ifdef search
346  TESTTARGETS := $(shell $(PYTHON) config/query_tests.py --petsc-dir=$(PETSC_DIR) --petsc-arch=$(PETSC_ARCH) --searchin=$(searchin) 'name' '$(search)')
347else ifdef s
348  TESTTARGETS := $(shell $(PYTHON) config/query_tests.py --petsc-dir=$(PETSC_DIR) --petsc-arch=$(PETSC_ARCH) --searchin=$(searchin) 'name' '$(s)')
349else ifdef test-fail
350  TESTTARGETS := $(shell $(PETSC_ARCH)/tests/echofailures.sh)
351else ifdef query
352  TESTTARGETS := $(shell $(PYTHON) config/query_tests.py --petsc-dir=$(PETSC_DIR) --petsc-arch=$(PETSC_ARCH) --searchin=$(searchin) '$(query)' '$(queryval)')
353else ifdef q
354  TESTTARGETS := $(shell $(PYTHON) config/query_tests.py --petsc-dir=$(PETSC_DIR) --petsc-arch=$(PETSC_ARCH) --searchin=$(searchin) '$(q)' '$(qv)')
355else                            # No filter - run them all, but delete the executables as we go
356  TESTTARGETS := $(testpkgs)
357endif
358
359.PHONY: report_tests print-test
360
361print-test:
362	$(info $(TESTTARGETS))
363	@true
364
365show-fail:
366	-@$(PYTHON) $(CONFIGDIR)/report_tests.py -d $(TESTDIR)/counts -f
367
368
369
370# Don't start running tests until starttime has completed
371$(alltesttargets:%=$(TESTDIR)/counts/%.counts) : starttime
372
373# Ensure that libpetsc (if it is a prerequisite) has been built and clean the counts/logs before starting timer
374starttime: pre-clean $(libpetscall)
375	@$(eval STARTTIME := $(shell date +%s))
376
377report_tests: starttime $(TESTTARGETS)
378	@$(eval ENDTIME := $(shell date +%s))
379	-@if test ${PRINTONLY} -ne 1; then  elapsed_time=$$(($(ENDTIME)- $(STARTTIME))) && \
380	$(PYTHON) $(CONFIGDIR)/report_tests.py -m $(MAKE) -d $(TESTDIR)/counts -t 5 -e $${elapsed_time};\
381    fi
382
383check_output:
384	$(PYTHON) $(CONFIGDIR)/gmakegentest.py --petsc-dir=$(PETSC_DIR) --petsc-arch=$(PETSC_ARCH) --testdir=$(TESTDIR) --check-output
385
386# Do not how how to invoke test from makefile
387HASGMAKEFILE := $(filter gmakefile,$(MAKEFILE_LIST))
388ifeq ($(HASGMAKEFILE),gmakefile)
389helpdeps:=help-make help-targets
390makefile="gmakefile"
391other_help="To see full test help: make -f gmakefile.test help"
392else
393helpdeps:=help-make help-targets help-test
394makefile="gmakefile.test"
395other_help=""
396endif
397
398help: ${helpdeps}
399	-@echo "Above is from: ${helpdeps}"
400	-@echo "${other_help}"
401
402help-make:
403	-@echo
404	-@echo "Basic build usage:"
405	-@echo "   make -f ${makefile} <options>"
406	-@echo
407	-@echo "Options:"
408	-@echo "  V=0           Very quiet builds"
409	-@echo "  V=1           Verbose builds"
410	-@echo
411
412help-targets:
413	-@echo "All makefile targets and their dependencies:"
414	-@grep ^[a-z] ${makefile} | grep : | grep -v =
415	-@echo
416	-@echo
417
418help-test:
419	-@echo "Basic test usage:"
420	-@echo "   make -f ${makefile} test <options>"
421	-@echo
422	-@echo "Options:"
423	-@echo "  V=1               Verbose output (-v to scripts)"
424	-@echo "  NO_RM=1           Do not remove the executables after running"
425	-@echo "  REPLACE=1         Replace the output in PETSC_DIR source tree (-m to test scripts)"
426	-@echo "  OUTPUT=1          Show only the errors on stdout"
427	-@echo "  ALT=1             Replace 'alt' output in PETSC_DIR source tree (-M to test scripts)"
428	-@echo "  DIFF_NUMBERS=1    Diff the numbers in the output (-j to test scripts and petscdiff)"
429	-@echo "  CUDAMEMCHECK=1    Execute the tests using cuda-memcheck (-U to test scripts)"
430	-@echo "  VALGRIND=1        Execute the tests using valgrind (-V to test scripts)"
431	-@echo "  DEBUG=1           Launch tests in the debugger (-d to the scripts)"
432	-@echo "  NP=<num proc>     Set a number of processors to pass to scripts."
433	-@echo "  FORCE=1           Force SKIP or TODO tests to run"
434	-@echo "  PRINTONLY=1       Print the command, but do not run.  For loops print first command"
435	-@echo "  TIMEOUT=<time>    Test timeout limit in seconds (default in config/petsc_harness.sh)"
436	-@echo "  TESTDIR='tests'   Subdirectory where tests are run ($${PETSC_DIR}/$${PETSC_ARCH}/$${TESTDIR}"
437	-@echo "                    or $${PREFIX_DIR}/$${TESTDIR}"
438	-@echo "                    or $${PREFIX_DIR}/share/petsc/examples/$${TESTDIR})"
439	-@echo "  TESTBASE='tests'   Subdirectory where tests are run ($${PETSC_DIR}/$${PETSC_ARCH}/$${TESTDIR}"
440	-@echo "  OPTIONS='<args>'  Override options to scripts (-a to test scripts)"
441	-@echo "  EXTRA_OPTIONS='<args>'  Add options to scripts (-e to test scripts)"
442	-@echo
443	-@echo "Special options for macOS:"
444	-@echo "  MACOS_FIREWALL=1          Add each built test to the macOS firewall list to prevent popups. Configure --with-macos-firewall-rules to make this default"
445	-@echo "  MACOS_FIREWALL_REFRESH=1  The same, but force re-addition to the list. You need to do cleantest first"
446	-@echo
447	-@echo "Tests can be generated by searching with multiple methods"
448	-@echo "  For general searching (using config/query_test.py):"
449	-@echo "    make -f ${makefile} test search='sys*ex2*'"
450	-@echo "   or the shortcut using s"
451	-@echo "    make -f ${makefile} test s='sys*ex2*'"
452	-@echo "  You can also use the full path to a file directory"
453	-@echo "    make -f ${makefile} test s='src/sys/tests/'"
454	-@echo
455	-@echo "  To search for fields from the original test definitions:"
456	-@echo "    make -f ${makefile} test query='requires' queryval='*MPI_PROCESS_SHARED_MEMORY*'"
457	-@echo "   or the shortcut using q and qv"
458	-@echo "    make -f ${makefile} test q='requires' qv='*MPI_PROCESS_SHARED_MEMORY*'"
459	-@echo "  To filter results from other searches, use searchin"
460	-@echo "    make -f ${makefile} test s='src/sys/tests/' searchin='*options*'"
461	-@echo
462	-@echo "  To re-run the last tests which failed:"
463	-@echo "    make -f ${makefile} test test-fail='1'"
464	-@echo
465	-@echo "  To see which targets match a given pattern (useful for doing a specific target):"
466	-@echo "    make -f ${makefile} print-test search=sys*"
467	-@echo
468	-@echo "  To build an executable, give full path to location:"
469	-@echo '    make -f ${makefile} $${PETSC_ARCH}/tests/sys/tests/ex1'
470	-@echo "  or make the test with NO_RM=1"
471	-@echo
472