1# Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2# All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3# 4# SPDX-License-Identifier: BSD-2-Clause 5# 6# This file is part of CEED: http://github.com/ceed 7 8CONFIG ?= config.mk 9-include $(CONFIG) 10COMMON ?= common.mk 11-include $(COMMON) 12 13ifeq (,$(filter-out undefined default,$(origin CC))) 14 CC = gcc 15endif 16ifeq (,$(filter-out undefined default,$(origin CXX))) 17 CXX = g++ 18endif 19ifeq (,$(filter-out undefined default,$(origin FC))) 20 FC = gfortran 21endif 22ifeq (,$(filter-out undefined default,$(origin LINK))) 23 LINK = $(CC) 24endif 25ifeq (,$(filter-out undefined default,$(origin AR))) 26 AR = ar 27endif 28ifeq (,$(filter-out undefined default,$(origin ARFLAGS))) 29 ARFLAGS = crD 30endif 31NVCC ?= $(CUDA_DIR)/bin/nvcc 32NVCC_CXX ?= $(CXX) 33HIPCC ?= $(HIP_DIR)/bin/hipcc 34SED ?= sed 35EXE_SUFFIX = $(if $(EMSCRIPTEN),.wasm) 36 37# ASAN must be left empty if you don't want to use it 38ASAN ?= 39 40# These are the values automatically detected here in the makefile. They are 41# augmented with LDFLAGS and LDLIBS from the environment/passed by command line, 42# if any. If the user sets CEED_LDFLAGS or CEED_LDLIBS, they are used *instead 43# of* what we populate here (thus that's advanced usage and not recommended). 44CEED_LDFLAGS ?= 45CEED_LDLIBS ?= 46 47UNDERSCORE ?= 1 48 49# Verbose mode, V or VERBOSE 50V ?= $(VERBOSE) 51 52# MFEM_DIR env variable should point to sibling directory 53ifneq ($(wildcard ../mfem/libmfem.*),) 54 MFEM_DIR ?= ../mfem 55endif 56 57# NEK5K_DIR env variable should point to sibling directory 58ifneq ($(wildcard ../Nek5000/*),) 59 NEK5K_DIR ?= $(abspath ../Nek5000) 60endif 61export NEK5K_DIR 62MPI ?= 1 63 64# CEED_DIR env for NEK5K testing 65export CEED_DIR = $(abspath .) 66 67# XSMM_DIR env variable should point to XSMM main (github.com/hfp/libxsmm) 68XSMM_DIR ?= ../libxsmm 69 70# OCCA_DIR env variable should point to OCCA main (github.com/libocca/occa) 71OCCA_DIR ?= ../occa/install 72 73# env variable MAGMA_DIR can be used too 74MAGMA_DIR ?= ../magma 75 76# Often /opt/cuda or /usr/local/cuda, but sometimes present on machines that don't support CUDA 77CUDA_DIR ?= 78CUDA_ARCH ?= 79 80# Often /opt/rocm, but sometimes present on machines that don't support HIP 81HIP_DIR ?= 82HIP_ARCH ?= 83 84# Check for PETSc in ../petsc 85ifneq ($(wildcard ../petsc/lib/libpetsc.*),) 86 PETSC_DIR ?= ../petsc 87endif 88 89# Warning: SANTIZ options still don't run with /gpu/occa 90# export LSAN_OPTIONS=suppressions=.asanignore 91AFLAGS = -fsanitize=address #-fsanitize=undefined -fno-omit-frame-pointer 92 93# Note: Intel oneAPI C/C++ compiler is now icx/icpx 94CC_VENDOR := $(subst icc_orig,icc,$(subst oneAPI,icc,$(firstword $(filter gcc clang icc icc_orig oneAPI XL,$(subst -, ,$(shell $(CC) --version)))))) 95FC_VENDOR := $(if $(FC),$(firstword $(filter GNU ifort ifx XL,$(shell $(FC) --version 2>&1 || $(FC) -qversion)))) 96 97# Default extra flags by vendor 98MARCHFLAG.gcc := -march=native 99MARCHFLAG.clang := $(MARCHFLAG.gcc) 100MARCHFLAG.icc := 101MARCHFLAG.oneAPI := $(MARCHFLAG.clang) 102OMP_SIMD_FLAG.gcc := -fopenmp-simd 103OMP_SIMD_FLAG.clang := $(OMP_SIMD_FLAG.gcc) 104OMP_SIMD_FLAG.icc := -qopenmp-simd 105OMP_SIMD_FLAG.oneAPI := $(OMP_SIMD_FLAG.clang) 106OPT.gcc := -ffp-contract=fast 107OPT.clang := $(OPT.gcc) 108OPT.oneAPI := $(OPT.clang) 109CFLAGS.gcc := -fPIC -std=c99 -Wall -Wextra -Wno-unused-parameter -MMD -MP 110CFLAGS.clang := $(CFLAGS.gcc) 111CFLAGS.icc := $(CFLAGS.gcc) 112CFLAGS.oneAPI := $(CFLAGS.clang) 113CFLAGS.XL := -qpic -MMD 114CXXFLAGS.gcc := -fPIC -std=c++11 -Wall -Wextra -Wno-unused-parameter -MMD -MP 115CXXFLAGS.clang := $(CXXFLAGS.gcc) 116CXXFLAGS.icc := $(CXXFLAGS.gcc) 117CXXFLAGS.oneAPI := $(CXXFLAGS.clang) 118CXXFLAGS.XL := -qpic -std=c++11 -MMD 119FFLAGS.GNU := -fPIC -cpp -Wall -Wextra -Wno-unused-parameter -Wno-unused-dummy-argument -MMD -MP 120FFLAGS.ifort := -fPIC -cpp 121FFLAGS.ifx := $(FFLAGS.ifort) 122FFLAGS.XL := -qpic -ffree-form -qpreprocess -qextname -MMD 123 124# This check works with compilers that use gcc and clang. It fails with some 125# compilers; e.g., xlc apparently ignores all options when -E is passed, thus 126# succeeds with any flags. Users can pass MARCHFLAG=... if desired. 127cc_check_flag = $(shell $(CC) -E -Werror $(1) -x c /dev/null > /dev/null 2>&1 && echo 1) 128MARCHFLAG := $(MARCHFLAG.$(CC_VENDOR)) 129MARCHFLAG := $(if $(call cc_check_flag,$(MARCHFLAG)),$(MARCHFLAG),-mcpu=native) 130MARCHFLAG := $(if $(call cc_check_flag,$(MARCHFLAG)),$(MARCHFLAG)) 131 132OMP_SIMD_FLAG := $(OMP_SIMD_FLAG.$(CC_VENDOR)) 133OMP_SIMD_FLAG := $(if $(call cc_check_flag,$(OMP_SIMD_FLAG)),$(OMP_SIMD_FLAG)) 134 135OPT ?= -O -g $(MARCHFLAG) $(OPT.$(CC_VENDOR)) $(OMP_SIMD_FLAG) 136CFLAGS ?= $(OPT) $(CFLAGS.$(CC_VENDOR)) 137CXXFLAGS ?= $(OPT) $(CXXFLAGS.$(CC_VENDOR)) 138LIBCXX ?= -lstdc++ 139NVCCFLAGS ?= -ccbin $(CXX) -Xcompiler "$(OPT)" -Xcompiler -fPIC 140ifneq ($(CUDA_ARCH),) 141 NVCCFLAGS += -arch=$(CUDA_ARCH) 142endif 143HIPCCFLAGS ?= $(filter-out $(OMP_SIMD_FLAG),$(OPT)) -fPIC -munsafe-fp-atomics 144ifneq ($(HIP_ARCH),) 145 HIPCCFLAGS += --amdgpu-target=$(HIP_ARCH) 146endif 147FFLAGS ?= $(OPT) $(FFLAGS.$(FC_VENDOR)) 148 149ifeq ($(COVERAGE), 1) 150 CFLAGS += --coverage 151 CXXFLAGS += --coverage 152 CEED_LDFLAGS += --coverage 153endif 154 155CFLAGS += $(if $(ASAN),$(AFLAGS)) 156FFLAGS += $(if $(ASAN),$(AFLAGS)) 157CEED_LDFLAGS += $(if $(ASAN),$(AFLAGS)) 158CPPFLAGS += -I./include 159CEED_LDLIBS = -lm 160OBJDIR := build 161for_install := $(filter install,$(MAKECMDGOALS)) 162LIBDIR := $(if $(for_install),$(OBJDIR),lib) 163 164 165# Installation variables 166prefix ?= /usr/local 167bindir = $(prefix)/bin 168libdir = $(prefix)/lib 169includedir = $(prefix)/include 170pkgconfigdir = $(libdir)/pkgconfig 171INSTALL = install 172INSTALL_PROGRAM = $(INSTALL) 173INSTALL_DATA = $(INSTALL) -m644 174 175# Get number of processors of the machine 176NPROCS := $(shell getconf _NPROCESSORS_ONLN) 177# prepare make options to run in parallel 178MFLAGS := -j $(NPROCS) --warn-undefined-variables \ 179 --no-print-directory --no-keep-going 180 181PYTHON ?= python3 182PROVE ?= prove 183PROVE_OPTS ?= -j $(NPROCS) 184DARWIN := $(filter Darwin,$(shell uname -s)) 185SO_EXT := $(if $(DARWIN),dylib,so) 186 187ceed.pc := $(LIBDIR)/pkgconfig/ceed.pc 188libceed.so := $(LIBDIR)/libceed.$(SO_EXT) 189libceed.a := $(LIBDIR)/libceed.a 190libceed := $(if $(STATIC),$(libceed.a),$(libceed.so)) 191CEED_LIBS = -lceed 192libceed.c := $(filter-out interface/ceed-cuda.c interface/ceed-hip.c interface/ceed-jit-source-root-$(if $(for_install),default,install).c, $(wildcard interface/ceed*.c backends/*.c gallery/*.c)) 193gallery.c := $(wildcard gallery/*/ceed*.c) 194libceed.c += $(gallery.c) 195libceeds = $(libceed) 196BACKENDS_BUILTIN := /cpu/self/ref/serial /cpu/self/ref/blocked /cpu/self/opt/serial /cpu/self/opt/blocked 197BACKENDS_MAKE := $(BACKENDS_BUILTIN) 198TEST_BACKENDS := /cpu/self/tmpl /cpu/self/tmpl/sub 199 200# Tests 201tests.c := $(sort $(wildcard tests/t[0-9][0-9][0-9]-*.c)) 202tests.f := $(if $(FC),$(sort $(wildcard tests/t[0-9][0-9][0-9]-*.f90))) 203tests := $(tests.c:tests/%.c=$(OBJDIR)/%$(EXE_SUFFIX)) 204ctests := $(tests) 205tests += $(tests.f:tests/%.f90=$(OBJDIR)/%$(EXE_SUFFIX)) 206# Examples 207examples.c := $(sort $(wildcard examples/ceed/*.c)) 208examples.f := $(if $(FC),$(sort $(wildcard examples/ceed/*.f))) 209examples := $(examples.c:examples/ceed/%.c=$(OBJDIR)/%$(EXE_SUFFIX)) 210examples += $(examples.f:examples/ceed/%.f=$(OBJDIR)/%$(EXE_SUFFIX)) 211# MFEM Examples 212mfemexamples.cpp := $(sort $(wildcard examples/mfem/*.cpp)) 213mfemexamples := $(mfemexamples.cpp:examples/mfem/%.cpp=$(OBJDIR)/mfem-%) 214# Nek5K Examples 215nekexamples := $(OBJDIR)/nek-bps 216# PETSc Examples 217petscexamples.c := $(wildcard examples/petsc/*.c) 218petscexamples := $(petscexamples.c:examples/petsc/%.c=$(OBJDIR)/petsc-%) 219# Fluid Dynamics Examples 220fluidsexamples.c := $(sort $(wildcard examples/fluids/*.c)) 221fluidsexamples := $(fluidsexamples.c:examples/fluids/%.c=$(OBJDIR)/fluids-%) 222# Solid Mechanics Examples 223solidsexamples.c := $(sort $(wildcard examples/solids/*.c)) 224solidsexamples := $(solidsexamples.c:examples/solids/%.c=$(OBJDIR)/solids-%) 225 226# Backends/[ref, blocked, memcheck, opt, avx, occa, magma] 227ref.c := $(sort $(wildcard backends/ref/*.c)) 228blocked.c := $(sort $(wildcard backends/blocked/*.c)) 229ceedmemcheck.c := $(sort $(wildcard backends/memcheck/*.c)) 230opt.c := $(sort $(wildcard backends/opt/*.c)) 231avx.c := $(sort $(wildcard backends/avx/*.c)) 232xsmm.c := $(sort $(wildcard backends/xsmm/*.c)) 233cuda.c := $(sort $(wildcard backends/cuda/*.c)) 234cuda.cpp := $(sort $(wildcard backends/cuda/*.cpp)) 235cuda-ref.c := $(sort $(wildcard backends/cuda-ref/*.c)) 236cuda-ref.cpp := $(sort $(wildcard backends/cuda-ref/*.cpp)) 237cuda-ref.cu := $(sort $(wildcard backends/cuda-ref/kernels/*.cu)) 238cuda-shared.c := $(sort $(wildcard backends/cuda-shared/*.c)) 239cuda-shared.cu := $(sort $(wildcard backends/cuda-shared/kernels/*.cu)) 240cuda-gen.c := $(sort $(wildcard backends/cuda-gen/*.c)) 241cuda-gen.cpp := $(sort $(wildcard backends/cuda-gen/*.cpp)) 242cuda-gen.cu := $(sort $(wildcard backends/cuda-gen/kernels/*.cu)) 243occa.cpp := $(sort $(shell find backends/occa -type f -name *.cpp)) 244magma.c := $(sort $(wildcard backends/magma/*.c)) 245magma.cpp := $(sort $(wildcard backends/magma/*.cpp)) 246magma.cu := $(sort $(wildcard backends/magma/kernels/cuda/*.cu)) 247magma.hip := $(sort $(wildcard backends/magma/kernels/hip/*.hip.cpp)) 248hip.c := $(sort $(wildcard backends/hip/*.c)) 249hip.cpp := $(sort $(wildcard backends/hip/*.cpp)) 250hip-ref.c := $(sort $(wildcard backends/hip-ref/*.c)) 251hip-ref.cpp := $(sort $(wildcard backends/hip-ref/*.cpp)) 252hip-ref.hip := $(sort $(wildcard backends/hip-ref/kernels/*.hip.cpp)) 253hip-shared.c := $(sort $(wildcard backends/hip-shared/*.c)) 254hip-gen.c := $(sort $(wildcard backends/hip-gen/*.c)) 255hip-gen.cpp := $(sort $(wildcard backends/hip-gen/*.cpp)) 256 257# Quiet, color output 258quiet ?= $($(1)) 259 260# Cancel built-in and old-fashioned implicit rules which we don't use 261.SUFFIXES: 262 263.SECONDEXPANSION: # to expand $$(@D)/.DIR 264 265%/.DIR : 266 @mkdir -p $(@D) 267 @touch $@ 268 269.PRECIOUS: %/.DIR 270 271lib: $(libceed) $(ceed.pc) 272# run 'lib' target in parallel 273par:;@$(MAKE) $(MFLAGS) V=$(V) lib 274backend_status = $(if $(filter $1,$(BACKENDS_MAKE)), [backends: $1], [not found]) 275info: 276 $(info ------------------------------------) 277 $(info CC = $(CC)) 278 $(info CXX = $(CXX)) 279 $(info FC = $(FC)) 280 $(info CPPFLAGS = $(CPPFLAGS)) 281 $(info CFLAGS = $(value CFLAGS)) 282 $(info CXXFLAGS = $(value CXXFLAGS)) 283 $(info FFLAGS = $(value FFLAGS)) 284 $(info NVCCFLAGS = $(value NVCCFLAGS)) 285 $(info HIPCCFLAGS = $(value HIPCCFLAGS)) 286 $(info CEED_LDFLAGS = $(value CEED_LDFLAGS)) 287 $(info CEED_LDLIBS = $(value CEED_LDLIBS)) 288 $(info AR = $(AR)) 289 $(info ARFLAGS = $(ARFLAGS)) 290 $(info OPT = $(OPT)) 291 $(info AFLAGS = $(AFLAGS)) 292 $(info ASAN = $(or $(ASAN),(empty))) 293 $(info VERBOSE = $(or $(V),(empty)) [verbose=$(if $(V),on,off)]) 294 $(info ------------------------------------) 295 $(info MEMCHK_STATUS = $(MEMCHK_STATUS)$(call backend_status,$(MEMCHK_BACKENDS))) 296 $(info AVX_STATUS = $(AVX_STATUS)$(call backend_status,$(AVX_BACKENDS))) 297 $(info XSMM_DIR = $(XSMM_DIR)$(call backend_status,$(XSMM_BACKENDS))) 298 $(info OCCA_DIR = $(OCCA_DIR)$(call backend_status,$(OCCA_BACKENDS))) 299 $(info MAGMA_DIR = $(MAGMA_DIR)$(call backend_status,$(MAGMA_BACKENDS))) 300 $(info CUDA_DIR = $(CUDA_DIR)$(call backend_status,$(CUDA_BACKENDS))) 301 $(info HIP_DIR = $(HIP_DIR)$(call backend_status,$(HIP_BACKENDS))) 302 $(info ------------------------------------) 303 $(info MFEM_DIR = $(MFEM_DIR)) 304 $(info NEK5K_DIR = $(NEK5K_DIR)) 305 $(info PETSC_DIR = $(PETSC_DIR)) 306 $(info ------------------------------------) 307 $(info prefix = $(prefix)) 308 $(info includedir = $(value includedir)) 309 $(info libdir = $(value libdir)) 310 $(info pkgconfigdir = $(value pkgconfigdir)) 311 $(info ------------------------------------) 312 @true 313info-backends: 314 $(info make: 'lib' with optional backends: $(filter-out $(BACKENDS_BUILTIN),$(BACKENDS))) 315 @true 316info-backends-all: 317 $(info make: 'lib' with backends: $(filter-out $(TEST_BACKENDS),$(BACKENDS))) 318 @true 319 320$(libceed.so) : CEED_LDFLAGS += $(if $(DARWIN), -install_name @rpath/$(notdir $(libceed.so))) 321 322# Standard Backends 323libceed.c += $(ref.c) 324libceed.c += $(blocked.c) 325libceed.c += $(opt.c) 326 327# Memcheck Backend 328MEMCHK_STATUS = Disabled 329MEMCHK := $(shell echo "$(HASH)include <valgrind/memcheck.h>" | $(CC) $(CPPFLAGS) -E - >/dev/null 2>&1 && echo 1) 330MEMCHK_BACKENDS = /cpu/self/memcheck/serial /cpu/self/memcheck/blocked 331ifeq ($(MEMCHK),1) 332 MEMCHK_STATUS = Enabled 333 libceed.c += $(ceedmemcheck.c) 334 BACKENDS_MAKE += $(MEMCHK_BACKENDS) 335endif 336 337# AVX Backed 338AVX_STATUS = Disabled 339AVX_FLAG := $(if $(filter clang,$(CC_VENDOR)),+avx,-mavx) 340AVX := $(filter $(AVX_FLAG),$(shell $(CC) $(CFLAGS) -v -E -x c /dev/null 2>&1)) 341AVX_BACKENDS = /cpu/self/avx/serial /cpu/self/avx/blocked 342ifneq ($(AVX),) 343 AVX_STATUS = Enabled 344 libceed.c += $(avx.c) 345 BACKENDS_MAKE += $(AVX_BACKENDS) 346endif 347 348# Collect list of libraries and paths for use in linking and pkg-config 349PKG_LIBS = 350# Stubs that will not be RPATH'd 351PKG_STUBS_LIBS = 352 353# libXSMM Backends 354XSMM_BACKENDS = /cpu/self/xsmm/serial /cpu/self/xsmm/blocked 355ifneq ($(wildcard $(XSMM_DIR)/lib/libxsmm.*),) 356 PKG_LIBS += -L$(abspath $(XSMM_DIR))/lib -lxsmm -ldl 357 MKL ?= 358 ifeq (,$(MKL)$(MKLROOT)) 359 BLAS_LIB = -lblas 360 else 361 ifneq ($(MKLROOT),) 362 # Some installs put everything inside an intel64 subdirectory, others not 363 MKL_LIBDIR = $(dir $(firstword $(wildcard $(MKLROOT)/lib/intel64/libmkl_sequential.* $(MKLROOT)/lib/libmkl_sequential.*))) 364 MKL_LINK = -L$(MKL_LIBDIR) 365 PKG_LIB_DIRS += $(MKL_LIBDIR) 366 endif 367 BLAS_LIB = $(MKL_LINK) -Wl,--push-state,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl -Wl,--pop-state 368 endif 369 PKG_LIBS += $(BLAS_LIB) 370 libceed.c += $(xsmm.c) 371 $(xsmm.c:%.c=$(OBJDIR)/%.o) $(xsmm.c:%=%.tidy) : CPPFLAGS += -I$(XSMM_DIR)/include 372 BACKENDS_MAKE += $(XSMM_BACKENDS) 373endif 374 375# OCCA Backends 376OCCA_BACKENDS = /cpu/self/occa 377ifneq ($(wildcard $(OCCA_DIR)/lib/libocca.*),) 378 OCCA_MODES := $(shell LD_LIBRARY_PATH=$(OCCA_DIR)/lib $(OCCA_DIR)/bin/occa modes) 379 OCCA_BACKENDS += $(if $(filter OpenMP,$(OCCA_MODES)),/cpu/openmp/occa) 380 OCCA_BACKENDS += $(if $(filter dpcpp,$(OCCA_MODES)),/gpu/dpcpp/occa) 381 OCCA_BACKENDS += $(if $(filter OpenCL,$(OCCA_MODES)),/gpu/opencl/occa) 382 OCCA_BACKENDS += $(if $(filter HIP,$(OCCA_MODES)),/gpu/hip/occa) 383 OCCA_BACKENDS += $(if $(filter CUDA,$(OCCA_MODES)),/gpu/cuda/occa) 384 385 $(libceeds) : CPPFLAGS += -I$(OCCA_DIR)/include 386 PKG_LIBS += -L$(abspath $(OCCA_DIR))/lib -locca 387 LIBCEED_CONTAINS_CXX = 1 388 libceed.cpp += $(occa.cpp) 389 BACKENDS_MAKE += $(OCCA_BACKENDS) 390endif 391 392# CUDA Backends 393ifneq ($(CUDA_DIR),) 394 CUDA_LIB_DIR := $(wildcard $(foreach d,lib lib64 lib/x86_64-linux-gnu,$(CUDA_DIR)/$d/libcudart.${SO_EXT})) 395 CUDA_LIB_DIR := $(patsubst %/,%,$(dir $(firstword $(CUDA_LIB_DIR)))) 396endif 397CUDA_LIB_DIR_STUBS := $(CUDA_LIB_DIR)/stubs 398CUDA_BACKENDS = /gpu/cuda/ref /gpu/cuda/shared /gpu/cuda/gen 399ifneq ($(CUDA_LIB_DIR),) 400 $(libceeds) : CPPFLAGS += -I$(CUDA_DIR)/include 401 PKG_LIBS += -L$(abspath $(CUDA_LIB_DIR)) -lcudart -lnvrtc -lcuda -lcublas 402 PKG_STUBS_LIBS += -L$(CUDA_LIB_DIR_STUBS) 403 LIBCEED_CONTAINS_CXX = 1 404 libceed.c += interface/ceed-cuda.c 405 libceed.c += $(cuda.c) $(cuda-ref.c) $(cuda-shared.c) $(cuda-gen.c) 406 libceed.cpp += $(cuda.cpp) $(cuda-ref.cpp) $(cuda-gen.cpp) 407 libceed.cu += $(cuda-ref.cu) $(cuda-shared.cu) $(cuda-gen.cu) 408 BACKENDS_MAKE += $(CUDA_BACKENDS) 409endif 410 411# HIP Backends 412HIP_LIB_DIR := $(wildcard $(foreach d,lib lib64,$(HIP_DIR)/$d/libamdhip64.${SO_EXT})) 413HIP_LIB_DIR := $(patsubst %/,%,$(dir $(firstword $(HIP_LIB_DIR)))) 414HIP_BACKENDS = /gpu/hip/ref /gpu/hip/shared /gpu/hip/gen 415ifneq ($(HIP_LIB_DIR),) 416 $(libceeds) : HIPCCFLAGS += -I./include 417 ifneq ($(CXX), $(HIPCC)) 418 CPPFLAGS += $(subst =,,$(shell $(HIP_DIR)/bin/hipconfig -C)) 419 endif 420 $(libceeds) : CPPFLAGS += -I$(HIP_DIR)/include 421 PKG_LIBS += -L$(abspath $(HIP_LIB_DIR)) -lamdhip64 -lhipblas 422 LIBCEED_CONTAINS_CXX = 1 423 libceed.c += interface/ceed-hip.c 424 libceed.c += $(hip.c) $(hip-ref.c) $(hip-shared.c) $(hip-gen.c) 425 libceed.cpp += $(hip.cpp) $(hip-ref.cpp) $(hip-gen.cpp) 426 libceed.hip += $(hip-ref.hip) 427 BACKENDS_MAKE += $(HIP_BACKENDS) 428endif 429 430# MAGMA Backend 431ifneq ($(wildcard $(MAGMA_DIR)/lib/libmagma.*),) 432 MAGMA_ARCH=$(shell nm -g $(MAGMA_DIR)/lib/libmagma.* | grep -c "hipblas") 433 ifeq ($(MAGMA_ARCH), 0) #CUDA MAGMA 434 ifneq ($(CUDA_LIB_DIR),) 435 cuda_link = $(if $(STATIC),,-Wl,-rpath,$(CUDA_LIB_DIR)) -L$(CUDA_LIB_DIR) -lcublas -lcusparse -lcudart 436 omp_link = -fopenmp 437 magma_link_static = -L$(MAGMA_DIR)/lib -lmagma $(cuda_link) $(omp_link) 438 magma_link_shared = -L$(MAGMA_DIR)/lib $(if $(STATIC),,-Wl,-rpath,$(abspath $(MAGMA_DIR)/lib)) -lmagma 439 magma_link := $(if $(wildcard $(MAGMA_DIR)/lib/libmagma.${SO_EXT}),$(magma_link_shared),$(magma_link_static)) 440 PKG_LIBS += $(magma_link) 441 libceed.c += $(magma.c) 442 libceed.cpp += $(magma.cpp) 443 libceed.cu += $(magma.cu) 444 $(magma.c:%.c=$(OBJDIR)/%.o) $(magma.c:%=%.tidy) : CPPFLAGS += -DADD_ -I$(MAGMA_DIR)/include -I$(CUDA_DIR)/include 445 $(magma.cpp:%.cpp=$(OBJDIR)/%.o) $(magma.cpp:%=%.tidy) : CPPFLAGS += -DADD_ -I$(MAGMA_DIR)/include -I$(CUDA_DIR)/include 446 $(magma.cu:%.cu=$(OBJDIR)/%.o) : CPPFLAGS += --compiler-options=-fPIC -DADD_ -I$(MAGMA_DIR)/include -I$(MAGMA_DIR)/magmablas -I$(CUDA_DIR)/include 447 MAGMA_BACKENDS = /gpu/cuda/magma /gpu/cuda/magma/det 448 endif 449 else # HIP MAGMA 450 ifneq ($(HIP_LIB_DIR),) 451 hip_link = $(if $(STATIC),,-Wl,-rpath,$(HIP_LIB_DIR)) -L$(HIP_LIB_DIR) -lhipblas -lhipsparse -lamdhip64 452 omp_link = -fopenmp 453 magma_link_static = -L$(MAGMA_DIR)/lib -lmagma $(hip_link) $(omp_link) 454 magma_link_shared = -L$(MAGMA_DIR)/lib $(if $(STATIC),,-Wl,-rpath,$(abspath $(MAGMA_DIR)/lib)) -lmagma 455 magma_link := $(if $(wildcard $(MAGMA_DIR)/lib/libmagma.${SO_EXT}),$(magma_link_shared),$(magma_link_static)) 456 PKG_LIBS += $(magma_link) 457 libceed.c += $(magma.c) 458 libceed.cpp += $(magma.cpp) 459 libceed.hip += $(magma.hip) 460 ifneq ($(CXX), $(HIPCC)) 461 $(magma.c:%.c=$(OBJDIR)/%.o) $(magma.c:%=%.tidy) : CPPFLAGS += -I$(MAGMA_DIR)/include -I$(HIP_DIR)/include -DCEED_MAGMA_USE_HIP -DADD_ 462 $(magma.cpp:%.cpp=$(OBJDIR)/%.o) $(magma.cpp:%=%.tidy) : CPPFLAGS += -I$(MAGMA_DIR)/include -I$(HIP_DIR)/include -DCEED_MAGMA_USE_HIP -DADD_ 463 else 464 $(magma.c:%.c=$(OBJDIR)/%.o) $(magma.c:%=%.tidy) : HIPCCFLAGS += -I$(MAGMA_DIR)/include -I$(HIP_DIR)/include -DCEED_MAGMA_USE_HIP -DADD_ 465 $(magma.cpp:%.cpp=$(OBJDIR)/%.o) $(magma.cpp:%=%.tidy) : HIPCCFLAGS += -I$(MAGMA_DIR)/include -I$(HIP_DIR)/include -DCEED_MAGMA_USE_HIP -DADD_ 466 endif 467 $(magma.hip:%.hip.cpp=$(OBJDIR)/%.o) : HIPCCFLAGS += -I$(MAGMA_DIR)/include -I$(MAGMA_DIR)/magmablas -I$(HIP_DIR)/include -DCEED_MAGMA_USE_HIP -DADD_ 468 MAGMA_BACKENDS = /gpu/hip/magma /gpu/hip/magma/det 469 endif 470 endif 471 LIBCEED_CONTAINS_CXX = 1 472 BACKENDS_MAKE += $(MAGMA_BACKENDS) 473endif 474 475BACKENDS ?= $(BACKENDS_MAKE) 476export BACKENDS 477 478_pkg_ldflags = $(filter -L%,$(PKG_LIBS)) 479_pkg_ldlibs = $(filter-out -L%,$(PKG_LIBS)) 480$(libceeds) : CEED_LDFLAGS += $(_pkg_ldflags) $(if $(STATIC),,$(_pkg_ldflags:-L%=-Wl,-rpath,%)) $(PKG_STUBS_LIBS) 481$(libceeds) : CEED_LDLIBS += $(_pkg_ldlibs) 482ifeq ($(STATIC),1) 483$(examples) $(tests) : CEED_LDFLAGS += $(_pkg_ldflags) $(if $(STATIC),,$(_pkg_ldflags:-L%=-Wl,-rpath,%)) $(PKG_STUBS_LIBS) 484$(examples) $(tests) : CEED_LDLIBS += $(_pkg_ldlibs) 485endif 486 487pkgconfig-libs-private = $(PKG_LIBS) 488ifeq ($(LIBCEED_CONTAINS_CXX),1) 489 $(libceeds) : LINK = $(CXX) 490 ifeq ($(STATIC),1) 491 $(examples) $(tests) : CEED_LDLIBS += $(LIBCXX) 492 pkgconfig-libs-private += $(LIBCXX) 493 endif 494endif 495 496# File names *-weak.c contain weak symbol definitions, which must be listed last 497# when creating shared or static libraries. 498weak_last = $(filter-out %-weak.o,$(1)) $(filter %-weak.o,$(1)) 499 500libceed.o = $(libceed.c:%.c=$(OBJDIR)/%.o) $(libceed.cpp:%.cpp=$(OBJDIR)/%.o) $(libceed.cu:%.cu=$(OBJDIR)/%.o) $(libceed.hip:%.hip.cpp=$(OBJDIR)/%.o) 501$(filter %fortran.o,$(libceed.o)) : CPPFLAGS += $(if $(filter 1,$(UNDERSCORE)),-DUNDERSCORE) 502$(libceed.o): | info-backends 503$(libceed.so) : $(call weak_last,$(libceed.o)) | $$(@D)/.DIR 504 $(call quiet,LINK) $(LDFLAGS) $(CEED_LDFLAGS) -shared -o $@ $^ $(CEED_LDLIBS) $(LDLIBS) 505 506$(libceed.a) : $(call weak_last,$(libceed.o)) | $$(@D)/.DIR 507 $(call quiet,AR) $(ARFLAGS) $@ $^ 508 509$(OBJDIR)/%.o : $(CURDIR)/%.c | $$(@D)/.DIR 510 $(call quiet,CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(abspath $<) 511 512$(OBJDIR)/%.o : $(CURDIR)/%.cpp | $$(@D)/.DIR 513 $(call quiet,CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(abspath $<) 514 515$(OBJDIR)/%.o : $(CURDIR)/%.cu | $$(@D)/.DIR 516 $(call quiet,NVCC) $(filter-out -Wno-unused-function, $(CPPFLAGS)) $(NVCCFLAGS) -c -o $@ $(abspath $<) 517 518$(OBJDIR)/%.o : $(CURDIR)/%.hip.cpp | $$(@D)/.DIR 519 $(call quiet,HIPCC) $(HIPCCFLAGS) -c -o $@ $(abspath $<) 520 521$(OBJDIR)/%$(EXE_SUFFIX) : tests/%.c | $$(@D)/.DIR 522 $(call quiet,LINK.c) $(CEED_LDFLAGS) -o $@ $(abspath $<) $(CEED_LIBS) $(CEED_LDLIBS) $(LDLIBS) 523 524$(OBJDIR)/%$(EXE_SUFFIX) : tests/%.f90 | $$(@D)/.DIR 525 $(call quiet,LINK.F) -DSOURCE_DIR='"$(abspath $(<D))/"' $(CEED_LDFLAGS) -o $@ $(abspath $<) $(CEED_LIBS) $(CEED_LDLIBS) $(LDLIBS) 526 527$(OBJDIR)/%$(EXE_SUFFIX) : examples/ceed/%.c | $$(@D)/.DIR 528 $(call quiet,LINK.c) $(CEED_LDFLAGS) -o $@ $(abspath $<) $(CEED_LIBS) $(CEED_LDLIBS) $(LDLIBS) 529 530$(OBJDIR)/%$(EXE_SUFFIX) : examples/ceed/%.f | $$(@D)/.DIR 531 $(call quiet,LINK.F) -DSOURCE_DIR='"$(abspath $(<D))/"' $(CEED_LDFLAGS) -o $@ $(abspath $<) $(CEED_LIBS) $(CEED_LDLIBS) $(LDLIBS) 532 533$(OBJDIR)/mfem-% : examples/mfem/%.cpp $(libceed) | $$(@D)/.DIR 534 +$(MAKE) -C examples/mfem CEED_DIR=`pwd` \ 535 MFEM_DIR="$(abspath $(MFEM_DIR))" CXX=$(CXX) $* 536 cp examples/mfem/$* $@ 537 538# Note: Multiple Nek files cannot be built in parallel. The '+' here enables 539# this single Nek bps file to be built in parallel with other examples, 540# such as when calling `make prove-all -j2`. 541$(OBJDIR)/nek-bps : examples/nek/bps/bps.usr examples/nek/nek-examples.sh $(libceed) | $$(@D)/.DIR 542 +$(MAKE) -C examples MPI=$(MPI) CEED_DIR=`pwd` NEK5K_DIR="$(abspath $(NEK5K_DIR))" nek 543 mv examples/nek/build/bps $(OBJDIR)/bps 544 cp examples/nek/nek-examples.sh $(OBJDIR)/nek-bps 545 546# Several executables have common utilities, but we can't build the utilities 547# from separate submake invocations because they'll compete with each 548# other/corrupt output. So we put it in this utility library, but we don't want 549# to manually list source dependencies up at this level, so we'll just always 550# call recursive make to check that this utility is up to date. 551examples/petsc/libutils.a.PHONY: $(libceed) $(ceed.pc) 552 +$(call quiet,MAKE) -C examples/petsc CEED_DIR=`pwd` AR=$(AR) ARFLAGS=$(ARFLAGS) \ 553 PETSC_DIR="$(abspath $(PETSC_DIR))" OPT="$(OPT)" $(basename $(@F)) 554 555$(OBJDIR)/petsc-% : examples/petsc/%.c examples/petsc/libutils.a.PHONY $(libceed) $(ceed.pc) | $$(@D)/.DIR 556 +$(call quiet,MAKE) -C examples/petsc CEED_DIR=`pwd` \ 557 PETSC_DIR="$(abspath $(PETSC_DIR))" OPT="$(OPT)" $* 558 cp examples/petsc/$* $@ 559 560$(OBJDIR)/fluids-% : examples/fluids/%.c examples/fluids/src/*.c examples/fluids/*.h examples/fluids/problems/*.c examples/fluids/qfunctions/*.h $(libceed) $(ceed.pc) | $$(@D)/.DIR 561 +$(call quiet,MAKE) -C examples/fluids CEED_DIR=`pwd` \ 562 PETSC_DIR="$(abspath $(PETSC_DIR))" OPT="$(OPT)" $* 563 cp examples/fluids/$* $@ 564 565$(OBJDIR)/solids-% : examples/solids/%.c examples/solids/%.h \ 566 examples/solids/problems/*.c examples/solids/src/*.c \ 567 examples/solids/include/*.h examples/solids/problems/*.h examples/solids/qfunctions/*.h \ 568 $(libceed) $(ceed.pc) | $$(@D)/.DIR 569 +$(call quiet,MAKE) -C examples/solids CEED_DIR=`pwd` \ 570 PETSC_DIR="$(abspath $(PETSC_DIR))" OPT="$(OPT)" $* 571 cp examples/solids/$* $@ 572 573$(examples) : $(libceed) 574$(tests) : $(libceed) 575$(tests) $(examples) : override LDFLAGS += $(if $(STATIC),,-Wl,-rpath,$(abspath $(LIBDIR))) -L$(LIBDIR) 576 577run-% : $(OBJDIR)/% 578 @$(PYTHON) tests/junit.py --mode tap $(<:$(OBJDIR)/%=%) 579 580external_examples := \ 581 $(if $(MFEM_DIR),$(mfemexamples)) \ 582 $(if $(PETSC_DIR),$(petscexamples)) \ 583 $(if $(NEK5K_DIR),$(nekexamples)) \ 584 $(if $(PETSC_DIR),$(fluidsexamples)) \ 585 $(if $(PETSC_DIR),$(solidsexamples)) 586 587allexamples = $(examples) $(external_examples) 588 589# The test and prove targets can be controlled via pattern searches. The 590# default is to run tests and those examples that have no external dependencies. 591# Examples of finer grained control: 592# 593# make test search='petsc mfem' # PETSc and MFEM examples 594# make prove search='t3' # t3xx series tests 595# make junit search='ex petsc' # core ex* and PETSc tests 596search ?= t ex 597realsearch = $(search:%=%%) 598matched = $(foreach pattern,$(realsearch),$(filter $(OBJDIR)/$(pattern),$(tests) $(allexamples))) 599 600# Test core libCEED 601test : $(matched:$(OBJDIR)/%=run-%) 602 603# Run test target in parallel 604tst : ;@$(MAKE) $(MFLAGS) V=$(V) test 605# CPU C tests only for backend % 606ctc-% : $(ctests);@$(foreach tst,$(ctests),$(tst) /cpu/$*;) 607 608prove : $(matched) 609 $(info Testing backends: $(BACKENDS)) 610 $(PROVE) $(PROVE_OPTS) --exec 'tests/junit.py --mode tap' $(matched:$(OBJDIR)/%=%) 611# Run prove target in parallel 612prv : ;@$(MAKE) $(MFLAGS) V=$(V) prove 613 614prove-all : 615 +$(MAKE) prove realsearch=% 616 617junit-% : $(OBJDIR)/% 618 @printf " %10s %s\n" TEST $(<:$(OBJDIR)/%=%); $(PYTHON) tests/junit.py $(<:$(OBJDIR)/%=%) 619 620junit : $(matched:$(OBJDIR)/%=junit-%) 621 622all: $(alltests) 623 624examples : $(allexamples) 625ceedexamples : $(examples) 626nekexamples : $(nekexamples) 627mfemexamples : $(mfemexamples) 628petscexamples : $(petscexamples) 629 630# Benchmarks 631allbenchmarks = petsc-bps 632bench_targets = $(addprefix bench-,$(allbenchmarks)) 633.PHONY: $(bench_targets) benchmarks 634$(bench_targets): bench-%: $(OBJDIR)/% 635 cd benchmarks && ./benchmark.sh --ceed "$(BACKENDS_MAKE)" -r $(*).sh 636benchmarks: $(bench_targets) 637 638$(ceed.pc) : pkgconfig-prefix = $(abspath .) 639$(OBJDIR)/ceed.pc : pkgconfig-prefix = $(prefix) 640.INTERMEDIATE : $(OBJDIR)/ceed.pc 641%/ceed.pc : ceed.pc.template | $$(@D)/.DIR 642 @$(SED) \ 643 -e "s:%prefix%:$(pkgconfig-prefix):" \ 644 -e "s:%libs_private%:$(pkgconfig-libs-private):" $< > $@ 645 646$(OBJDIR)/interface/ceed-jit-source-root-default.o : CPPFLAGS += -DCEED_JIT_SOUCE_ROOT_DEFAULT="\"$(abspath ./include)/\"" 647$(OBJDIR)/interface/ceed-jit-source-root-install.o : CPPFLAGS += -DCEED_JIT_SOUCE_ROOT_DEFAULT="\"$(abspath $(includedir))/\"" 648 649install : $(libceed) $(OBJDIR)/ceed.pc 650 $(INSTALL) -d $(addprefix $(if $(DESTDIR),"$(DESTDIR)"),"$(includedir)"\ 651 "$(includedir)/ceed/" "$(includedir)/ceed/jit-source/"\ 652 "$(includedir)/ceed/jit-source/cuda/" "$(includedir)/ceed/jit-source/hip/"\ 653 "$(includedir)/ceed/jit-source/gallery/" "$(libdir)" "$(pkgconfigdir)") 654 $(INSTALL_DATA) include/ceed/ceed.h "$(DESTDIR)$(includedir)/ceed/" 655 $(INSTALL_DATA) include/ceed/types.h "$(DESTDIR)$(includedir)/ceed/" 656 $(INSTALL_DATA) include/ceed/ceed-f32.h "$(DESTDIR)$(includedir)/ceed/" 657 $(INSTALL_DATA) include/ceed/ceed-f64.h "$(DESTDIR)$(includedir)/ceed/" 658 $(INSTALL_DATA) include/ceed/fortran.h "$(DESTDIR)$(includedir)/ceed/" 659 $(INSTALL_DATA) include/ceed/backend.h "$(DESTDIR)$(includedir)/ceed/" 660 $(INSTALL_DATA) include/ceed/cuda.h "$(DESTDIR)$(includedir)/ceed/" 661 $(INSTALL_DATA) include/ceed/hip.h "$(DESTDIR)$(includedir)/ceed/" 662 $(INSTALL_DATA) include/ceed/hash.h "$(DESTDIR)$(includedir)/ceed/" 663 $(INSTALL_DATA) include/ceed/khash.h "$(DESTDIR)$(includedir)/ceed/" 664 $(INSTALL_DATA) $(libceed) "$(DESTDIR)$(libdir)/" 665 $(INSTALL_DATA) $(OBJDIR)/ceed.pc "$(DESTDIR)$(pkgconfigdir)/" 666 $(INSTALL_DATA) include/ceed.h "$(DESTDIR)$(includedir)/" 667 $(INSTALL_DATA) include/ceedf.h "$(DESTDIR)$(includedir)/" 668 $(INSTALL_DATA) $(wildcard include/ceed/jit-source/cuda/*.h) "$(DESTDIR)$(includedir)/ceed/jit-source/cuda/" 669 $(INSTALL_DATA) $(wildcard include/ceed/jit-source/hip/*.h) "$(DESTDIR)$(includedir)/ceed/jit-source/hip/" 670 $(INSTALL_DATA) $(wildcard include/ceed/jit-source/gallery/*.h) "$(DESTDIR)$(includedir)/ceed/jit-source/gallery/" 671 672.PHONY : all cln clean doxygen doc lib install par print test tst prove prv prove-all junit examples style style-c style-py tidy iwyu info info-backends info-backends-all 673 674cln clean : 675 $(RM) -r $(OBJDIR) $(LIBDIR) dist *egg* .pytest_cache *cffi* 676 $(call quiet,MAKE) -C examples clean NEK5K_DIR="$(abspath $(NEK5K_DIR))" 677 $(call quiet,MAKE) -C python/tests clean 678 $(RM) benchmarks/*output.txt 679 680distclean : clean 681 $(RM) -r doc/html doc/sphinx/build $(CONFIG) 682 683DOXYGEN ?= doxygen 684doxygen : 685 $(DOXYGEN) -q Doxyfile 686 687doc-html doc-latexpdf doc-epub doc-livehtml : doc-% : doxygen 688 make -C doc/sphinx $* 689 690doc : doc-html 691 692style-c : 693 @astyle --options=.astylerc \ 694 $(filter-out include/ceedf.h $(wildcard tests/t*-f.h), \ 695 $(wildcard include/*.h interface/*.[ch] tests/*.[ch] backends/*/*.[ch] \ 696 examples/*/*/*.[ch] examples/*/*.[ch] examples/*/*.[ch]pp gallery/*/*.[ch])) 697 698AUTOPEP8 = autopep8 699style-py : AUTOPEP8_ARGS = --in-place --aggressive 700style-py : 701 @$(AUTOPEP8) $(AUTOPEP8_ARGS) $(wildcard *.py python**/*.py python/tests/*.py examples**/*.py doc/sphinx/source**/*.py benchmarks/*.py) 702 703style : style-c style-py 704 705CLANG_TIDY ?= clang-tidy 706 707%.c.tidy : %.c 708 $(CLANG_TIDY) $(TIDY_OPTS) $^ -- $(CPPFLAGS) --std=c99 -I$(CUDA_DIR)/include -I$(HIP_DIR)/include -DCEED_JIT_SOUCE_ROOT_DEFAULT="\"$(abspath ./include)/\"" 709 710%.cpp.tidy : %.cpp 711 $(CLANG_TIDY) $(TIDY_OPTS) $^ -- $(CPPFLAGS) --std=c++11 -I$(CUDA_DIR)/include -I$(OCCA_DIR)/include -I$(HIP_DIR)/include 712 713tidy_c : $(libceed.c:%=%.tidy) 714tidy_cpp : $(libceed.cpp:%=%.tidy) 715 716tidy : tidy_c tidy_cpp 717 718ifneq ($(wildcard ../iwyu/*),) 719 IWYU_DIR ?= ../iwyu 720 IWYU_CC ?= $(IWYU_DIR)/build/bin/include-what-you-use 721endif 722 723iwyu : CC=$(IWYU_CC) 724iwyu : lib 725 726print : 727 @echo $(VAR)=$($(VAR)) 728 729print-% : 730 $(info [ variable name]: $*) 731 $(info [ origin]: $(origin $*)) 732 $(info [ flavor]: $(flavor $*)) 733 $(info [ value]: $(value $*)) 734 $(info [expanded value]: $($*)) 735 $(info ) 736 @true 737 738# "make configure" detects any variables passed on the command line or 739# previously set in config.mk, caching them in config.mk as simple 740# (:=) variables. Variables set in config.mk or on the command line 741# take precedence over the defaults provided in the file. Typical 742# usage: 743# 744# make configure CC=/path/to/my/cc CUDA_DIR=/opt/cuda 745# make 746# make prove 747# 748# The values in the file can be updated by passing them on the command 749# line, e.g., 750# 751# make configure CC=/path/to/other/clang 752 753# All variables to consider for caching 754CONFIG_VARS = CC CXX FC NVCC NVCC_CXX HIPCC \ 755 OPT CFLAGS CPPFLAGS CXXFLAGS FFLAGS NVCCFLAGS HIPCCFLAGS \ 756 AR ARFLAGS LDFLAGS LDLIBS LIBCXX SED \ 757 MAGMA_DIR OCCA_DIR XSMM_DIR CUDA_DIR CUDA_ARCH MFEM_DIR PETSC_DIR NEK5K_DIR HIP_DIR HIP_ARCH 758 759# $(call needs_save,CFLAGS) returns true (a nonempty string) if CFLAGS 760# was set on the command line or in config.mk (where it will appear as 761# a simple variable). 762needs_save = $(or $(filter command line,$(origin $(1))),$(filter simple,$(flavor $(1)))) 763 764configure : 765 $(file > $(CONFIG)) 766 $(foreach v,$(CONFIG_VARS),$(if $(call needs_save,$(v)),$(file >> $(CONFIG),$(v) := $($(v))))) 767 @echo "Configuration cached in $(CONFIG):" 768 @cat $(CONFIG) 769 770wheel : export MARCHFLAG = -march=generic 771wheel : export WHEEL_PLAT = manylinux2010_x86_64 772wheel : 773 docker run -it --user $(shell id -u):$(shell id -g) --rm -v $(PWD):/io -w /io \ 774 -e MARCHFLAG -e WHEEL_PLAT \ 775 quay.io/pypa/$(WHEEL_PLAT) python/make-wheels.sh 776 777.PHONY : configure wheel 778 779# Include *.d deps when not -B = --always-make: useful if the paths are wonky in a container 780-include $(if $(filter B,$(MAKEFLAGS)),,$(libceed.c:%.c=$(OBJDIR)/%.d) $(tests.c:tests/%.c=$(OBJDIR)/%.d)) 781