Debian Codegraph @

examples/superlu/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/superlu/,)
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 =
24 PAR_EXAMPLES = ex1p
25 ifeq ($(MFEM_USE_MPI),NO)
26 EXAMPLES = $(SEQ_EXAMPLES)
27 else
28 EXAMPLES = $(PAR_EXAMPLES) $(SEQ_EXAMPLES)
29 endif
30
31 .SUFFIXES:
32 .SUFFIXES: .o .cpp .mk
33 .PHONY: all clean clean-build clean-exec
34
35 # Remove built-in rule
36 %: %.cpp
37
38 # Replace the default implicit rule for *.cpp files
39 %: $(SRC)%.cpp $(MFEM_LIB_FILE) $(CONFIG_MK)
40 $(MFEM_CXX) $(MFEM_FLAGS) $< -o $@ $(MFEM_LIBS)
41
42 all: $(EXAMPLES)
43
44 ifeq ($(MFEM_USE_SUPERLU),NO)
45 $(EXAMPLES):
46 $(error MFEM is not configured with SuperLU)
47 endif
48
49 MFEM_TESTS = EXAMPLES
50 include $(MFEM_TEST_MK)
51
52 # Testing: Parallel runs
53 RUN_MPI = $(MFEM_MPIEXEC) $(MFEM_MPIEXEC_NP) $(MFEM_MPI_NP)
54 PARALLEL_NAME := Parallel SuperLU example
55 %-test-par: %
56 @$(call mfem-test,$<, $(RUN_MPI), $(PARALLEL_NAME))
57
58 # Testing: Specific execution options:
59 # Example 1: Test SuperLU on the simple Poisson problem
60 EX1_COMMON_ARGS := -m ../../data/star.mesh
61 EX1P_ARGS := $(EX1_COMMON_ARGS)
62 ex1p-test-par: ex1p
63 @$(call mfem-test,$<, $(RUN_MPI), $(PARALLEL_NAME),$(EX1P_ARGS))
64
65 # Testing: "test" target and mfem-test* variables are defined in config/test.mk
66
67 # Generate an error message if the MFEM library is not built and exit
68 $(MFEM_LIB_FILE):
69 $(error The MFEM library is not built)
70
71 clean: clean-build clean-exec
72
73 clean-build:
74 rm -f *.o *~ $(SEQ_EXAMPLES) $(PAR_EXAMPLES)
75 rm -rf *.dSYM *.TVD.*breakpoints
76
77 clean-exec:
78 @rm -f mesh.* sol.*