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