Debian Codegraph @

miniapps/spde/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)/miniapps/spde/,)
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 SPDE_COMMON_SRC = material_metrics.cpp spde_solver.cpp transformation.cpp\
24 util.cpp visualizer.cpp
25
26 SPDE_COMMON_OBJ = $(SPDE_COMMON_SRC:.cpp=.o)
27
28 SEQ_MINIAPPS =
29 PAR_MINIAPPS = generate_random_field
30 ifeq ($(MFEM_USE_MPI),NO)
31 MINIAPPS = $(SEQ_MINIAPPS)
32 else
33 MINIAPPS = $(PAR_MINIAPPS) $(SEQ_MINIAPPS)
34 endif
35
36 .SUFFIXES:
37 .SUFFIXES: .o .cpp .mk
38 .PHONY: all clean clean-build clean-exec
39
40 # Remove built-in rules
41 %: %.cpp
42 %.o: %.cpp
43
44 %: %.o $(SPDE_COMMON_OBJ)
45 $(MFEM_CXX) $(MFEM_LINK_FLAGS) $^ -o $@ $(MFEM_LIBS)
46
47 %.o: $(SRC)%.cpp $(MFEM_LIB_FILE) $(CONFIG_MK)
48 $(MFEM_CXX) $(MFEM_FLAGS) -c $< -o $@
49
50 all: $(MINIAPPS)
51
52 MFEM_TESTS = MINIAPPS
53 include $(MFEM_TEST_MK)
54
55 # Testing: Specific execution options
56 RUN_MPI = $(MFEM_MPIEXEC) $(MFEM_MPIEXEC_NP) $(MFEM_MPI_NP)
57 generate_random_field-test-par: generate_random_field
58 @$(call mfem-test,$<,$(RUN_MPI), random field miniapp,-r 3 -rp 2 \
59 -nu 4 -l1 0.09 -l2 0.03 -l3 0.05 -s 0.01 -t 0.08 -top 1 -no-rs \
60 -m ../../data/ref-square.mesh)
61
62 # Generate an error message if the MFEM library is not built and exit
63 $(MFEM_LIB_FILE):
64 $(error The MFEM library is not built)
65
66 clean: clean-build clean-exec
67
68 clean-build:
69 rm -f *.o *~ $(SEQ_MINIAPPS) $(PAR_MINIAPPS)
70 rm -rf *.dSYM *.TVD.*breakpoints
71
72 clean-exec:
73 @rm -rf ParaView