Debian Codegraph @

miniapps/contact/makefile

raw symbols SCIP
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/contact/,)
17 CONFIG_MK = $(or $(wildcard $(MFEM_BUILD_DIR)/config/config.mk),\
18 $(wildcard $(MFEM_INSTALL_DIR)/share/mfem/config.mk))
19
20 # Include defaults.mk to get XLINKER
21 DEFAULTS_MK = $(MFEM_DIR)/config/defaults.mk
22 include $(DEFAULTS_MK)
23
24 MFEM_LIB_FILE = mfem_is_not_built
25 -include $(CONFIG_MK)
26
27
28 ifeq ($(MFEM_USE_TRIBOL)$(MFEM_USE_MPI),YESYES)
29 MINIAPPS = contact
30 CONTACT_SRC = elastoperator.cpp optcontactproblem.cpp ip.cpp solver_utils.cpp
31 else
32 MINIAPPS =
33 CONTACT_SRC =
34 .PHONY: contact
35 contact:
36 @echo "Rebuild MFEM with MFEM_USE_TRIBOL=YES and MFEM_USE_MPI=YES to build the contact miniapp."
37 endif
38
39 CONTACT_OBJ = $(CONTACT_SRC:.cpp=.o)
40
41 .SUFFIXES:
42 .SUFFIXES: .o .cpp .mk
43 .PHONY: all clean clean-build clean-exec
44
45 # Remove built-in rule
46 %: %.cpp
47 %.o: %.cpp
48
49 %: $(SRC)%.cpp $(MFEM_LIB_FILE) $(CONTACT_OBJ) $(CONFIG_MK)
50 $(MFEM_CXX) $(MFEM_FLAGS) $< -o $@ $(CONTACT_OBJ) $(MFEM_LIBS) \
51 -l$(patsubst lib%,%,$(basename $(notdir $(MFEM_LIB_FILE))))
52
53 %.o: $(SRC)%.cpp $(wildcard $(SRC)%.hpp) $(MFEM_LIB_FILE)\
54 $(CONFIG_MK) |
55 $(MFEM_CXX) $(MFEM_FLAGS) -c $< -o $@
56
57 all: $(MINIAPPS)
58
59 MFEM_TESTS = MINIAPPS
60 include $(MFEM_TEST_MK)
61
62 RUN_MPI = $(MFEM_MPIEXEC) $(MFEM_MPIEXEC_NP) $(MFEM_MPI_NP)
63 TEST_NAME := Contact miniapp
64 %-test-par: %
65 @$(call mfem-test,$<, $(RUN_MPI), $(TEST_NAME))
66 %-test-seq: %
67 @$(call mfem-test,$<,, $(TEST_NAME))
68
69 clean: clean-build clean-exec
70
71 clean-build:
72 rm -f $(CONTACT_OBJ) *~ $(MINIAPPS)
73 rm -rf *.dSYM *.TVD.*breakpoints
74
75 clean-exec:
76 @rm -rf ParaView
77
78 # Generate an error message if the MFEM library is not built and exit
79 $(MFEM_LIB_FILE):
80 $(error The MFEM library is not built)
81