Debian Codegraph @

examples/caliper/makefile

raw
1 # Copyright (c) 2010-2025, Lawrence Livermore National Security, LLC. Produced
2 # at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3 # LICENSE and NOTICE for details. LLNL-CODE-806117.
4 #
5 # This file is part of the MFEM library. For more information and source code
6 # availability visit https://mfem.org.
7 #
8 # MFEM is free software; you can redistribute it and/or modify it under the
9 # terms of the BSD-3 license. We welcome feedback and contributions, see file
10 # CONTRIBUTING.md for details.
11
12 # Use the MFEM build directory
13 MFEM_DIR ?= ../..
14 MFEM_BUILD_DIR ?= ../..
15 MFEM_INSTALL_DIR ?= ../../mfem
16 SRC = $(if $(MFEM_DIR:../..=),$(MFEM_DIR)/examples/caliper,)
17 CONFIG_MK = $(or $(wildcard $(MFEM_BUILD_DIR)/config/config.mk),\
18 $(wildcard $(MFEM_INSTALL_DIR)/share/mfem/config.mk))
19
20 MFEM_LIB_FILE = mfem_is_not_built
21 -include $(CONFIG_MK)
22
23 SEQ_EXAMPLES = ex1
24 PAR_EXAMPLES = ex1p
25
26 ifeq ($(MFEM_USE_MPI),NO)
27 EXAMPLES = $(SEQ_EXAMPLES)
28 else
29 EXAMPLES = $(PAR_EXAMPLES) $(SEQ_EXAMPLES)
30 endif
31
32 .SUFFIXES:
33 .SUFFIXES: .o .cpp .mk
34 .PHONY: all clean clean-build clean-exec
35
36 # Remove built-in rule
37 %: %.cpp
38
39 # Replace the default implicit rule for *.cpp files
40 %: $(SRC)%.cpp $(MFEM_LIB_FILE) $(CONFIG_MK)
41 $(MFEM_CXX) $(MFEM_FLAGS) $< -o $@ $(MFEM_LIBS)
42
43 all: $(EXAMPLES)
44
45 MFEM_TESTS = EXAMPLES
46 include $(MFEM_TEST_MK)
47
48 # Testing: Parallel vs. serial runs
49 RUN_MPI = $(MFEM_MPIEXEC) $(MFEM_MPIEXEC_NP) $(MFEM_MPI_NP)
50 %-test-par: %
51 @$(call mfem-test,$<, $(RUN_MPI), Parallel example)
52 %-test-seq: %
53 @$(call mfem-test,$<,, Serial example)
54
55 # Testing: Specific execution options
56 ex1-test-seq: ex1
57 @$(call mfem-test,$<,, Caliper serial example)
58 ex1p-test-par: ex1p
59 @$(call mfem-test,$<, $(RUN_MPI), Caliper parallel example)
60
61 # Testing: "test" target and mfem-test* variables are defined in config/test.mk
62
63 # Generate an error message if the MFEM library is not built and exit
64 $(MFEM_LIB_FILE):
65 $(error The MFEM library is not built)
66
67 clean: clean-build clean-exec $(SUBDIRS_CLEAN)
68
69 clean-build:
70 rm -f *.o *~ $(SEQ_EXAMPLES) $(PAR_EXAMPLES)
71 rm -rf *.dSYM *.TVD.*breakpoints
72
73 clean-exec:
74 @rm -f refined.mesh displaced.mesh mesh.* ex5.mesh
75 @rm -f sphere_refined.* sol.* sol_u.* sol_p.* sol_r.* sol_i.*