Debian Codegraph @

miniapps/multidomain/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/multidomain/,)
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 MULTIDOMAIN_SRC = multidomain.cpp
24 MULTIDOMAIN_OBJ = $(MULTIDOMAIN_SRC:.cpp=.o)
25
26 SEQ_MINIAPPS =
27 PAR_MINIAPPS = multidomain multidomain_nd multidomain_rt
28 ifeq ($(MFEM_USE_MPI),NO)
29 MINIAPPS = $(SEQ_MINIAPPS)
30 else
31 MINIAPPS = $(PAR_MINIAPPS) $(SEQ_MINIAPPS)
32 endif
33
34 .SUFFIXES:
35 .SUFFIXES: .o .cpp .mk
36 .PHONY: all clean clean-build clean-exec
37
38 # Remove built-in rules
39 %: %.cpp
40 %.o: %.cpp
41
42 %: %.o
43 $(MFEM_CXX) $(MFEM_LINK_FLAGS) $^ -o $@ $(MFEM_LIBS)
44
45 %.o: $(SRC)%.cpp $(MFEM_LIB_FILE) $(CONFIG_MK)
46 $(MFEM_CXX) $(MFEM_FLAGS) -c $< -o $@
47
48 all: $(MINIAPPS)
49
50 # Rules to copy the *.mesh files - needed for running the sample runs when
51 # building out-of-source:
52 ifneq ($(SRC),)
53 MESH_FILES = $(notdir $(wildcard $(SRC)*.mesh))
54 $(MESH_FILES): %: $(SRC)%
55 ln -sf $(<) .
56 multidomain: | $(MESH_FILES)
57 # The target 'copy-data' is used by the makefile in ../../tests/unit
58 .PHONY: copy-data
59 copy-data: | $(MESH_FILES)
60 endif
61
62 MFEM_TESTS = MINIAPPS
63 include $(MFEM_TEST_MK)
64
65 RUN_MPI = $(MFEM_MPIEXEC) $(MFEM_MPIEXEC_NP) $(MFEM_MPI_NP)
66 multidomain-test-par: multidomain
67 @$(call mfem-test,$<, $(RUN_MPI), Multidomain miniapp,-tf 0.001)
68 multidomain_nd-test-par: multidomain_nd
69 @$(call mfem-test,$<, $(RUN_MPI), Multidomain ND miniapp,-tf 0.001)
70 multidomain_rt-test-par: multidomain_rt
71 @$(call mfem-test,$<, $(RUN_MPI), Multidomain RT iniapp,-tf 0.001)
72
73 # Generate an error message if the MFEM library is not built and exit
74 $(MFEM_LIB_FILE):
75 $(error The MFEM library is not built)
76
77 clean: clean-build clean-exec
78
79 clean-build:
80 rm -f *.o *~ $(MINIAPPS)
81 rm -rf *.dSYM *.TVD.*breakpoints
82
83 clean-exec:
84 @rm -rf *_output