Debian Codegraph @

miniapps/diag-smoothers/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
16 SRC = $(if $(MFEM_DIR:../..=),$(MFEM_DIR)/miniapps/diag-smoothers/,)
17 CONFIG_MK = $(MFEM_BUILD_DIR)/config/config.mk
18
19 MFEM_LIB_FILE = mfem_is_not_built
20
21 -include $(CONFIG_MK)
22
23 DS_COMMON_SRC = ds-common.cpp
24 DS_COMMON_OBJ = $(DS_COMMON_SRC:.cpp=.o)
25
26 PAR_MINIAPPS = abs-l1-jacobi mg-abs-l1-jacobi
27
28 MINIAPPS = $(if $(MFEM_USE_MPI:NO=),$(PAR_MINIAPPS),)
29
30 COMMON_LIB = -L$(MFEM_BUILD_DIR)/miniapps/common -lmfem-common
31 COMMON_LIB += $(if $(MFEM_SHARED:YES=),,\
32 $(MFEM_XLINKER)-rpath,$(abspath $(MFEM_BUILD_DIR)/miniapps/common))
33
34 APP_DEPS = $(DS_COMMON_OBJ) $(MFEM_LIB_FILE) $(CONFIG_MK)
35 APP_LIBS = $(COMMON_LIB) $(MFEM_LIBS)
36
37 # Phony targets
38 .PHONY: all lib-common clean clean-build clean-exec test
39
40 # Remove built-in rule
41 %: %.cpp
42 %.o: %.cpp
43
44 # Main targets
45 all: $(MINIAPPS)
46
47 # Build rules
48 %.o: $(SRC)%.cpp $(wildcard $(SRC)%.hpp) $(MFEM_LIB_FILE) $(CONFIG_MK)
49 $(MFEM_CXX) $(MFEM_FLAGS) -c $< -o $@
50
51 $(MINIAPPS): %: %.o $(APP_DEPS) | lib-common
52 $(MFEM_CXX) $(MFEM_LINK_FLAGS) $< $(DS_COMMON_OBJ) -o $@ $(APP_LIBS)
53
54 # Library and mesh targets
55 lib-common:
56 $(MAKE) -C $(MFEM_BUILD_DIR)/miniapps/common
57
58 # Test targets
59 MFEM_TESTS = MINIAPPS
60 include $(MFEM_TEST_MK)
61
62 RUN_MPI = $(MFEM_MPIEXEC) $(MFEM_MPIEXEC_NP) $(MFEM_MPI_NP)
63
64 abs-l1-jacobi-test-par: abs-l1-jacobi
65 @$(call mfem-test,$<, $(RUN_MPI), Abs-value-L1-Jqcobi miniapp, \
66 -m ../../data/ref-cube.mesh \
67 -rs 2 -rp 2 \
68 -s 1 -i 1 -a 3 \
69 -pc 1 \
70 -no-mon)
71
72 mg-abs-l1-jacobi-test-par: mg-abs-l1-jacobi
73 @$(call mfem-test,$<, $(RUN_MPI), MG Abs-value-L1-Jqcobi miniapp, \
74 -m ../../data/ref-cube.mesh \
75 -rs 2 -rp 1\
76 -ol 1 -gl 1 \
77 -s 1 -i 1 -a 3 \
78 -no-mon)
79
80 # Clean targets
81 clean: clean-build clean-exec
82 $(MAKE) -C $(MFEM_BUILD_DIR)/miniapps/common clean
83
84 clean-build:
85 rm -f *.o *~ $(MINIAPPS)
86 rm -rf *.dSYM *.TVD.*breakpoints
87
88 clean-exec:
89 @true
90
91 # Error handling
92 $(MFEM_LIB_FILE):
93 $(error The MFEM library is not built)