xref: /libCEED/Makefile (revision fae1cbbd2de398a0010546c0861aa45d4430e492) !
10c784865Scamierjs# Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
20c784865Scamierjs# Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
30c784865Scamierjs# All Rights reserved. See files LICENSE and NOTICE for details.
40d9661cdSTzanio#
50d9661cdSTzanio# This file is part of CEED, a collection of benchmarks, miniapps, software
60d9661cdSTzanio# libraries and APIs for efficient high-order finite element and spectral
70d9661cdSTzanio# element discretizations for exascale applications. For more information and
80d9661cdSTzanio# source code availability see http://github.com/ceed.
90d9661cdSTzanio#
100d9661cdSTzanio# The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
110d9661cdSTzanio# a collaborative effort of two U.S. Department of Energy organizations (Office
120d9661cdSTzanio# of Science and the National Nuclear Security Administration) responsible for
130d9661cdSTzanio# the planning and preparation of a capable exascale ecosystem, including
140d9661cdSTzanio# software, applications, hardware, advanced system engineering and early
150d9661cdSTzanio# testbed platforms, in support of the nation's exascale computing imperative.
160d9661cdSTzanio
171571c99dSValeria Barra-include config.mk
181571c99dSValeria Barra
19dc753d40SJed Brownifeq (,$(filter-out undefined default,$(origin CC)))
206ed738d9SJed Brown  CC = gcc
21dc753d40SJed Brownendif
22241a4b83SYohannifeq (,$(filter-out undefined default,$(origin CXX)))
23241a4b83SYohann  CXX = g++
24241a4b83SYohannendif
25dc753d40SJed Brownifeq (,$(filter-out undefined default,$(origin FC)))
2681c9eb91SStan Tomov  FC = gfortran
27dc753d40SJed Brownendif
28241a4b83SYohannifeq (,$(filter-out undefined default,$(origin LINK)))
29241a4b83SYohann  LINK = $(CC)
30241a4b83SYohannendif
31196a75e4SJed BrownNVCC ?= $(CUDA_DIR)/bin/nvcc
323c83ce1dSJed BrownNVCC_CXX ?= $(CXX)
33e86995feScamierjs
343b56482dScamierjs# ASAN must be left empty if you don't want to use it
350a7eccc5ScamierjsASAN ?=
366850bcb5Scamierjs
37e86995feScamierjsLDFLAGS ?=
3832d74c32SThilina RathnayakeUNDERSCORE ?= 1
391b58aefaScamierjs
40f9fa8c39Sjeremylt# MFEM_DIR env variable should point to sibling directory
41bf3e26f6SVeselin Dobrevifneq ($(wildcard ../mfem/libmfem.*),)
429ba53df8Sjeremylt  MFEM_DIR ?= ../mfem
43f9fa8c39Sjeremyltendif
44f9fa8c39Sjeremylt
454d1cd9fcSJeremy L Thompson# NEK5K_DIR env variable should point to sibling directory
464d1cd9fcSJeremy L Thompsonifneq ($(wildcard ../Nek5000/*),)
4786a4271fSThilina Rathnayake  NEK5K_DIR ?= $(abspath ../Nek5000)
484d1cd9fcSJeremy L Thompsonendif
4986a4271fSThilina Rathnayakeexport NEK5K_DIR
5086a4271fSThilina RathnayakeMPI ?= 1
5186a4271fSThilina Rathnayake
5286a4271fSThilina Rathnayake# CEED_DIR env for NEK5K testing
5386a4271fSThilina Rathnayakeexport CEED_DIR = $(abspath .)
544d1cd9fcSJeremy L Thompson
558d713cf6Sjeremylt# XSMM_DIR env variable should point to XSMM master (github.com/hfp/libxsmm)
568d713cf6SjeremyltXSMM_DIR ?= ../libxsmm
578d713cf6Sjeremylt
5812123fd5Scamierjs# OCCA_DIR env variable should point to OCCA master (github.com/libocca/occa)
597f5ff99bSVeselin DobrevOCCA_DIR ?= ../occa
60f797d7b2Scamierjs
615a9ca9adSVeselin Dobrev# env variable MAGMA_DIR can be used too
625a9ca9adSVeselin DobrevMAGMA_DIR ?= ../magma
635a9ca9adSVeselin Dobrev# If CUDA_DIR is not set, check for nvcc, or resort to /usr/local/cuda
645a9ca9adSVeselin DobrevCUDA_DIR  ?= $(or $(patsubst %/,%,$(dir $(patsubst %/,%,$(dir \
655a9ca9adSVeselin Dobrev               $(shell which nvcc 2> /dev/null))))),/usr/local/cuda)
6682b77998SStan Tomov
672f4d9adbSJeremy L Thompson# Check for PETSc in ../petsc
682f4d9adbSJeremy L Thompsonifneq ($(wildcard ../petsc/lib/libpetsc.*),)
692f4d9adbSJeremy L Thompson  PETSC_DIR ?= ../petsc
702f4d9adbSJeremy L Thompsonendif
712f4d9adbSJeremy L Thompson
72bf000209STzanio# Warning: SANTIZ options still don't run with /gpu/occa
7312123fd5Scamierjs# export LSAN_OPTIONS=suppressions=.asanignore
74c12ddcb5ScamierjsAFLAGS = -fsanitize=address #-fsanitize=undefined -fno-omit-frame-pointer
7532d74c32SThilina Rathnayake
76*fae1cbbdSjeremyltMARCH := $(shell $(CC) --version -v < /dev/null 2>&1 | grep -c ' -march=')
77*fae1cbbdSjeremyltifeq ($(MARCH),1)
78*fae1cbbdSjeremylt  MARCHFLAG := -march=native
79*fae1cbbdSjeremyltelse
80*fae1cbbdSjeremylt  MARCHFLAG := -mtune=native
81*fae1cbbdSjeremyltendif
82*fae1cbbdSjeremyltOPT    = -O -g $(MARCHFLAG) -ffp-contract=fast -fopenmp-simd
83323c739cSJed BrownCFLAGS = -std=c99 $(OPT) -Wall -Wextra -Wno-unused-parameter -fPIC -MMD -MP
845eaa1dbeSDavid MedinaCXXFLAGS = -std=c++11 $(OPT) -Wall -Wextra -Wno-unused-parameter -fPIC -MMD -MP
85d0d1c52cSVeselin DobrevNVCCFLAGS = -ccbin $(CXX) -Xcompiler "$(OPT)" -Xcompiler -fPIC
861dc2661bSVeselin Dobrev# If using the IBM XL Fortran (xlf) replace FFLAGS appropriately:
871dc2661bSVeselin Dobrevifneq ($(filter %xlf %xlf_r,$(FC)),)
882d50dd3dSjeremylt  FFLAGS = $(OPT) -ffree-form -qpreprocess -qextname -qpic -MMD -DSOURCE_DIR='"$(abspath $(<D))/"'
89323c739cSJed Brownelse # gfortran/Intel-style options
902d50dd3dSjeremylt  FFLAGS = -cpp     $(OPT) -Wall -Wextra -Wno-unused-parameter -Wno-unused-dummy-argument -fPIC -MMD -MP -DSOURCE_DIR='"$(abspath $(<D))/"'
911dc2661bSVeselin Dobrevendif
921b58aefaScamierjs
9332d74c32SThilina Rathnayakeifeq ($(UNDERSCORE), 1)
9432d74c32SThilina Rathnayake  CFLAGS += -DUNDERSCORE
9532d74c32SThilina Rathnayakeendif
9632d74c32SThilina Rathnayake
97a6f4783aSJed Brownifeq ($(COVERAGE), 1)
98a6f4783aSJed Brown  CFLAGS += --coverage
99a6f4783aSJed Brown  LDFLAGS += --coverage
100a6f4783aSJed Brownendif
101a6f4783aSJed Brown
1024dd6f121ScamierjsCFLAGS += $(if $(ASAN),$(AFLAGS))
1034dd6f121ScamierjsFFLAGS += $(if $(ASAN),$(AFLAGS))
1044dd6f121ScamierjsLDFLAGS += $(if $(ASAN),$(AFLAGS))
1056ea7c6c1SJed BrownCPPFLAGS = -I./include
106582447c9SJed BrownLDLIBS = -lm
10791b7489eSJed BrownOBJDIR := build
1086ea7c6c1SJed BrownLIBDIR := lib
1096ea7c6c1SJed Brown
110d5217624SJed Brown# Installation variables
111d5217624SJed Brownprefix ?= /usr/local
112d5217624SJed Brownbindir = $(prefix)/bin
113d5217624SJed Brownlibdir = $(prefix)/lib
114bf3e26f6SVeselin Dobrevokldir = $(libdir)/okl
115d5217624SJed Brownincludedir = $(prefix)/include
116d5217624SJed Brownpkgconfigdir = $(libdir)/pkgconfig
117d5217624SJed BrownINSTALL = install
118d5217624SJed BrownINSTALL_PROGRAM = $(INSTALL)
119d5217624SJed BrownINSTALL_DATA = $(INSTALL) -m644
120d5217624SJed Brown
1213b56482dScamierjs# Get number of processors of the machine
12269762e1fScamierjsNPROCS := $(shell getconf _NPROCESSORS_ONLN)
1233b56482dScamierjs# prepare make options to run in parallel
12482985883ScamierjsMFLAGS := -j $(NPROCS) --warn-undefined-variables \
12521ae6867Scamierjs                       --no-print-directory --no-keep-going
12687e762eaSJed Brown
1278ec9d54bSJed BrownPYTHON ?= python3
128bfa078e6SJed BrownPROVE ?= prove
1293a1ec3cdSJed BrownPROVE_OPTS ?= -j $(NPROCS)
1305c719ab0SJed BrownDARWIN := $(filter Darwin,$(shell uname -s))
1315c719ab0SJed BrownSO_EXT := $(if $(DARWIN),dylib,so)
1329df38c42SVeselin Dobrev
1336ea7c6c1SJed Brownceed.pc := $(LIBDIR)/pkgconfig/ceed.pc
13491b7489eSJed Brownlibceed := $(LIBDIR)/libceed.$(SO_EXT)
1357e68d260SJed BrownCEED_LIBS = -lceed
136d7b241e6Sjeremyltlibceed.c := $(wildcard interface/ceed*.c)
137288c0443SJeremy L Thompsongallery.c := $(wildcard gallery/*/ceed*.c)
138288c0443SJeremy L Thompsonlibceed.c += $(gallery.c)
139265be9c8Sjeremyltlibceed_test := $(LIBDIR)/libceed_test.$(SO_EXT)
14076af460cSJed Brownlibceeds = $(libceed) $(libceed_test)
141265be9c8SjeremyltBACKENDS_BUILTIN := /cpu/self/ref/serial /cpu/self/ref/blocked /cpu/self/opt/serial /cpu/self/opt/blocked
142d20f937dSJed BrownBACKENDS := $(BACKENDS_BUILTIN)
143bf000209STzanio
144bf000209STzanio# Tests
14557c64913Sjeremylttests.c   := $(sort $(wildcard tests/t[0-9][0-9][0-9]-*.c))
1468980d4a7Sjeremylttests.f   := $(sort $(wildcard tests/t[0-9][0-9][0-9]-*.f90))
14791b7489eSJed Browntests     := $(tests.c:tests/%.c=$(OBJDIR)/%)
1483f3e7340Scamierjsctests    := $(tests)
1498980d4a7Sjeremylttests     += $(tests.f:tests/%.f90=$(OBJDIR)/%)
15086a4271fSThilina Rathnayake# Examples
151182fbe45STzanioexamples.c := $(sort $(wildcard examples/ceed/*.c))
152182fbe45STzanioexamples.f := $(sort $(wildcard examples/ceed/*.f))
153182fbe45STzanioexamples  := $(examples.c:examples/ceed/%.c=$(OBJDIR)/%)
154182fbe45STzanioexamples  += $(examples.f:examples/ceed/%.f=$(OBJDIR)/%)
15586a4271fSThilina Rathnayake# MFEM Examples
1562158b1b0Sjeremyltmfemexamples.cpp := $(sort $(wildcard examples/mfem/*.cpp))
15716c6c054SJed Brownmfemexamples  := $(mfemexamples.cpp:examples/mfem/%.cpp=$(OBJDIR)/mfem-%)
15886a4271fSThilina Rathnayake# Nek5K Examples
15986a4271fSThilina Rathnayakenekexamples  := $(OBJDIR)/nek-bps
16086a4271fSThilina Rathnayake# PETSc Examples
1616f87d196Sjeremyltpetscexamples.c := $(wildcard examples/petsc/*.c)
162e797ab98SJed Brownpetscexamples   := $(petscexamples.c:examples/petsc/%.c=$(OBJDIR)/petsc-%)
16386a4271fSThilina Rathnayake# Navier-Stokes Example
1642774d5cbSJeremy L Thompsonnavierstokesexample.c := $(sort $(wildcard examples/navier-stokes/*.c))
1652774d5cbSJeremy L Thompsonnavierstokesexample  := $(navierstokesexample.c:examples/navier-stokes/%.c=$(OBJDIR)/navier-stokes-%)
166e797ab98SJed Brown
16786a4271fSThilina Rathnayake# Backends/[ref, blocked, template, memcheck, opt, avx, occa, magma]
168ae3cba82Scamierjsref.c          := $(sort $(wildcard backends/ref/*.c))
16989c6efa4Sjeremyltblocked.c      := $(sort $(wildcard backends/blocked/*.c))
170a718229cSjeremylttemplate.c     := $(sort $(wildcard backends/template/*.c))
17189c6efa4Sjeremyltceedmemcheck.c := $(sort $(wildcard backends/memcheck/*.c))
17289c6efa4Sjeremyltopt.c          := $(sort $(wildcard backends/opt/*.c))
17389c6efa4Sjeremyltavx.c          := $(sort $(wildcard backends/avx/*.c))
17489c6efa4Sjeremyltxsmm.c         := $(sort $(wildcard backends/xsmm/*.c))
1759f0427d9SYohanncuda.c         := $(sort $(wildcard backends/cuda/*.c))
1764d537eeaSYohanncuda.cpp       := $(sort $(wildcard backends/cuda/*.cpp))
1779f0427d9SYohanncuda.cu        := $(sort $(wildcard backends/cuda/*.cu))
17855ae60f9SYohanncuda-reg.c     := $(sort $(wildcard backends/cuda-reg/*.c))
17955ae60f9SYohanncuda-reg.cu    := $(sort $(wildcard backends/cuda-reg/*.cu))
180c532df63SYohanncuda-shared.c  := $(sort $(wildcard backends/cuda-shared/*.c))
181c532df63SYohanncuda-shared.cu := $(sort $(wildcard backends/cuda-shared/*.cu))
182241a4b83SYohanncuda-gen.c     := $(sort $(wildcard backends/cuda-gen/*.c))
183241a4b83SYohanncuda-gen.cpp   := $(sort $(wildcard backends/cuda-gen/*.cpp))
184241a4b83SYohanncuda-gen.cu    := $(sort $(wildcard backends/cuda-gen/*.cu))
185ae3cba82Scamierjsocca.c         := $(sort $(wildcard backends/occa/*.c))
186755585ceSStan Tomovmagma_preprocessor := python backends/magma/gccm.py
1877f5b9731SStan Tomovmagma_pre_src  := $(filter-out %ceed-magma.c %_tmp.c, $(wildcard backends/magma/ceed-*.c))
188c4acb06bSStan Tomovmagma_dsrc     := $(wildcard backends/magma/magma_d*.c)
1897f5b9731SStan Tomovmagma_dsrc     += backends/magma/ceed-magma.c
190c4acb06bSStan Tomovmagma_tmp.c    := $(magma_pre_src:%.c=%_tmp.c)
191c4acb06bSStan Tomovmagma_tmp.cu   := $(magma_pre_src:%.c=%_cuda.cu)
192c4acb06bSStan Tomovmagma_allsrc.c := $(magma_dsrc) $(magma_tmp.c)
1937f5b9731SStan Tomovmagma_allsrc.cu:= $(magma_tmp.cu) backends/magma/magma_devptr.cu
1947f5b9731SStan Tomovmagma_allsrc.cu+= backends/magma/magma_dbasisApply_grad.cu backends/magma/magma_dbasisApply_interp.cu backends/magma/magma_dbasisApply_weight.cu
19582985883Scamierjs
1969bdc3d68Scamierjs# Output using the 216-color rules mode
19718a724fcScamierjsrule_file = $(notdir $(1))
19818a724fcScamierjsrule_path = $(patsubst %/,%,$(dir $(1)))
19918a724fcScamierjslast_path = $(notdir $(patsubst %/,%,$(dir $(1))))
2003c5d0cdfSJed Brownansicolor = $(shell echo $(call last_path,$(1)) | cksum | cut -b1-2 | xargs -IS expr 2 \* S + 17)
201abb87f81Scamierjsemacs_out = @printf "  %10s %s/%s\n" $(1) $(call rule_path,$(2)) $(call rule_file,$(2))
202abb87f81Scamierjscolor_out = @if [ -t 1 ]; then \
20318a724fcScamierjs				printf "  %10s \033[38;5;%d;1m%s\033[m/%s\n" \
2043c5d0cdfSJed Brown					$(1) $(call ansicolor,$(2)) \
20518a724fcScamierjs					$(call rule_path,$(2)) $(call rule_file,$(2)); else \
20618a724fcScamierjs				printf "  %10s %s\n" $(1) $(2); fi
207f797d7b2Scamierjs# if TERM=dumb, use it, otherwise switch to the term one
208abb87f81Scamierjsoutput = $(if $(TERM:dumb=),$(call color_out,$1,$2),$(call emacs_out,$1,$2))
20982985883Scamierjs
2109bdc3d68Scamierjs# if V is set to non-nil, turn the verbose mode
21118a724fcScamierjsquiet = $(if $(V),$($(1)),$(call output,$1,$@);$($(1)))
21221ae6867Scamierjs
213da72e7fcSJed Brown# Cancel built-in and old-fashioned implicit rules which we don't use
2149df38c42SVeselin Dobrev.SUFFIXES:
215da72e7fcSJed Brown
21691b7489eSJed Brown.SECONDEXPANSION: # to expand $$(@D)/.DIR
2179df38c42SVeselin Dobrev
218c4acb06bSStan Tomov.SECONDARY: $(magma_tmp.c) $(magma_tmp.cu)
21914c1ded1SStan Tomov
22091b7489eSJed Brown%/.DIR :
22191b7489eSJed Brown	@mkdir -p $(@D)
22291b7489eSJed Brown	@touch $@
22391b7489eSJed Brown
22491b7489eSJed Brown.PRECIOUS: %/.DIR
22591b7489eSJed Brown
22623072ed2SVeselin Dobrevlib: $(libceed) $(ceed.pc)
22723072ed2SVeselin Dobrev# run 'lib' target in parallel
2282f4d9adbSJeremy L Thompsonpar:;@$(MAKE) $(MFLAGS) V=$(V) lib
229d20f937dSJed Brownbackend_status = $(if $(filter $1,$(BACKENDS)), [backends: $1], [not found])
230bf3e26f6SVeselin Dobrevinfo:
231bf3e26f6SVeselin Dobrev	$(info ------------------------------------)
232bf3e26f6SVeselin Dobrev	$(info CC            = $(CC))
233241a4b83SYohann	$(info CXX           = $(CXX))
234bf3e26f6SVeselin Dobrev	$(info FC            = $(FC))
235bf3e26f6SVeselin Dobrev	$(info CPPFLAGS      = $(CPPFLAGS))
236bf3e26f6SVeselin Dobrev	$(info CFLAGS        = $(value CFLAGS))
237241a4b83SYohann	$(info CXXFLAGS      = $(value CXXFLAGS))
238bf3e26f6SVeselin Dobrev	$(info FFLAGS        = $(value FFLAGS))
239bf3e26f6SVeselin Dobrev	$(info NVCCFLAGS     = $(value NVCCFLAGS))
240bf3e26f6SVeselin Dobrev	$(info LDFLAGS       = $(value LDFLAGS))
241bf3e26f6SVeselin Dobrev	$(info LDLIBS        = $(LDLIBS))
242bf3e26f6SVeselin Dobrev	$(info OPT           = $(OPT))
243bf3e26f6SVeselin Dobrev	$(info AFLAGS        = $(AFLAGS))
244bf3e26f6SVeselin Dobrev	$(info ASAN          = $(or $(ASAN),(empty)))
245bf3e26f6SVeselin Dobrev	$(info V             = $(or $(V),(empty)) [verbose=$(if $(V),on,off)])
246bf3e26f6SVeselin Dobrev	$(info ------------------------------------)
2471ef3f58fSjeremylt	$(info MEMCHK_STATUS = $(MEMCHK_STATUS)$(call backend_status,/cpu/self/memcheck/serial /cpu/sef/memcheck/blocked))
24884a01de5SJeremy L Thompson	$(info AVX_STATUS    = $(AVX_STATUS)$(call backend_status,/cpu/self/avx/serial /cpu/self/avx/blocked))
24984a01de5SJeremy L Thompson	$(info XSMM_DIR      = $(XSMM_DIR)$(call backend_status,/cpu/self/xsmm/serial /cpu/self/xsmm/blocked))
250d20f937dSJed Brown	$(info OCCA_DIR      = $(OCCA_DIR)$(call backend_status,/cpu/occa /gpu/occa /omp/occa))
251d20f937dSJed Brown	$(info MAGMA_DIR     = $(MAGMA_DIR)$(call backend_status,/gpu/magma))
252ab9cabdeSVeselin Dobrev	$(info CUDA_DIR      = $(CUDA_DIR)$(call backend_status,$(CUDA_BACKENDS)))
253bf3e26f6SVeselin Dobrev	$(info ------------------------------------)
254bf3e26f6SVeselin Dobrev	$(info MFEM_DIR      = $(MFEM_DIR))
2554d1cd9fcSJeremy L Thompson	$(info NEK5K_DIR     = $(NEK5K_DIR))
256bf3e26f6SVeselin Dobrev	$(info PETSC_DIR     = $(PETSC_DIR))
257bf3e26f6SVeselin Dobrev	$(info ------------------------------------)
258bf3e26f6SVeselin Dobrev	$(info prefix        = $(prefix))
259bf3e26f6SVeselin Dobrev	$(info includedir    = $(value includedir))
260bf3e26f6SVeselin Dobrev	$(info libdir        = $(value libdir))
261bf3e26f6SVeselin Dobrev	$(info okldir        = $(value okldir))
262bf3e26f6SVeselin Dobrev	$(info pkgconfigdir  = $(value pkgconfigdir))
263bf3e26f6SVeselin Dobrev	$(info ------------------------------------)
264bf3e26f6SVeselin Dobrev	@true
26523072ed2SVeselin Dobrevinfo-backends:
266d20f937dSJed Brown	$(info make: 'lib' with optional backends: $(filter-out $(BACKENDS_BUILTIN),$(BACKENDS)))
2672f4d9adbSJeremy L Thompson.PHONY: lib all par info info-backends
2680e439e50SJed Brown
26924d002f4SJed Brown$(libceed) : LDFLAGS += $(if $(DARWIN), -install_name @rpath/$(notdir $(libceed)))
27076af460cSJed Brown$(libceed_test) : LDFLAGS += $(if $(DARWIN), -install_name @rpath/$(notdir $(libceed_test)))
27169762e1fScamierjs
27248fffa06Sjeremylt# Standard Backends
27387174f08SJed Brownlibceed.c += $(ref.c)
2744a2e7687Sjeremyltlibceed.c += $(blocked.c)
27589c6efa4Sjeremyltlibceed.c += $(opt.c)
27623072ed2SVeselin Dobrev
277265be9c8Sjeremylt# Testing Backends
278265be9c8Sjeremylttest_backends.c := $(template.c)
279265be9c8SjeremyltTEST_BACKENDS := /cpu/self/tmpl /cpu/self/tmpl/sub
280265be9c8Sjeremylt
281fc7cf9a0Sjeremylt# Memcheck Backend
282bdc3149dSjeremyltMEMCHK_STATUS = Disabled
283b8fb44e7SJed BrownMEMCHK := $(shell echo "\#include <valgrind/memcheck.h>" | $(CC) $(CPPFLAGS) -E - >/dev/null 2>&1 && echo 1)
284bdc3149dSjeremyltifeq ($(MEMCHK),1)
285bdc3149dSjeremylt  MEMCHK_STATUS = Enabled
286fc7cf9a0Sjeremylt  libceed.c += $(ceedmemcheck.c)
2871ef3f58fSjeremylt  BACKENDS += /cpu/self/memcheck/serial /cpu/self/memcheck/blocked
288fc7cf9a0Sjeremyltendif
289fc7cf9a0Sjeremylt
29048fffa06Sjeremylt# AVX Backed
29148fffa06SjeremyltAVX_STATUS = Disabled
29277538c7aSJed BrownAVX := $(shell $(CC) $(OPT) -v -E - < /dev/null 2>&1 | grep -c ' -mavx')
29348fffa06Sjeremyltifeq ($(AVX),1)
29448fffa06Sjeremylt  AVX_STATUS = Enabled
29548fffa06Sjeremylt  libceed.c += $(avx.c)
29684a01de5SJeremy L Thompson  BACKENDS += /cpu/self/avx/serial /cpu/self/avx/blocked
29748fffa06Sjeremyltendif
29848fffa06Sjeremylt
2998d713cf6Sjeremylt# libXSMM Backends
3008d713cf6Sjeremyltifneq ($(wildcard $(XSMM_DIR)/lib/libxsmm.*),)
30176af460cSJed Brown  $(libceeds) : LDFLAGS += -L$(XSMM_DIR)/lib -Wl,-rpath,$(abspath $(XSMM_DIR)/lib)
30276af460cSJed Brown  $(libceeds) : LDLIBS += -lxsmm -ldl
30300723591Sjeremylt  MKL ?=
30400723591Sjeremylt  ifeq (,$(MKL)$(MKLROOT))
305c0ea1048SJed Brown    BLAS_LIB = -lblas
3065462ed45Sjeremylt  else
30772e1b2f7SJeremy L Thompson    ifneq ($(MKLROOT),)
3087b49ae6cSjeremylt      MKL_LINK = -L$(MKLROOT)/lib/intel64 -Wl,-rpath,$(MKLROOT)/lib/intel64
30972e1b2f7SJeremy L Thompson    endif
3107b49ae6cSjeremylt    BLAS_LIB = $(MKL_LINK) -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl
3115462ed45Sjeremylt  endif
312c0ea1048SJed Brown  $(libceeds) : LDLIBS += $(BLAS_LIB)
3138d713cf6Sjeremylt  libceed.c += $(xsmm.c)
314683faae0SJed Brown  $(xsmm.c:%.c=$(OBJDIR)/%.o) $(xsmm.c:%=%.tidy) : CPPFLAGS += -I$(XSMM_DIR)/include
3158d713cf6Sjeremylt  BACKENDS += /cpu/self/xsmm/serial /cpu/self/xsmm/blocked
3168d713cf6Sjeremyltendif
3178d713cf6Sjeremylt
31848fffa06Sjeremylt# OCCA Backends
3197f5ff99bSVeselin Dobrevifneq ($(wildcard $(OCCA_DIR)/lib/libocca.*),)
32076af460cSJed Brown  $(libceeds) : LDFLAGS += -L$(OCCA_DIR)/lib -Wl,-rpath,$(abspath $(OCCA_DIR)/lib)
32176af460cSJed Brown  $(libceeds) : LDLIBS += -locca
32287174f08SJed Brown  libceed.c += $(occa.c)
323683faae0SJed Brown  $(occa.c:%.c=$(OBJDIR)/%.o) $(occa.c:%=%.tidy) : CPPFLAGS += -I$(OCCA_DIR)/include
324a953af89SJed Brown  BACKENDS += /cpu/occa /gpu/occa /omp/occa
32521ae6867Scamierjsendif
32623072ed2SVeselin Dobrev
32786a4271fSThilina Rathnayake# CUDA Backends
3285a9ca9adSVeselin DobrevCUDA_LIB_DIR := $(wildcard $(foreach d,lib lib64,$(CUDA_DIR)/$d/libcudart.${SO_EXT}))
3295a9ca9adSVeselin DobrevCUDA_LIB_DIR := $(patsubst %/,%,$(dir $(firstword $(CUDA_LIB_DIR))))
3303dd0010eSvaleriabarraCUDA_LIB_DIR_STUBS := $(CUDA_LIB_DIR)/stubs
331241a4b83SYohannCUDA_BACKENDS = /gpu/cuda/ref /gpu/cuda/reg /gpu/cuda/shared /gpu/cuda/gen
3325a9ca9adSVeselin Dobrevifneq ($(CUDA_LIB_DIR),)
333241a4b83SYohann  $(libceeds) : CFLAGS += -I$(CUDA_DIR)/include
3349d77422eSJed Brown  $(libceeds) : CPPFLAGS += -I$(CUDA_DIR)/include
33576af460cSJed Brown  $(libceeds) : LDFLAGS += -L$(CUDA_LIB_DIR) -Wl,-rpath,$(abspath $(CUDA_LIB_DIR))
33676af460cSJed Brown  $(libceeds) : LDLIBS += -lcudart -lnvrtc -lcuda
337241a4b83SYohann  $(libceeds) : LINK = $(CXX)
338241a4b83SYohann  libceed.c   += $(cuda.c) $(cuda-reg.c) $(cuda-shared.c) $(cuda-gen.c)
3394d537eeaSYohann  libceed.cpp += $(cuda.cpp) $(cuda-gen.cpp)
340241a4b83SYohann  libceed.cu  += $(cuda.cu) $(cuda-reg.cu) $(cuda-shared.cu) $(cuda-gen.cu)
341ab9cabdeSVeselin Dobrev  BACKENDS += $(CUDA_BACKENDS)
3429f0427d9SYohannendif
3439f0427d9SYohann
3449f0427d9SYohann# MAGMA Backend
3459f0427d9SYohannifneq ($(wildcard $(MAGMA_DIR)/lib/libmagma.*),)
3469f0427d9SYohann  ifneq ($(CUDA_LIB_DIR),)
3471dc2661bSVeselin Dobrev  cuda_link = -Wl,-rpath,$(CUDA_LIB_DIR) -L$(CUDA_LIB_DIR) -lcublas -lcusparse -lcudart
3481dc2661bSVeselin Dobrev  omp_link = -fopenmp
3491dc2661bSVeselin Dobrev  magma_link_static = -L$(MAGMA_DIR)/lib -lmagma $(cuda_link) $(omp_link)
3507692a9b0SVeselin Dobrev  magma_link_shared = -L$(MAGMA_DIR)/lib -Wl,-rpath,$(abspath $(MAGMA_DIR)/lib) -lmagma
3517692a9b0SVeselin Dobrev  magma_link := $(if $(wildcard $(MAGMA_DIR)/lib/libmagma.${SO_EXT}),$(magma_link_shared),$(magma_link_static))
35276af460cSJed Brown  $(libceeds)           : LDLIBS += $(magma_link)
3537692a9b0SVeselin Dobrev  $(tests) $(examples) : LDLIBS += $(magma_link)
354c4acb06bSStan Tomov  libceed.c  += $(magma_allsrc.c)
355c4acb06bSStan Tomov  libceed.cu += $(magma_allsrc.cu)
356683faae0SJed Brown  $(magma_allsrc.c:%.c=$(OBJDIR)/%.o) $(magma_allsrc.c:%=%.tidy) : CPPFLAGS += -DADD_ -I$(MAGMA_DIR)/include -I$(CUDA_DIR)/include
357c4acb06bSStan Tomov  $(magma_allsrc.cu:%.cu=$(OBJDIR)/%.o) : NVCCFLAGS += --compiler-options=-fPIC -DADD_ -I$(MAGMA_DIR)/include -I$(MAGMA_DIR)/magmablas -I$(MAGMA_DIR)/control -I$(CUDA_DIR)/include
358ce41f623SJed Brown  BACKENDS += /gpu/magma
35982b77998SStan Tomov  endif
3605a9ca9adSVeselin Dobrevendif
361755585ceSStan Tomov
362ce41f623SJed Brownexport BACKENDS
363ce41f623SJed Brown
36486a4271fSThilina Rathnayake# Generate magma_tmp.c and magma_cuda.cu from magma.c
36529715310SJed Brown%_tmp.c %_cuda.cu : %.c
366755585ceSStan Tomov	$(magma_preprocessor) $<
367755585ceSStan Tomov
368241a4b83SYohannlibceed.o = $(libceed.c:%.c=$(OBJDIR)/%.o) $(libceed.cpp:%.cpp=$(OBJDIR)/%.o) $(libceed.cu:%.cu=$(OBJDIR)/%.o)
36923072ed2SVeselin Dobrev$(libceed.o): | info-backends
37023072ed2SVeselin Dobrev$(libceed) : $(libceed.o) | $$(@D)/.DIR
371241a4b83SYohann	$(call quiet,LINK) $(LDFLAGS) -shared -o $@ $^ $(LDLIBS)
37291b7489eSJed Brown
37358e8d3b7SJed Brown$(OBJDIR)/%.o : $(CURDIR)/%.c | $$(@D)/.DIR
374b5b03409SJed Brown	$(call quiet,CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(abspath $<)
375ae3cba82Scamierjs
376241a4b83SYohann$(OBJDIR)/%.o : $(CURDIR)/%.cpp | $$(@D)/.DIR
377241a4b83SYohann	$(call quiet,CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(abspath $<)
378241a4b83SYohann
37958e8d3b7SJed Brown$(OBJDIR)/%.o : $(CURDIR)/%.cu | $$(@D)/.DIR
380755585ceSStan Tomov	$(call quiet,NVCC) $(CPPFLAGS) $(NVCCFLAGS) -c -o $@ $(abspath $<)
381755585ceSStan Tomov
382b5b03409SJed Brown$(OBJDIR)/% : tests/%.c | $$(@D)/.DIR
383265be9c8Sjeremylt	$(call quiet,LINK.c) -o $@ $(abspath $<) $(CEED_LIBS) $(LDLIBS)
38478b5556aScamierjs
3858980d4a7Sjeremylt$(OBJDIR)/% : tests/%.f90 | $$(@D)/.DIR
386265be9c8Sjeremylt	$(call quiet,LINK.F) -o $@ $(abspath $<) $(CEED_LIBS) $(LDLIBS)
38732d74c32SThilina Rathnayake
388182fbe45STzanio$(OBJDIR)/% : examples/ceed/%.c | $$(@D)/.DIR
389265be9c8Sjeremylt	$(call quiet,LINK.c) -o $@ $(abspath $<) $(CEED_LIBS) $(LDLIBS)
39091b7489eSJed Brown
391182fbe45STzanio$(OBJDIR)/% : examples/ceed/%.f | $$(@D)/.DIR
392265be9c8Sjeremylt	$(call quiet,LINK.F) -o $@ $(abspath $<) $(CEED_LIBS) $(LDLIBS)
393673d494eSThilina Rathnayake
39416c6c054SJed Brown$(OBJDIR)/mfem-% : examples/mfem/%.cpp $(libceed) | $$(@D)/.DIR
395c4216f28SJed Brown	+$(MAKE) -C examples/mfem CEED_DIR=`pwd` \
3962f4d9adbSJeremy L Thompson	  MFEM_DIR="$(abspath $(MFEM_DIR))" $*
39716c6c054SJed Brown	mv examples/mfem/$* $@
39816c6c054SJed Brown
39986a4271fSThilina Rathnayake# Note: Multiple Nek files cannot be built in parallel. The '+' here enables
40086a4271fSThilina Rathnayake#       this single Nek bps file to be built in parallel with other examples,
40186a4271fSThilina Rathnayake#       such as when calling `make prove-all -j2`.
40286a4271fSThilina Rathnayake$(OBJDIR)/nek-bps : examples/nek/bps/bps.usr examples/nek/nek-examples.sh $(libceed) | $$(@D)/.DIR
40386a4271fSThilina Rathnayake	+$(MAKE) -C examples MPI=$(MPI) CEED_DIR=`pwd` NEK5K_DIR="$(abspath $(NEK5K_DIR))" nek
40486a4271fSThilina Rathnayake	mv examples/nek/build/bps $(OBJDIR)/bps
40586a4271fSThilina Rathnayake	cp examples/nek/nek-examples.sh $(OBJDIR)/nek-bps
40686a4271fSThilina Rathnayake
4077f6cf205SJed Brown$(OBJDIR)/petsc-% : examples/petsc/%.c $(libceed) $(ceed.pc) | $$(@D)/.DIR
408c4216f28SJed Brown	+$(MAKE) -C examples/petsc CEED_DIR=`pwd` \
4092f4d9adbSJeremy L Thompson	  PETSC_DIR="$(abspath $(PETSC_DIR))" $*
410e797ab98SJed Brown	mv examples/petsc/$* $@
411e797ab98SJed Brown
4122774d5cbSJeremy L Thompson$(OBJDIR)/navier-stokes-% : examples/navier-stokes/%.c $(libceed) $(ceed.pc) | $$(@D)/.DIR
413c4216f28SJed Brown	+$(MAKE) -C examples/navier-stokes CEED_DIR=`pwd` \
4142774d5cbSJeremy L Thompson	  PETSC_DIR="$(abspath $(PETSC_DIR))" $*
4152774d5cbSJeremy L Thompson	mv examples/navier-stokes/$* $@
4162774d5cbSJeremy L Thompson
417567e4d0aSJed Brownlibceed_test.o = $(test_backends.c:%.c=$(OBJDIR)/%.o)
41876af460cSJed Brown$(libceed_test) : $(libceed.o) $(libceed_test.o) | $$(@D)/.DIR
419241a4b83SYohann	$(call quiet,LINK) $(LDFLAGS) -shared -o $@ $^ $(LDLIBS)
420265be9c8Sjeremylt
421265be9c8Sjeremylt$(examples) : $(libceed)
42276af460cSJed Brown$(tests) : $(libceed_test)
42376af460cSJed Brown$(tests) : CEED_LIBS = -lceed_test
424fc377ca6SJed Brown$(tests) $(examples) : LDFLAGS += -Wl,-rpath,$(abspath $(LIBDIR)) -L$(LIBDIR)
4254859b599SJed Brown
426686de4acSJed Brownrun-t% : BACKENDS += $(TEST_BACKENDS)
427dad465e7SJed Brownrun-% : $(OBJDIR)/%
428d1f7f8d3SJed Brown	@tests/tap.sh $(<:$(OBJDIR)/%=%)
429686de4acSJed Brown
430686de4acSJed Brownexternal_examples := \
431686de4acSJed Brown	$(if $(MFEM_DIR),$(mfemexamples)) \
432686de4acSJed Brown	$(if $(PETSC_DIR),$(petscexamples)) \
433686de4acSJed Brown	$(if $(NEK5K_DIR),$(nekexamples))
434686de4acSJed Brown
435686de4acSJed Brownallexamples = $(examples) $(external_examples)
436686de4acSJed Brown
437686de4acSJed Brown# The test and prove targets can be controlled via pattern searches.  The
438686de4acSJed Brown# default is to run tests and those examples that have no external dependencies.
439686de4acSJed Brown# Examples of finer grained control:
440686de4acSJed Brown#
441686de4acSJed Brown#   make test search='petsc mfem'      # PETSc and MFEM examples
442686de4acSJed Brown#   make prove search='t3'             # t3xx series tests
443686de4acSJed Brown#   make junit search='ex petsc'       # core ex* and PETSc tests
444686de4acSJed Brownsearch ?= t ex
445686de4acSJed Brownrealsearch = $(search:%=%%)
446686de4acSJed Brownmatched = $(foreach pattern,$(realsearch),$(filter $(OBJDIR)/$(pattern),$(tests) $(allexamples)))
447686de4acSJed Brown
4482158b1b0Sjeremylt# Test core libCEED
449686de4acSJed Browntest : $(matched:$(OBJDIR)/%=run-%)
4502158b1b0Sjeremylt
45186a4271fSThilina Rathnayake# Run test target in parallel
4526850bcb5Scamierjstst : ;@$(MAKE) $(MFLAGS) V=$(V) test
4533b56482dScamierjs# CPU C tests only for backend %
4543f3e7340Scamierjsctc-% : $(ctests);@$(foreach tst,$(ctests),$(tst) /cpu/$*;)
4554859b599SJed Brown
456686de4acSJed Brownprove : BACKENDS += $(TEST_BACKENDS)
45786a4271fSThilina Rathnayakeprove : $(matched)
458a5dc8077SJed Brown	$(info Testing backends: $(BACKENDS))
459686de4acSJed Brown	$(PROVE) $(PROVE_OPTS) --exec 'tests/tap.sh' $(matched:$(OBJDIR)/%=%)
46086a4271fSThilina Rathnayake# Run prove target in parallel
4616850bcb5Scamierjsprv : ;@$(MAKE) $(MFLAGS) V=$(V) prove
462bfa078e6SJed Brown
463686de4acSJed Brownprove-all :
464686de4acSJed Brown	+$(MAKE) prove realsearch=%
465686de4acSJed Brown
466686de4acSJed Brownjunit-t% : BACKENDS += $(TEST_BACKENDS)
4678ec9d54bSJed Brownjunit-% : $(OBJDIR)/%
468bdb0bdbbSJed Brown	@printf "  %10s %s\n" TEST $(<:$(OBJDIR)/%=%); $(PYTHON) tests/junit.py $(<:$(OBJDIR)/%=%)
4698ec9d54bSJed Brown
47076174befSjeremyltjunit : $(matched:$(OBJDIR)/%=junit-%)
4718ec9d54bSJed Brown
4722f4d9adbSJeremy L Thompsonall: $(alltests)
4732f4d9adbSJeremy L Thompson
4742f4d9adbSJeremy L Thompsonexamples : $(allexamples)
47586a4271fSThilina Rathnayakeceedexamples : $(examples)
47686a4271fSThilina Rathnayakenekexamples : $(nekexamples)
47786a4271fSThilina Rathnayakemfemexamples : $(mfemexamples)
47886a4271fSThilina Rathnayakepetscexamples : $(petscexamples)
4792f4d9adbSJeremy L Thompson
4802f4d9adbSJeremy L Thompson# Benchmarks
4810c59ef15SJeremy L Thompsonallbenchmarks = petsc-bps
4824e79ff5bSVeselin Dobrevbench_targets = $(addprefix bench-,$(allbenchmarks))
4834e79ff5bSVeselin Dobrev.PHONY: $(bench_targets) benchmarks
4844e79ff5bSVeselin Dobrev$(bench_targets): bench-%: $(OBJDIR)/%
4852f4d9adbSJeremy L Thompson	cd benchmarks && ./benchmark.sh --ceed "$(BACKENDS)" -r $(*).sh
4864e79ff5bSVeselin Dobrevbenchmarks: $(bench_targets)
4872c6ea02fSJed Brown
4886ea7c6c1SJed Brown$(ceed.pc) : pkgconfig-prefix = $(abspath .)
489d5217624SJed Brown$(OBJDIR)/ceed.pc : pkgconfig-prefix = $(prefix)
490d5217624SJed Brown.INTERMEDIATE : $(OBJDIR)/ceed.pc
4916ea7c6c1SJed Brown%/ceed.pc : ceed.pc.template | $$(@D)/.DIR
4926ea7c6c1SJed Brown	@sed "s:%prefix%:$(pkgconfig-prefix):" $< > $@
4930e439e50SJed Brown
494bf3e26f6SVeselin DobrevOCCA        := $(OCCA_DIR)/bin/occa
495cc6ff0d7SJed BrownOKL_KERNELS := $(wildcard backends/occa/*.okl)
496cc6ff0d7SJed Brown
497cc6ff0d7SJed Brownokl-cache :
498cc6ff0d7SJed Brown	$(OCCA) cache ceed $(OKL_KERNELS)
499cc6ff0d7SJed Brown
500cc6ff0d7SJed Brownokl-clear:
501cc6ff0d7SJed Brown	$(OCCA) clear -y -l ceed
502a5ba6ca9Scamierjs
503d5217624SJed Browninstall : $(libceed) $(OBJDIR)/ceed.pc
504bf3e26f6SVeselin Dobrev	$(INSTALL) -d $(addprefix $(if $(DESTDIR),"$(DESTDIR)"),"$(includedir)"\
505bf3e26f6SVeselin Dobrev	  "$(libdir)" "$(pkgconfigdir)" $(if $(OCCA_ON),"$(okldir)"))
5061e25a746SJed Brown	$(INSTALL_DATA) include/ceed.h "$(DESTDIR)$(includedir)/"
507f91e0974SThilina Rathnayake	$(INSTALL_DATA) include/ceedf.h "$(DESTDIR)$(includedir)/"
5081e25a746SJed Brown	$(INSTALL_DATA) $(libceed) "$(DESTDIR)$(libdir)/"
5091e25a746SJed Brown	$(INSTALL_DATA) $(OBJDIR)/ceed.pc "$(DESTDIR)$(pkgconfigdir)/"
510bf3e26f6SVeselin Dobrev	$(if $(OCCA_ON),$(INSTALL_DATA) $(OKL_KERNELS) "$(DESTDIR)$(okldir)/")
511d5217624SJed Brown
512683faae0SJed Brown.PHONY : cln clean doc lib install all print test tst prove prv prove-all junit examples style tidy okl-cache okl-clear info info-backends
513d635b4c6Scamierjs
5146e5d1fd9Scamierjscln clean :
515df0ef7e4SVeselin Dobrev	$(RM) -r $(OBJDIR) $(LIBDIR)
51686a4271fSThilina Rathnayake	$(MAKE) -C examples clean NEK5K_DIR="$(abspath $(NEK5K_DIR))"
517c4acb06bSStan Tomov	$(RM) $(magma_tmp.c) $(magma_tmp.cu) backends/magma/*~ backends/magma/*.o
518196a75e4SJed Brown	$(RM) benchmarks/*output.txt
5194859b599SJed Brown
52007838a1cSTzaniodistclean : clean
521196a75e4SJed Brown	$(RM) -r doc/html config.mk
52207838a1cSTzanio
5230ab95609SJed Browndoc :
5247bd3a522STzanio	doxygen Doxyfile
5257bd3a522STzanio
526f2fa494dScamierjsstyle :
52720b73d85SJed Brown	@astyle --options=.astylerc \
528cb0b5415Sjeremylt          $(filter-out include/ceedf.h tests/t320-basis-f.h, \
52920b73d85SJed Brown            $(wildcard include/*.h interface/*.[ch] tests/*.[ch] backends/*/*.[ch] \
530288c0443SJeremy L Thompson              examples/*/*.[ch] examples/*/*.[ch]pp gallery/*/*.[ch]))
5310dbfdfc5SJed Brown
532683faae0SJed BrownCLANG_TIDY ?= clang-tidy
533683faae0SJed Brown%.c.tidy : %.c
5343f57957cSjeremylt	$(CLANG_TIDY) $^ -- $(CPPFLAGS) --std=c99
535683faae0SJed Brown
536683faae0SJed Browntidy : $(libceed.c:%=%.tidy)
537683faae0SJed Brown
5384859b599SJed Brownprint :
5394859b599SJed Brown	@echo $(VAR)=$($(VAR))
540582447c9SJed Brown
5419df38c42SVeselin Dobrevprint-% :
5429df38c42SVeselin Dobrev	$(info [ variable name]: $*)
5439df38c42SVeselin Dobrev	$(info [        origin]: $(origin $*))
5449df38c42SVeselin Dobrev	$(info [         value]: $(value $*))
5459df38c42SVeselin Dobrev	$(info [expanded value]: $($*))
5469df38c42SVeselin Dobrev	$(info )
5479df38c42SVeselin Dobrev	@true
5489df38c42SVeselin Dobrev
549d3c6b40fSJed Brown# "make configure" will autodetect any variables not passed on the
550d3c6b40fSJed Brown# command line, caching the result in config.mk to be used on any
551d3c6b40fSJed Brown# subsequent invocations of make.  For example,
552d3c6b40fSJed Brown#
553d3c6b40fSJed Brown#   make configure CC=/path/to/my/cc CUDA_DIR=/opt/cuda
554d3c6b40fSJed Brown#   make
555d3c6b40fSJed Brown#   make prove
556d3c6b40fSJed Brownconfigure :
55757213447SValeria Barra	@: > config.mk
55857213447SValeria Barra	@echo "CC = $(CC)" | tee -a config.mk
5593c83ce1dSJed Brown	@echo "CXX = $(CXX)" | tee -a config.mk
56057213447SValeria Barra	@echo "FC = $(FC)" | tee -a config.mk
56157213447SValeria Barra	@echo "NVCC = $(NVCC)" | tee -a config.mk
5623c83ce1dSJed Brown	@echo "NVCC_CXX = $(NVCC_CXX)" | tee -a config.mk
563d3c6b40fSJed Brown	@echo "CFLAGS = $(CFLAGS)" | tee -a config.mk
564d3c6b40fSJed Brown	@echo "CPPFLAGS = $(CPPFLAGS)" | tee -a config.mk
565d3c6b40fSJed Brown	@echo "FFLAGS = $(FFLAGS)" | tee -a config.mk
5663c83ce1dSJed Brown	@echo "NVCCFLAGS = $(NVCCFLAGS)" | tee -a config.mk
567d3c6b40fSJed Brown	@echo "LDFLAGS = $(LDFLAGS)" | tee -a config.mk
568d3c6b40fSJed Brown	@echo "LDLIBS = $(LDLIBS)" | tee -a config.mk
569d3c6b40fSJed Brown	@echo "MAGMA_DIR = $(MAGMA_DIR)" | tee -a config.mk
570d3c6b40fSJed Brown	@echo "XSMM_DIR = $(XSMM_DIR)" | tee -a config.mk
571d3c6b40fSJed Brown	@echo "CUDA_DIR = $(CUDA_DIR)" | tee -a config.mk
572d3c6b40fSJed Brown	@echo "MFEM_DIR = $(MFEM_DIR)" | tee -a config.mk
573d3c6b40fSJed Brown	@echo "PETSC_DIR = $(PETSC_DIR)" | tee -a config.mk
574d3c6b40fSJed Brown	@echo "NEK5K_DIR = $(NEK5K_DIR)" | tee -a config.mk
575d3c6b40fSJed Brown	@echo "Configuration cached in config.mk"
576d3c6b40fSJed Brown
577d3c6b40fSJed Brown.PHONY : configure
578d3c6b40fSJed Brown
579d1f7f8d3SJed Brown-include $(libceed.c:%.c=$(OBJDIR)/%.d) $(tests.c:tests/%.c=$(OBJDIR)/%.d)
580