xref: /libCEED/examples/mfem/Makefile (revision cbc56ef6065171c82aacf20cbf00c4b0b6a7a3d6)
1# Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
2# the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
3# reserved. See files LICENSE and NOTICE for details.
4#
5# This file is part of CEED, a collection of benchmarks, miniapps, software
6# libraries and APIs for efficient high-order finite element and spectral
7# element discretizations for exascale applications. For more information and
8# source code availability see http://github.com/ceed.
9#
10# The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
11# a collaborative effort of two U.S. Department of Energy organizations (Office
12# of Science and the National Nuclear Security Administration) responsible for
13# the planning and preparation of a capable exascale ecosystem, including
14# software, applications, hardware, advanced system engineering and early
15# testbed platforms, in support of the nation's exascale computing imperative.
16
17# Ceed directory
18CEED_DIR ?= ../..
19CEED_FLAGS ?= -I$(CEED_DIR)
20CEED_LIBS ?= -Wl,-rpath,$(abspath $(CEED_DIR)) -L$(CEED_DIR) -lceed
21
22# Use an MFEM build directory or an MFEM install directory
23MFEM_DIR ?= ../../../mfem
24CONFIG_MK ?= $(or $(wildcard $(MFEM_DIR)/config/config.mk),$(wildcard\
25  $(MFEM_DIR)/share/mfem/config.mk))
26
27MFEM_LIB_FILE = mfem_is_not_built
28-include $(CONFIG_MK)
29
30MFEM_EXAMPLES = ex1
31
32.SUFFIXES:
33.SUFFIXES: .cpp
34.PHONY: all clean
35
36all: $(MFEM_EXAMPLES)
37
38# Remove built-in rules
39%: %.cpp
40
41# Rules for building the examples
42%: %.cpp $(MFEM_LIB_FILE) $(CONFIG_MK)
43	$(MFEM_CXX) $(CEED_FLAGS) $(MFEM_FLAGS) $< -o $@ $(CEED_LIBS) \
44	  $(MFEM_LIBS)
45
46# Generate an error message if the MFEM library is not built and exit
47$(MFEM_LIB_FILE):
48	$(error The MFEM library is not built)
49
50clean:
51	rm -f *~ $(MFEM_EXAMPLES)
52	rm -rf *.dSYM *.TVD.*breakpoints
53