1*777ff853SJeremy L Thompson# Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at 2*777ff853SJeremy L Thompson# the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights 3*777ff853SJeremy L Thompson# reserved. See files LICENSE and NOTICE for details. 4*777ff853SJeremy L Thompson# 5*777ff853SJeremy L Thompson# This file is part of CEED, a collection of benchmarks, miniapps, software 6*777ff853SJeremy L Thompson# libraries and APIs for efficient high-order finite element and spectral 7*777ff853SJeremy L Thompson# element discretizations for exascale applications. For more information and 8*777ff853SJeremy L Thompson# source code availability see http://github.com/ceed. 9*777ff853SJeremy L Thompson# 10*777ff853SJeremy L Thompson# The CEED research is supported by the Exascale Computing Project 17-SC-20-SC, 11*777ff853SJeremy L Thompson# a collaborative effort of two U.S. Department of Energy organizations (Office 12*777ff853SJeremy L Thompson# of Science and the National Nuclear Security Administration) responsible for 13*777ff853SJeremy L Thompson# the planning and preparation of a capable exascale ecosystem, including 14*777ff853SJeremy L Thompson# software, applications, hardware, advanced system engineering and early 15*777ff853SJeremy L Thompson# testbed platforms, in support of the nation's exascale computing imperative. 16*777ff853SJeremy L Thompson 17*777ff853SJeremy L ThompsonCOMMON ?= ../../common.mk 18*777ff853SJeremy L Thompson-include $(COMMON) 19*777ff853SJeremy L Thompson 202f4d9adbSJeremy L Thompson# Note: PETSC_ARCH can be undefined or empty for installations which do not use 212f4d9adbSJeremy L Thompson# PETSC_ARCH - for example when using PETSc installed through Spack. 229f8a8fa0SJed BrownPETSc.pc := $(PETSC_DIR)/$(PETSC_ARCH)/lib/pkgconfig/PETSc.pc 236ea7c6c1SJed BrownCEED_DIR ?= ../.. 246ea7c6c1SJed Brownceed.pc := $(CEED_DIR)/lib/pkgconfig/ceed.pc 259f8a8fa0SJed Brown 26c0c38e35SVeselin DobrevCC = $(call pkgconf, --variable=ccompiler $(PETSc.pc) $(ceed.pc)) 2728b8c626SJed BrownCFLAGS = -std=c99 $(call pkgconf, --variable=cflags_extra $(PETSc.pc)) $(call pkgconf, --cflags-only-other $(PETSc.pc)) $(OPT) 28c0c38e35SVeselin DobrevCPPFLAGS = $(call pkgconf, --cflags-only-I $(PETSc.pc) $(ceed.pc)) 29c0c38e35SVeselin DobrevLDFLAGS = $(call pkgconf, --libs-only-L --libs-only-other $(PETSc.pc) $(ceed.pc)) 30c0c38e35SVeselin DobrevLDFLAGS += $(patsubst -L%, $(call pkgconf, --variable=ldflag_rpath $(PETSc.pc))%, $(call pkgconf, --libs-only-L $(PETSc.pc) $(ceed.pc))) 31c0c38e35SVeselin DobrevLDLIBS = $(call pkgconf, --libs-only-l $(PETSc.pc) $(ceed.pc)) -lm 329f8a8fa0SJed Brown 33dc7d240cSValeria Barraarea.c := area.c 34dc7d240cSValeria Barraarea := $(area.c:%.c=%) 35cb32e2e7SValeria Barra 360c59ef15SJeremy L Thompsonbps.c := bps.c 370c59ef15SJeremy L Thompsonbps := $(bps.c:%.c=%) 389f8a8fa0SJed Brown 39dc7d240cSValeria Barrabpsraw.c := bpsraw.c 40dc7d240cSValeria Barrabpsraw := $(bpsraw.c:%.c=%) 41dc7d240cSValeria Barra 42ed264d09SValeria Barrabpssphere.c := bpssphere.c 43ed264d09SValeria Barrabpssphere := $(bpssphere.c:%.c=%) 44ed264d09SValeria Barra 456c5df90dSjeremyltmultigrid.c := multigrid.c 466c5df90dSjeremyltmultigrid := $(multigrid.c:%.c=%) 476c5df90dSjeremylt 48ed264d09SValeria Barraall: $(area) $(bps) $(bpsraw) $(bpssphere) $(multigrid) 49dc7d240cSValeria Barra$(area): | $(PETSc.pc) $(ceed.pc) 500c59ef15SJeremy L Thompson$(bps): | $(PETSc.pc) $(ceed.pc) 51dc7d240cSValeria Barra$(bpsraw): | $(PETSc.pc) $(ceed.pc) 52ed264d09SValeria Barra$(bpssphere): | $(PETSc.pc) $(ceed.pc) 536c5df90dSjeremylt$(multigrid): | $(PETSc.pc) $(ceed.pc) 549f8a8fa0SJed Brown 55*777ff853SJeremy L Thompson# Quiet, color output 56*777ff853SJeremy L Thompsonquiet ?= $($(1)) 57*777ff853SJeremy L Thompson 5833795f53Sjeremylt# Rules for building the examples 5933795f53Sjeremylt%: %.c 60*777ff853SJeremy L Thompson $(call quiet,CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(CEED_LDFLAGS) $(abspath $<) -o $@ \ 6133795f53Sjeremylt $(LDLIBS) 6233795f53Sjeremylt 63c0c38e35SVeselin Dobrevprint: $(PETSc.pc) $(ceed.pc) 649f8a8fa0SJed Brown $(info CC : $(CC)) 659f8a8fa0SJed Brown $(info CFLAGS : $(CFLAGS)) 669f8a8fa0SJed Brown $(info CPPFLAGS: $(CPPFLAGS)) 679f8a8fa0SJed Brown $(info LDFLAGS : $(LDFLAGS)) 689f8a8fa0SJed Brown $(info LDLIBS : $(LDLIBS)) 69c0c38e35SVeselin Dobrev @true 709f8a8fa0SJed Brown 719f8a8fa0SJed Brownclean: 72ed264d09SValeria Barra $(RM) $(area) $(bps) $(bpsraw) $(bpssphere) $(multigrid) 739f8a8fa0SJed Brown 74c0c38e35SVeselin Dobrev$(PETSc.pc): 7508779805SVeselin Dobrev $(if $(wildcard $@),,$(error \ 766f87d196Sjeremylt PETSc config not found at $@. Please set PETSC_DIR and PETSC_ARCH)) 77c0c38e35SVeselin Dobrev 789f8a8fa0SJed Brown.PHONY: all print clean 79c0c38e35SVeselin Dobrev 80c0c38e35SVeselin Dobrevpkgconf = $(shell pkg-config $1 | sed -e 's/^"//g' -e 's/"$$//g') 81