xref: /libCEED/Makefile (revision 7bcc1ce4d9066ff4faf7bc051ae926d5f905ea08)
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
76b9c05c73SJed BrownMARCHFLAG := $(if $(shell $(CC) -E -march=native -x c /dev/null > /dev/null 2>&1 && echo 1),-march=native,-mtune=native)
77b9c05c73SJed Brown
78fae1cbbdSjeremyltOPT    = -O -g $(MARCHFLAG) -ffp-contract=fast -fopenmp-simd
79323c739cSJed BrownCFLAGS = -std=c99 $(OPT) -Wall -Wextra -Wno-unused-parameter -fPIC -MMD -MP
805eaa1dbeSDavid MedinaCXXFLAGS = -std=c++11 $(OPT) -Wall -Wextra -Wno-unused-parameter -fPIC -MMD -MP
81d0d1c52cSVeselin DobrevNVCCFLAGS = -ccbin $(CXX) -Xcompiler "$(OPT)" -Xcompiler -fPIC
821dc2661bSVeselin Dobrev# If using the IBM XL Fortran (xlf) replace FFLAGS appropriately:
831dc2661bSVeselin Dobrevifneq ($(filter %xlf %xlf_r,$(FC)),)
844c7bddedSJed Brown  FFLAGS ?= $(OPT) -ffree-form -qpreprocess -qextname -qpic -MMD
85323c739cSJed Brownelse # gfortran/Intel-style options
864c7bddedSJed Brown  FFLAGS ?= -cpp     $(OPT) -Wall -Wextra -Wno-unused-parameter -Wno-unused-dummy-argument -fPIC -MMD -MP
8732d74c32SThilina Rathnayakeendif
8832d74c32SThilina Rathnayake
89a6f4783aSJed Brownifeq ($(COVERAGE), 1)
90a6f4783aSJed Brown  CFLAGS += --coverage
91a6f4783aSJed Brown  LDFLAGS += --coverage
92a6f4783aSJed Brownendif
93a6f4783aSJed Brown
944dd6f121ScamierjsCFLAGS += $(if $(ASAN),$(AFLAGS))
954dd6f121ScamierjsFFLAGS += $(if $(ASAN),$(AFLAGS))
964dd6f121ScamierjsLDFLAGS += $(if $(ASAN),$(AFLAGS))
9741a90898SJed BrownCPPFLAGS += -I./include
98582447c9SJed BrownLDLIBS = -lm
9991b7489eSJed BrownOBJDIR := build
1006ea7c6c1SJed BrownLIBDIR := lib
1016ea7c6c1SJed Brown
102d5217624SJed Brown# Installation variables
103d5217624SJed Brownprefix ?= /usr/local
104d5217624SJed Brownbindir = $(prefix)/bin
105d5217624SJed Brownlibdir = $(prefix)/lib
106bf3e26f6SVeselin Dobrevokldir = $(libdir)/okl
107d5217624SJed Brownincludedir = $(prefix)/include
108d5217624SJed Brownpkgconfigdir = $(libdir)/pkgconfig
109d5217624SJed BrownINSTALL = install
110d5217624SJed BrownINSTALL_PROGRAM = $(INSTALL)
111d5217624SJed BrownINSTALL_DATA = $(INSTALL) -m644
112d5217624SJed Brown
1133b56482dScamierjs# Get number of processors of the machine
11469762e1fScamierjsNPROCS := $(shell getconf _NPROCESSORS_ONLN)
1153b56482dScamierjs# prepare make options to run in parallel
11682985883ScamierjsMFLAGS := -j $(NPROCS) --warn-undefined-variables \
11721ae6867Scamierjs                       --no-print-directory --no-keep-going
11887e762eaSJed Brown
1198ec9d54bSJed BrownPYTHON ?= python3
120bfa078e6SJed BrownPROVE ?= prove
1213a1ec3cdSJed BrownPROVE_OPTS ?= -j $(NPROCS)
1225c719ab0SJed BrownDARWIN := $(filter Darwin,$(shell uname -s))
1235c719ab0SJed BrownSO_EXT := $(if $(DARWIN),dylib,so)
1249df38c42SVeselin Dobrev
1256ea7c6c1SJed Brownceed.pc := $(LIBDIR)/pkgconfig/ceed.pc
12691b7489eSJed Brownlibceed := $(LIBDIR)/libceed.$(SO_EXT)
1277e68d260SJed BrownCEED_LIBS = -lceed
128d7b241e6Sjeremyltlibceed.c := $(wildcard interface/ceed*.c)
129288c0443SJeremy L Thompsongallery.c := $(wildcard gallery/*/ceed*.c)
130288c0443SJeremy L Thompsonlibceed.c += $(gallery.c)
131265be9c8Sjeremyltlibceed_test := $(LIBDIR)/libceed_test.$(SO_EXT)
13276af460cSJed Brownlibceeds = $(libceed) $(libceed_test)
133265be9c8SjeremyltBACKENDS_BUILTIN := /cpu/self/ref/serial /cpu/self/ref/blocked /cpu/self/opt/serial /cpu/self/opt/blocked
134d20f937dSJed BrownBACKENDS := $(BACKENDS_BUILTIN)
135bf000209STzanio
136bf000209STzanio# Tests
13757c64913Sjeremylttests.c   := $(sort $(wildcard tests/t[0-9][0-9][0-9]-*.c))
1388980d4a7Sjeremylttests.f   := $(sort $(wildcard tests/t[0-9][0-9][0-9]-*.f90))
13991b7489eSJed Browntests     := $(tests.c:tests/%.c=$(OBJDIR)/%)
1403f3e7340Scamierjsctests    := $(tests)
1418980d4a7Sjeremylttests     += $(tests.f:tests/%.f90=$(OBJDIR)/%)
14286a4271fSThilina Rathnayake# Examples
143182fbe45STzanioexamples.c := $(sort $(wildcard examples/ceed/*.c))
144182fbe45STzanioexamples.f := $(sort $(wildcard examples/ceed/*.f))
145182fbe45STzanioexamples  := $(examples.c:examples/ceed/%.c=$(OBJDIR)/%)
146182fbe45STzanioexamples  += $(examples.f:examples/ceed/%.f=$(OBJDIR)/%)
14786a4271fSThilina Rathnayake# MFEM Examples
1482158b1b0Sjeremyltmfemexamples.cpp := $(sort $(wildcard examples/mfem/*.cpp))
14916c6c054SJed Brownmfemexamples  := $(mfemexamples.cpp:examples/mfem/%.cpp=$(OBJDIR)/mfem-%)
15086a4271fSThilina Rathnayake# Nek5K Examples
15186a4271fSThilina Rathnayakenekexamples  := $(OBJDIR)/nek-bps
15286a4271fSThilina Rathnayake# PETSc Examples
1536f87d196Sjeremyltpetscexamples.c := $(wildcard examples/petsc/*.c)
154e797ab98SJed Brownpetscexamples   := $(petscexamples.c:examples/petsc/%.c=$(OBJDIR)/petsc-%)
155b974e86eSJed Brown# Navier-Stokes Examples
156b974e86eSJed Brownnsexamples.c := $(sort $(wildcard examples/navier-stokes/*.c))
157b974e86eSJed Brownnsexamples  := $(nsexamples.c:examples/navier-stokes/%.c=$(OBJDIR)/ns-%)
158e797ab98SJed Brown
15986a4271fSThilina Rathnayake# Backends/[ref, blocked, template, memcheck, opt, avx, occa, magma]
160ae3cba82Scamierjsref.c          := $(sort $(wildcard backends/ref/*.c))
16189c6efa4Sjeremyltblocked.c      := $(sort $(wildcard backends/blocked/*.c))
162a718229cSjeremylttemplate.c     := $(sort $(wildcard backends/template/*.c))
16389c6efa4Sjeremyltceedmemcheck.c := $(sort $(wildcard backends/memcheck/*.c))
16489c6efa4Sjeremyltopt.c          := $(sort $(wildcard backends/opt/*.c))
16589c6efa4Sjeremyltavx.c          := $(sort $(wildcard backends/avx/*.c))
16689c6efa4Sjeremyltxsmm.c         := $(sort $(wildcard backends/xsmm/*.c))
1679f0427d9SYohanncuda.c         := $(sort $(wildcard backends/cuda/*.c))
1684d537eeaSYohanncuda.cpp       := $(sort $(wildcard backends/cuda/*.cpp))
1699f0427d9SYohanncuda.cu        := $(sort $(wildcard backends/cuda/*.cu))
17055ae60f9SYohanncuda-reg.c     := $(sort $(wildcard backends/cuda-reg/*.c))
17155ae60f9SYohanncuda-reg.cu    := $(sort $(wildcard backends/cuda-reg/*.cu))
172c532df63SYohanncuda-shared.c  := $(sort $(wildcard backends/cuda-shared/*.c))
173c532df63SYohanncuda-shared.cu := $(sort $(wildcard backends/cuda-shared/*.cu))
174241a4b83SYohanncuda-gen.c     := $(sort $(wildcard backends/cuda-gen/*.c))
175241a4b83SYohanncuda-gen.cpp   := $(sort $(wildcard backends/cuda-gen/*.cpp))
176241a4b83SYohanncuda-gen.cu    := $(sort $(wildcard backends/cuda-gen/*.cu))
177ae3cba82Scamierjsocca.c         := $(sort $(wildcard backends/occa/*.c))
178755585ceSStan Tomovmagma_preprocessor := python backends/magma/gccm.py
1797f5b9731SStan Tomovmagma_pre_src  := $(filter-out %ceed-magma.c %_tmp.c, $(wildcard backends/magma/ceed-*.c))
180c4acb06bSStan Tomovmagma_dsrc     := $(wildcard backends/magma/magma_d*.c)
1817f5b9731SStan Tomovmagma_dsrc     += backends/magma/ceed-magma.c
182c4acb06bSStan Tomovmagma_tmp.c    := $(magma_pre_src:%.c=%_tmp.c)
183c4acb06bSStan Tomovmagma_tmp.cu   := $(magma_pre_src:%.c=%_cuda.cu)
184c4acb06bSStan Tomovmagma_allsrc.c := $(magma_dsrc) $(magma_tmp.c)
1857f5b9731SStan Tomovmagma_allsrc.cu:= $(magma_tmp.cu) backends/magma/magma_devptr.cu
1867f5b9731SStan Tomovmagma_allsrc.cu+= backends/magma/magma_dbasisApply_grad.cu backends/magma/magma_dbasisApply_interp.cu backends/magma/magma_dbasisApply_weight.cu
187868539c2SNatalie Beamsmagma_allsrc.cu+= backends/magma/magma_drestrictApply.cu
18882985883Scamierjs
1899bdc3d68Scamierjs# Output using the 216-color rules mode
19018a724fcScamierjsrule_file = $(notdir $(1))
19118a724fcScamierjsrule_path = $(patsubst %/,%,$(dir $(1)))
19218a724fcScamierjslast_path = $(notdir $(patsubst %/,%,$(dir $(1))))
1933c5d0cdfSJed Brownansicolor = $(shell echo $(call last_path,$(1)) | cksum | cut -b1-2 | xargs -IS expr 2 \* S + 17)
194abb87f81Scamierjsemacs_out = @printf "  %10s %s/%s\n" $(1) $(call rule_path,$(2)) $(call rule_file,$(2))
195abb87f81Scamierjscolor_out = @if [ -t 1 ]; then \
19618a724fcScamierjs				printf "  %10s \033[38;5;%d;1m%s\033[m/%s\n" \
1973c5d0cdfSJed Brown					$(1) $(call ansicolor,$(2)) \
19818a724fcScamierjs					$(call rule_path,$(2)) $(call rule_file,$(2)); else \
19918a724fcScamierjs				printf "  %10s %s\n" $(1) $(2); fi
200f797d7b2Scamierjs# if TERM=dumb, use it, otherwise switch to the term one
201abb87f81Scamierjsoutput = $(if $(TERM:dumb=),$(call color_out,$1,$2),$(call emacs_out,$1,$2))
20282985883Scamierjs
2039bdc3d68Scamierjs# if V is set to non-nil, turn the verbose mode
20418a724fcScamierjsquiet = $(if $(V),$($(1)),$(call output,$1,$@);$($(1)))
20521ae6867Scamierjs
206da72e7fcSJed Brown# Cancel built-in and old-fashioned implicit rules which we don't use
2079df38c42SVeselin Dobrev.SUFFIXES:
208da72e7fcSJed Brown
20991b7489eSJed Brown.SECONDEXPANSION: # to expand $$(@D)/.DIR
2109df38c42SVeselin Dobrev
211c4acb06bSStan Tomov.SECONDARY: $(magma_tmp.c) $(magma_tmp.cu)
21214c1ded1SStan Tomov
21391b7489eSJed Brown%/.DIR :
21491b7489eSJed Brown	@mkdir -p $(@D)
21591b7489eSJed Brown	@touch $@
21691b7489eSJed Brown
21791b7489eSJed Brown.PRECIOUS: %/.DIR
21891b7489eSJed Brown
21923072ed2SVeselin Dobrevlib: $(libceed) $(ceed.pc)
22023072ed2SVeselin Dobrev# run 'lib' target in parallel
2212f4d9adbSJeremy L Thompsonpar:;@$(MAKE) $(MFLAGS) V=$(V) lib
222d20f937dSJed Brownbackend_status = $(if $(filter $1,$(BACKENDS)), [backends: $1], [not found])
223bf3e26f6SVeselin Dobrevinfo:
224bf3e26f6SVeselin Dobrev	$(info ------------------------------------)
225bf3e26f6SVeselin Dobrev	$(info CC            = $(CC))
226241a4b83SYohann	$(info CXX           = $(CXX))
227bf3e26f6SVeselin Dobrev	$(info FC            = $(FC))
228bf3e26f6SVeselin Dobrev	$(info CPPFLAGS      = $(CPPFLAGS))
229bf3e26f6SVeselin Dobrev	$(info CFLAGS        = $(value CFLAGS))
230241a4b83SYohann	$(info CXXFLAGS      = $(value CXXFLAGS))
231bf3e26f6SVeselin Dobrev	$(info FFLAGS        = $(value FFLAGS))
232bf3e26f6SVeselin Dobrev	$(info NVCCFLAGS     = $(value NVCCFLAGS))
233bf3e26f6SVeselin Dobrev	$(info LDFLAGS       = $(value LDFLAGS))
234bf3e26f6SVeselin Dobrev	$(info LDLIBS        = $(LDLIBS))
235bf3e26f6SVeselin Dobrev	$(info OPT           = $(OPT))
236bf3e26f6SVeselin Dobrev	$(info AFLAGS        = $(AFLAGS))
237bf3e26f6SVeselin Dobrev	$(info ASAN          = $(or $(ASAN),(empty)))
238bf3e26f6SVeselin Dobrev	$(info V             = $(or $(V),(empty)) [verbose=$(if $(V),on,off)])
239bf3e26f6SVeselin Dobrev	$(info ------------------------------------)
2401ef3f58fSjeremylt	$(info MEMCHK_STATUS = $(MEMCHK_STATUS)$(call backend_status,/cpu/self/memcheck/serial /cpu/sef/memcheck/blocked))
24184a01de5SJeremy L Thompson	$(info AVX_STATUS    = $(AVX_STATUS)$(call backend_status,/cpu/self/avx/serial /cpu/self/avx/blocked))
24284a01de5SJeremy L Thompson	$(info XSMM_DIR      = $(XSMM_DIR)$(call backend_status,/cpu/self/xsmm/serial /cpu/self/xsmm/blocked))
243d20f937dSJed Brown	$(info OCCA_DIR      = $(OCCA_DIR)$(call backend_status,/cpu/occa /gpu/occa /omp/occa))
244d20f937dSJed Brown	$(info MAGMA_DIR     = $(MAGMA_DIR)$(call backend_status,/gpu/magma))
245ab9cabdeSVeselin Dobrev	$(info CUDA_DIR      = $(CUDA_DIR)$(call backend_status,$(CUDA_BACKENDS)))
246bf3e26f6SVeselin Dobrev	$(info ------------------------------------)
247bf3e26f6SVeselin Dobrev	$(info MFEM_DIR      = $(MFEM_DIR))
2484d1cd9fcSJeremy L Thompson	$(info NEK5K_DIR     = $(NEK5K_DIR))
249bf3e26f6SVeselin Dobrev	$(info PETSC_DIR     = $(PETSC_DIR))
250bf3e26f6SVeselin Dobrev	$(info ------------------------------------)
251bf3e26f6SVeselin Dobrev	$(info prefix        = $(prefix))
252bf3e26f6SVeselin Dobrev	$(info includedir    = $(value includedir))
253bf3e26f6SVeselin Dobrev	$(info libdir        = $(value libdir))
254bf3e26f6SVeselin Dobrev	$(info okldir        = $(value okldir))
255bf3e26f6SVeselin Dobrev	$(info pkgconfigdir  = $(value pkgconfigdir))
256bf3e26f6SVeselin Dobrev	$(info ------------------------------------)
257bf3e26f6SVeselin Dobrev	@true
25823072ed2SVeselin Dobrevinfo-backends:
259d20f937dSJed Brown	$(info make: 'lib' with optional backends: $(filter-out $(BACKENDS_BUILTIN),$(BACKENDS)))
2602f4d9adbSJeremy L Thompson.PHONY: lib all par info info-backends
2610e439e50SJed Brown
26224d002f4SJed Brown$(libceed) : LDFLAGS += $(if $(DARWIN), -install_name @rpath/$(notdir $(libceed)))
26376af460cSJed Brown$(libceed_test) : LDFLAGS += $(if $(DARWIN), -install_name @rpath/$(notdir $(libceed_test)))
26469762e1fScamierjs
26548fffa06Sjeremylt# Standard Backends
26687174f08SJed Brownlibceed.c += $(ref.c)
2674a2e7687Sjeremyltlibceed.c += $(blocked.c)
26889c6efa4Sjeremyltlibceed.c += $(opt.c)
26923072ed2SVeselin Dobrev
270265be9c8Sjeremylt# Testing Backends
271265be9c8Sjeremylttest_backends.c := $(template.c)
272265be9c8SjeremyltTEST_BACKENDS := /cpu/self/tmpl /cpu/self/tmpl/sub
273265be9c8Sjeremylt
274fc7cf9a0Sjeremylt# Memcheck Backend
275bdc3149dSjeremyltMEMCHK_STATUS = Disabled
276b8fb44e7SJed BrownMEMCHK := $(shell echo "\#include <valgrind/memcheck.h>" | $(CC) $(CPPFLAGS) -E - >/dev/null 2>&1 && echo 1)
277bdc3149dSjeremyltifeq ($(MEMCHK),1)
278bdc3149dSjeremylt  MEMCHK_STATUS = Enabled
279fc7cf9a0Sjeremylt  libceed.c += $(ceedmemcheck.c)
2801ef3f58fSjeremylt  BACKENDS += /cpu/self/memcheck/serial /cpu/self/memcheck/blocked
281fc7cf9a0Sjeremyltendif
282fc7cf9a0Sjeremylt
28348fffa06Sjeremylt# AVX Backed
28448fffa06SjeremyltAVX_STATUS = Disabled
28577538c7aSJed BrownAVX := $(shell $(CC) $(OPT) -v -E - < /dev/null 2>&1 | grep -c ' -mavx')
28648fffa06Sjeremyltifeq ($(AVX),1)
28748fffa06Sjeremylt  AVX_STATUS = Enabled
28848fffa06Sjeremylt  libceed.c += $(avx.c)
28984a01de5SJeremy L Thompson  BACKENDS += /cpu/self/avx/serial /cpu/self/avx/blocked
29048fffa06Sjeremyltendif
29148fffa06Sjeremylt
2928d713cf6Sjeremylt# libXSMM Backends
2938d713cf6Sjeremyltifneq ($(wildcard $(XSMM_DIR)/lib/libxsmm.*),)
29476af460cSJed Brown  $(libceeds) : LDFLAGS += -L$(XSMM_DIR)/lib -Wl,-rpath,$(abspath $(XSMM_DIR)/lib)
29576af460cSJed Brown  $(libceeds) : LDLIBS += -lxsmm -ldl
29600723591Sjeremylt  MKL ?=
29700723591Sjeremylt  ifeq (,$(MKL)$(MKLROOT))
298c0ea1048SJed Brown    BLAS_LIB = -lblas
2995462ed45Sjeremylt  else
30072e1b2f7SJeremy L Thompson    ifneq ($(MKLROOT),)
301ff56800aSJed Brown      # Some installs put everything inside an intel64 subdirectory, others not
302ff56800aSJed Brown      MKL_LIBDIR = $(dir $(firstword $(wildcard $(MKLROOT)/lib/intel64/libmkl_sequential.* $(MKLROOT)/lib/libmkl_sequential.*)))
303ff56800aSJed Brown      MKL_LINK = -L$(MKL_LIBDIR) -Wl,-rpath,$(MKL_LIBDIR)
30472e1b2f7SJeremy L Thompson    endif
3057b49ae6cSjeremylt    BLAS_LIB = $(MKL_LINK) -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl
3065462ed45Sjeremylt  endif
307c0ea1048SJed Brown  $(libceeds) : LDLIBS += $(BLAS_LIB)
3088d713cf6Sjeremylt  libceed.c += $(xsmm.c)
309683faae0SJed Brown  $(xsmm.c:%.c=$(OBJDIR)/%.o) $(xsmm.c:%=%.tidy) : CPPFLAGS += -I$(XSMM_DIR)/include
3108d713cf6Sjeremylt  BACKENDS += /cpu/self/xsmm/serial /cpu/self/xsmm/blocked
3118d713cf6Sjeremyltendif
3128d713cf6Sjeremylt
31348fffa06Sjeremylt# OCCA Backends
3147f5ff99bSVeselin Dobrevifneq ($(wildcard $(OCCA_DIR)/lib/libocca.*),)
31576af460cSJed Brown  $(libceeds) : LDFLAGS += -L$(OCCA_DIR)/lib -Wl,-rpath,$(abspath $(OCCA_DIR)/lib)
31676af460cSJed Brown  $(libceeds) : LDLIBS += -locca
31787174f08SJed Brown  libceed.c += $(occa.c)
318683faae0SJed Brown  $(occa.c:%.c=$(OBJDIR)/%.o) $(occa.c:%=%.tidy) : CPPFLAGS += -I$(OCCA_DIR)/include
319a953af89SJed Brown  BACKENDS += /cpu/occa /gpu/occa /omp/occa
32021ae6867Scamierjsendif
32123072ed2SVeselin Dobrev
32286a4271fSThilina Rathnayake# CUDA Backends
3235a9ca9adSVeselin DobrevCUDA_LIB_DIR := $(wildcard $(foreach d,lib lib64,$(CUDA_DIR)/$d/libcudart.${SO_EXT}))
3245a9ca9adSVeselin DobrevCUDA_LIB_DIR := $(patsubst %/,%,$(dir $(firstword $(CUDA_LIB_DIR))))
3253dd0010eSvaleriabarraCUDA_LIB_DIR_STUBS := $(CUDA_LIB_DIR)/stubs
326241a4b83SYohannCUDA_BACKENDS = /gpu/cuda/ref /gpu/cuda/reg /gpu/cuda/shared /gpu/cuda/gen
3275a9ca9adSVeselin Dobrevifneq ($(CUDA_LIB_DIR),)
3289d77422eSJed Brown  $(libceeds) : CPPFLAGS += -I$(CUDA_DIR)/include
32976af460cSJed Brown  $(libceeds) : LDFLAGS += -L$(CUDA_LIB_DIR) -Wl,-rpath,$(abspath $(CUDA_LIB_DIR))
33076af460cSJed Brown  $(libceeds) : LDLIBS += -lcudart -lnvrtc -lcuda
331241a4b83SYohann  $(libceeds) : LINK = $(CXX)
332241a4b83SYohann  libceed.c   += $(cuda.c) $(cuda-reg.c) $(cuda-shared.c) $(cuda-gen.c)
3334d537eeaSYohann  libceed.cpp += $(cuda.cpp) $(cuda-gen.cpp)
334241a4b83SYohann  libceed.cu  += $(cuda.cu) $(cuda-reg.cu) $(cuda-shared.cu) $(cuda-gen.cu)
335ab9cabdeSVeselin Dobrev  BACKENDS += $(CUDA_BACKENDS)
3369f0427d9SYohannendif
3379f0427d9SYohann
3389f0427d9SYohann# MAGMA Backend
3399f0427d9SYohannifneq ($(wildcard $(MAGMA_DIR)/lib/libmagma.*),)
3409f0427d9SYohann  ifneq ($(CUDA_LIB_DIR),)
3411dc2661bSVeselin Dobrev  cuda_link = -Wl,-rpath,$(CUDA_LIB_DIR) -L$(CUDA_LIB_DIR) -lcublas -lcusparse -lcudart
3421dc2661bSVeselin Dobrev  omp_link = -fopenmp
3431dc2661bSVeselin Dobrev  magma_link_static = -L$(MAGMA_DIR)/lib -lmagma $(cuda_link) $(omp_link)
3447692a9b0SVeselin Dobrev  magma_link_shared = -L$(MAGMA_DIR)/lib -Wl,-rpath,$(abspath $(MAGMA_DIR)/lib) -lmagma
3457692a9b0SVeselin Dobrev  magma_link := $(if $(wildcard $(MAGMA_DIR)/lib/libmagma.${SO_EXT}),$(magma_link_shared),$(magma_link_static))
34676af460cSJed Brown  $(libceeds)           : LDLIBS += $(magma_link)
3477692a9b0SVeselin Dobrev  $(tests) $(examples) : LDLIBS += $(magma_link)
348c4acb06bSStan Tomov  libceed.c  += $(magma_allsrc.c)
349c4acb06bSStan Tomov  libceed.cu += $(magma_allsrc.cu)
350683faae0SJed Brown  $(magma_allsrc.c:%.c=$(OBJDIR)/%.o) $(magma_allsrc.c:%=%.tidy) : CPPFLAGS += -DADD_ -I$(MAGMA_DIR)/include -I$(CUDA_DIR)/include
3514c7bddedSJed Brown  $(magma_allsrc.cu:%.cu=$(OBJDIR)/%.o) : CPPFLAGS += --compiler-options=-fPIC -DADD_ -I$(MAGMA_DIR)/include -I$(MAGMA_DIR)/magmablas -I$(MAGMA_DIR)/control -I$(CUDA_DIR)/include
352ce41f623SJed Brown  BACKENDS += /gpu/magma
35382b77998SStan Tomov  endif
3545a9ca9adSVeselin Dobrevendif
355755585ceSStan Tomov
356ce41f623SJed Brownexport BACKENDS
357ce41f623SJed Brown
35886a4271fSThilina Rathnayake# Generate magma_tmp.c and magma_cuda.cu from magma.c
35929715310SJed Brown%_tmp.c %_cuda.cu : %.c
360755585ceSStan Tomov	$(magma_preprocessor) $<
361755585ceSStan Tomov
362241a4b83SYohannlibceed.o = $(libceed.c:%.c=$(OBJDIR)/%.o) $(libceed.cpp:%.cpp=$(OBJDIR)/%.o) $(libceed.cu:%.cu=$(OBJDIR)/%.o)
3634c7bddedSJed Brown$(filter %fortran.o,$(libceed.o)) : CPPFLAGS += $(if $(filter 1,$(UNDERSCORE)),-DUNDERSCORE)
36423072ed2SVeselin Dobrev$(libceed.o): | info-backends
36523072ed2SVeselin Dobrev$(libceed) : $(libceed.o) | $$(@D)/.DIR
366241a4b83SYohann	$(call quiet,LINK) $(LDFLAGS) -shared -o $@ $^ $(LDLIBS)
36791b7489eSJed Brown
36858e8d3b7SJed Brown$(OBJDIR)/%.o : $(CURDIR)/%.c | $$(@D)/.DIR
369b5b03409SJed Brown	$(call quiet,CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(abspath $<)
370ae3cba82Scamierjs
371241a4b83SYohann$(OBJDIR)/%.o : $(CURDIR)/%.cpp | $$(@D)/.DIR
372241a4b83SYohann	$(call quiet,CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(abspath $<)
373241a4b83SYohann
37458e8d3b7SJed Brown$(OBJDIR)/%.o : $(CURDIR)/%.cu | $$(@D)/.DIR
375755585ceSStan Tomov	$(call quiet,NVCC) $(CPPFLAGS) $(NVCCFLAGS) -c -o $@ $(abspath $<)
376755585ceSStan Tomov
377b5b03409SJed Brown$(OBJDIR)/% : tests/%.c | $$(@D)/.DIR
378265be9c8Sjeremylt	$(call quiet,LINK.c) -o $@ $(abspath $<) $(CEED_LIBS) $(LDLIBS)
37978b5556aScamierjs
3808980d4a7Sjeremylt$(OBJDIR)/% : tests/%.f90 | $$(@D)/.DIR
3814c7bddedSJed Brown	$(call quiet,LINK.F) -DSOURCE_DIR='"$(abspath $(<D))/"' -o $@ $(abspath $<) $(CEED_LIBS) $(LDLIBS)
38232d74c32SThilina Rathnayake
383182fbe45STzanio$(OBJDIR)/% : examples/ceed/%.c | $$(@D)/.DIR
384265be9c8Sjeremylt	$(call quiet,LINK.c) -o $@ $(abspath $<) $(CEED_LIBS) $(LDLIBS)
38591b7489eSJed Brown
386182fbe45STzanio$(OBJDIR)/% : examples/ceed/%.f | $$(@D)/.DIR
3874c7bddedSJed Brown	$(call quiet,LINK.F) -DSOURCE_DIR='"$(abspath $(<D))/"' -o $@ $(abspath $<) $(CEED_LIBS) $(LDLIBS)
388673d494eSThilina Rathnayake
38916c6c054SJed Brown$(OBJDIR)/mfem-% : examples/mfem/%.cpp $(libceed) | $$(@D)/.DIR
390c4216f28SJed Brown	+$(MAKE) -C examples/mfem CEED_DIR=`pwd` \
3912f4d9adbSJeremy L Thompson	  MFEM_DIR="$(abspath $(MFEM_DIR))" $*
39216c6c054SJed Brown	mv examples/mfem/$* $@
39316c6c054SJed Brown
39486a4271fSThilina Rathnayake# Note: Multiple Nek files cannot be built in parallel. The '+' here enables
39586a4271fSThilina Rathnayake#       this single Nek bps file to be built in parallel with other examples,
39686a4271fSThilina Rathnayake#       such as when calling `make prove-all -j2`.
39786a4271fSThilina Rathnayake$(OBJDIR)/nek-bps : examples/nek/bps/bps.usr examples/nek/nek-examples.sh $(libceed) | $$(@D)/.DIR
39886a4271fSThilina Rathnayake	+$(MAKE) -C examples MPI=$(MPI) CEED_DIR=`pwd` NEK5K_DIR="$(abspath $(NEK5K_DIR))" nek
39986a4271fSThilina Rathnayake	mv examples/nek/build/bps $(OBJDIR)/bps
40086a4271fSThilina Rathnayake	cp examples/nek/nek-examples.sh $(OBJDIR)/nek-bps
40186a4271fSThilina Rathnayake
4027f6cf205SJed Brown$(OBJDIR)/petsc-% : examples/petsc/%.c $(libceed) $(ceed.pc) | $$(@D)/.DIR
403c4216f28SJed Brown	+$(MAKE) -C examples/petsc CEED_DIR=`pwd` \
4042f4d9adbSJeremy L Thompson	  PETSC_DIR="$(abspath $(PETSC_DIR))" $*
405e797ab98SJed Brown	mv examples/petsc/$* $@
406e797ab98SJed Brown
407b974e86eSJed Brown$(OBJDIR)/ns-% : examples/navier-stokes/%.c $(libceed) $(ceed.pc) | $$(@D)/.DIR
408c4216f28SJed Brown	+$(MAKE) -C examples/navier-stokes CEED_DIR=`pwd` \
4092774d5cbSJeremy L Thompson	  PETSC_DIR="$(abspath $(PETSC_DIR))" $*
4102774d5cbSJeremy L Thompson	mv examples/navier-stokes/$* $@
4112774d5cbSJeremy L Thompson
412567e4d0aSJed Brownlibceed_test.o = $(test_backends.c:%.c=$(OBJDIR)/%.o)
41376af460cSJed Brown$(libceed_test) : $(libceed.o) $(libceed_test.o) | $$(@D)/.DIR
414241a4b83SYohann	$(call quiet,LINK) $(LDFLAGS) -shared -o $@ $^ $(LDLIBS)
415265be9c8Sjeremylt
416265be9c8Sjeremylt$(examples) : $(libceed)
41776af460cSJed Brown$(tests) : $(libceed_test)
41876af460cSJed Brown$(tests) : CEED_LIBS = -lceed_test
419fc377ca6SJed Brown$(tests) $(examples) : LDFLAGS += -Wl,-rpath,$(abspath $(LIBDIR)) -L$(LIBDIR)
4204859b599SJed Brown
421686de4acSJed Brownrun-t% : BACKENDS += $(TEST_BACKENDS)
422dad465e7SJed Brownrun-% : $(OBJDIR)/%
423d1f7f8d3SJed Brown	@tests/tap.sh $(<:$(OBJDIR)/%=%)
424686de4acSJed Brown
425686de4acSJed Brownexternal_examples := \
426686de4acSJed Brown	$(if $(MFEM_DIR),$(mfemexamples)) \
427686de4acSJed Brown	$(if $(PETSC_DIR),$(petscexamples)) \
428b974e86eSJed Brown	$(if $(NEK5K_DIR),$(nekexamples)) \
429b974e86eSJed Brown	$(if $(PETSC_DIR),$(nsexamples))
430686de4acSJed Brown
431686de4acSJed Brownallexamples = $(examples) $(external_examples)
432686de4acSJed Brown
433686de4acSJed Brown# The test and prove targets can be controlled via pattern searches.  The
434686de4acSJed Brown# default is to run tests and those examples that have no external dependencies.
435686de4acSJed Brown# Examples of finer grained control:
436686de4acSJed Brown#
437686de4acSJed Brown#   make test search='petsc mfem'      # PETSc and MFEM examples
438686de4acSJed Brown#   make prove search='t3'             # t3xx series tests
439686de4acSJed Brown#   make junit search='ex petsc'       # core ex* and PETSc tests
440686de4acSJed Brownsearch ?= t ex
441686de4acSJed Brownrealsearch = $(search:%=%%)
442686de4acSJed Brownmatched = $(foreach pattern,$(realsearch),$(filter $(OBJDIR)/$(pattern),$(tests) $(allexamples)))
443686de4acSJed Brown
4442158b1b0Sjeremylt# Test core libCEED
445686de4acSJed Browntest : $(matched:$(OBJDIR)/%=run-%)
4462158b1b0Sjeremylt
44786a4271fSThilina Rathnayake# Run test target in parallel
4486850bcb5Scamierjstst : ;@$(MAKE) $(MFLAGS) V=$(V) test
4493b56482dScamierjs# CPU C tests only for backend %
4503f3e7340Scamierjsctc-% : $(ctests);@$(foreach tst,$(ctests),$(tst) /cpu/$*;)
4514859b599SJed Brown
452686de4acSJed Brownprove : BACKENDS += $(TEST_BACKENDS)
45386a4271fSThilina Rathnayakeprove : $(matched)
454a5dc8077SJed Brown	$(info Testing backends: $(BACKENDS))
455686de4acSJed Brown	$(PROVE) $(PROVE_OPTS) --exec 'tests/tap.sh' $(matched:$(OBJDIR)/%=%)
45686a4271fSThilina Rathnayake# Run prove target in parallel
4576850bcb5Scamierjsprv : ;@$(MAKE) $(MFLAGS) V=$(V) prove
458bfa078e6SJed Brown
459686de4acSJed Brownprove-all :
460686de4acSJed Brown	+$(MAKE) prove realsearch=%
461686de4acSJed Brown
462686de4acSJed Brownjunit-t% : BACKENDS += $(TEST_BACKENDS)
4638ec9d54bSJed Brownjunit-% : $(OBJDIR)/%
464bdb0bdbbSJed Brown	@printf "  %10s %s\n" TEST $(<:$(OBJDIR)/%=%); $(PYTHON) tests/junit.py $(<:$(OBJDIR)/%=%)
4658ec9d54bSJed Brown
46676174befSjeremyltjunit : $(matched:$(OBJDIR)/%=junit-%)
4678ec9d54bSJed Brown
4682f4d9adbSJeremy L Thompsonall: $(alltests)
4692f4d9adbSJeremy L Thompson
4702f4d9adbSJeremy L Thompsonexamples : $(allexamples)
47186a4271fSThilina Rathnayakeceedexamples : $(examples)
47286a4271fSThilina Rathnayakenekexamples : $(nekexamples)
47386a4271fSThilina Rathnayakemfemexamples : $(mfemexamples)
47486a4271fSThilina Rathnayakepetscexamples : $(petscexamples)
4752f4d9adbSJeremy L Thompson
4762f4d9adbSJeremy L Thompson# Benchmarks
4770c59ef15SJeremy L Thompsonallbenchmarks = petsc-bps
4784e79ff5bSVeselin Dobrevbench_targets = $(addprefix bench-,$(allbenchmarks))
4794e79ff5bSVeselin Dobrev.PHONY: $(bench_targets) benchmarks
4804e79ff5bSVeselin Dobrev$(bench_targets): bench-%: $(OBJDIR)/%
4812f4d9adbSJeremy L Thompson	cd benchmarks && ./benchmark.sh --ceed "$(BACKENDS)" -r $(*).sh
4824e79ff5bSVeselin Dobrevbenchmarks: $(bench_targets)
4832c6ea02fSJed Brown
4846ea7c6c1SJed Brown$(ceed.pc) : pkgconfig-prefix = $(abspath .)
485d5217624SJed Brown$(OBJDIR)/ceed.pc : pkgconfig-prefix = $(prefix)
486d5217624SJed Brown.INTERMEDIATE : $(OBJDIR)/ceed.pc
4876ea7c6c1SJed Brown%/ceed.pc : ceed.pc.template | $$(@D)/.DIR
4886ea7c6c1SJed Brown	@sed "s:%prefix%:$(pkgconfig-prefix):" $< > $@
4890e439e50SJed Brown
490bf3e26f6SVeselin DobrevOCCA        := $(OCCA_DIR)/bin/occa
491cc6ff0d7SJed BrownOKL_KERNELS := $(wildcard backends/occa/*.okl)
492cc6ff0d7SJed Brown
493cc6ff0d7SJed Brownokl-cache :
494cc6ff0d7SJed Brown	$(OCCA) cache ceed $(OKL_KERNELS)
495cc6ff0d7SJed Brown
496cc6ff0d7SJed Brownokl-clear:
497cc6ff0d7SJed Brown	$(OCCA) clear -y -l ceed
498a5ba6ca9Scamierjs
499d5217624SJed Browninstall : $(libceed) $(OBJDIR)/ceed.pc
500bf3e26f6SVeselin Dobrev	$(INSTALL) -d $(addprefix $(if $(DESTDIR),"$(DESTDIR)"),"$(includedir)"\
501bf3e26f6SVeselin Dobrev	  "$(libdir)" "$(pkgconfigdir)" $(if $(OCCA_ON),"$(okldir)"))
5021e25a746SJed Brown	$(INSTALL_DATA) include/ceed.h "$(DESTDIR)$(includedir)/"
503f91e0974SThilina Rathnayake	$(INSTALL_DATA) include/ceedf.h "$(DESTDIR)$(includedir)/"
5041e25a746SJed Brown	$(INSTALL_DATA) $(libceed) "$(DESTDIR)$(libdir)/"
5051e25a746SJed Brown	$(INSTALL_DATA) $(OBJDIR)/ceed.pc "$(DESTDIR)$(pkgconfigdir)/"
506bf3e26f6SVeselin Dobrev	$(if $(OCCA_ON),$(INSTALL_DATA) $(OKL_KERNELS) "$(DESTDIR)$(okldir)/")
507d5217624SJed Brown
5084c4400c7SValeria Barra.PHONY : cln clean doxygen doc lib install all print test tst prove prv prove-all junit examples style tidy okl-cache okl-clear info info-backends
509d635b4c6Scamierjs
5106e5d1fd9Scamierjscln clean :
5115cd88e3aSjeremylt	$(RM) -r $(OBJDIR) $(LIBDIR) dist *egg* .pytest_cache *cffi*
51286a4271fSThilina Rathnayake	$(MAKE) -C examples clean NEK5K_DIR="$(abspath $(NEK5K_DIR))"
5135cd88e3aSjeremylt	$(MAKE) -C tests/python clean
514c4acb06bSStan Tomov	$(RM) $(magma_tmp.c) $(magma_tmp.cu) backends/magma/*~ backends/magma/*.o
515196a75e4SJed Brown	$(RM) benchmarks/*output.txt
5164859b599SJed Brown
51707838a1cSTzaniodistclean : clean
518196a75e4SJed Brown	$(RM) -r doc/html config.mk
51907838a1cSTzanio
5204c4400c7SValeria BarraDOXYGEN ?= doxygen
5214c4400c7SValeria Barradoxygen :
5224c4400c7SValeria Barra	$(DOXYGEN) Doxyfile
5234c4400c7SValeria Barra
5244c4400c7SValeria Barra# This is a real file, but it doesn't depend on the state of a file,
5254c4400c7SValeria Barra# so we make it phony to force it.  We sort the shortlog by author
5264c4400c7SValeria Barra# last name.
5274c4400c7SValeria Barra.PHONY: AUTHORS
5284c4400c7SValeria BarraAUTHORS:
5294c4400c7SValeria Barra	git shortlog -s | awk '{$$1 = "placeholder"; print $$NF,$$0}' | sort | cut -d\  -f3- > $@
5304c4400c7SValeria Barra
5314c4400c7SValeria Barradoc-html doc-latexpdf doc-epub : doc-% : doxygen AUTHORS
5324c4400c7SValeria Barra	make -C doc/sphinx $*
5334c4400c7SValeria Barra
5344c4400c7SValeria Barradoc : doc-html
5357bd3a522STzanio
536f2fa494dScamierjsstyle :
53720b73d85SJed Brown	@astyle --options=.astylerc \
538cb0b5415Sjeremylt          $(filter-out include/ceedf.h tests/t320-basis-f.h, \
53920b73d85SJed Brown            $(wildcard include/*.h interface/*.[ch] tests/*.[ch] backends/*/*.[ch] \
540288c0443SJeremy L Thompson              examples/*/*.[ch] examples/*/*.[ch]pp gallery/*/*.[ch]))
5410dbfdfc5SJed Brown
542683faae0SJed BrownCLANG_TIDY ?= clang-tidy
543683faae0SJed Brown%.c.tidy : %.c
5443f57957cSjeremylt	$(CLANG_TIDY) $^ -- $(CPPFLAGS) --std=c99
545683faae0SJed Brown
546683faae0SJed Browntidy : $(libceed.c:%=%.tidy)
547683faae0SJed Brown
5484859b599SJed Brownprint :
5494859b599SJed Brown	@echo $(VAR)=$($(VAR))
550582447c9SJed Brown
5519df38c42SVeselin Dobrevprint-% :
5529df38c42SVeselin Dobrev	$(info [ variable name]: $*)
5539df38c42SVeselin Dobrev	$(info [        origin]: $(origin $*))
554*7bcc1ce4SJed Brown	$(info [        flavor]: $(flavor $*))
5559df38c42SVeselin Dobrev	$(info [         value]: $(value $*))
5569df38c42SVeselin Dobrev	$(info [expanded value]: $($*))
5579df38c42SVeselin Dobrev	$(info )
5589df38c42SVeselin Dobrev	@true
5599df38c42SVeselin Dobrev
560d3c6b40fSJed Brown# "make configure" will autodetect any variables not passed on the
561d3c6b40fSJed Brown# command line, caching the result in config.mk to be used on any
562d3c6b40fSJed Brown# subsequent invocations of make.  For example,
563d3c6b40fSJed Brown#
564d3c6b40fSJed Brown#   make configure CC=/path/to/my/cc CUDA_DIR=/opt/cuda
565d3c6b40fSJed Brown#   make
566d3c6b40fSJed Brown#   make prove
567d3c6b40fSJed Brownconfigure :
56857213447SValeria Barra	@: > config.mk
56957213447SValeria Barra	@echo "CC = $(CC)" | tee -a config.mk
5703c83ce1dSJed Brown	@echo "CXX = $(CXX)" | tee -a config.mk
57157213447SValeria Barra	@echo "FC = $(FC)" | tee -a config.mk
57257213447SValeria Barra	@echo "NVCC = $(NVCC)" | tee -a config.mk
5733c83ce1dSJed Brown	@echo "NVCC_CXX = $(NVCC_CXX)" | tee -a config.mk
574d3c6b40fSJed Brown	@echo "CFLAGS = $(CFLAGS)" | tee -a config.mk
575d3c6b40fSJed Brown	@echo "CPPFLAGS = $(CPPFLAGS)" | tee -a config.mk
576d3c6b40fSJed Brown	@echo "FFLAGS = $(FFLAGS)" | tee -a config.mk
5773c83ce1dSJed Brown	@echo "NVCCFLAGS = $(NVCCFLAGS)" | tee -a config.mk
578d3c6b40fSJed Brown	@echo "LDFLAGS = $(LDFLAGS)" | tee -a config.mk
579d3c6b40fSJed Brown	@echo "LDLIBS = $(LDLIBS)" | tee -a config.mk
580d3c6b40fSJed Brown	@echo "MAGMA_DIR = $(MAGMA_DIR)" | tee -a config.mk
581d3c6b40fSJed Brown	@echo "XSMM_DIR = $(XSMM_DIR)" | tee -a config.mk
582d3c6b40fSJed Brown	@echo "CUDA_DIR = $(CUDA_DIR)" | tee -a config.mk
583d3c6b40fSJed Brown	@echo "MFEM_DIR = $(MFEM_DIR)" | tee -a config.mk
584d3c6b40fSJed Brown	@echo "PETSC_DIR = $(PETSC_DIR)" | tee -a config.mk
585d3c6b40fSJed Brown	@echo "NEK5K_DIR = $(NEK5K_DIR)" | tee -a config.mk
586d3c6b40fSJed Brown	@echo "Configuration cached in config.mk"
587d3c6b40fSJed Brown
588d3c6b40fSJed Brown.PHONY : configure
589d3c6b40fSJed Brown
590d1f7f8d3SJed Brown-include $(libceed.c:%.c=$(OBJDIR)/%.d) $(tests.c:tests/%.c=$(OBJDIR)/%.d)
591