1ea10196cSJeremy L Thompson# Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at 2ea10196cSJeremy L Thompson# the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights 3ea10196cSJeremy L Thompson# reserved. See files LICENSE and NOTICE for details. 4ea10196cSJeremy L Thompson# 5ea10196cSJeremy L Thompson# This file is part of CEED, a collection of benchmarks, miniapps, software 6ea10196cSJeremy L Thompson# libraries and APIs for efficient high-order finite element and spectral 7ea10196cSJeremy L Thompson# element discretizations for exascale applications. For more information and 8ea10196cSJeremy L Thompson# source code availability see http://github.com/ceed. 9ea10196cSJeremy L Thompson# 10ea10196cSJeremy L Thompson# The CEED research is supported by the Exascale Computing Project (17-SC-20-SC) 11ea10196cSJeremy L Thompson# a collaborative effort of two U.S. Department of Energy organizations (Office 12ea10196cSJeremy L Thompson# of Science and the National Nuclear Security Administration) responsible for 13ea10196cSJeremy L Thompson# the planning and preparation of a capable exascale ecosystem, including 14ea10196cSJeremy L Thompson# software, applications, hardware, advanced system engineering and early 15ea10196cSJeremy L Thompson# testbed platforms, in support of the nation's exascale computing imperative. 16ea10196cSJeremy L Thompson 17*4f863122SJeremy L ThompsonCOMMON ?= ../../common.mk 18*4f863122SJeremy L Thompson-include $(COMMON) 19*4f863122SJeremy L Thompson 20ea10196cSJeremy L ThompsonPETSc.pc := $(PETSC_DIR)/$(PETSC_ARCH)/lib/pkgconfig/PETSc.pc 21ea10196cSJeremy L ThompsonCEED_DIR ?= ../.. 22ea10196cSJeremy L Thompsonceed.pc := $(CEED_DIR)/lib/pkgconfig/ceed.pc 23ea10196cSJeremy L Thompson 24ea10196cSJeremy L ThompsonCC = $(call pkgconf, --variable=ccompiler $(PETSc.pc) $(ceed.pc)) 25ea10196cSJeremy L ThompsonCFLAGS = -std=c99 $(call pkgconf, --variable=cflags_extra $(PETSc.pc)) $(call pkgconf, --cflags-only-other $(PETSc.pc)) $(OPT) -Wno-unused-variable 26ea10196cSJeremy L ThompsonCPPFLAGS = $(call pkgconf, --cflags-only-I $(PETSc.pc) $(ceed.pc)) 27ea10196cSJeremy L ThompsonLDFLAGS = $(call pkgconf, --libs-only-L --libs-only-other $(PETSc.pc) $(ceed.pc)) 28ea10196cSJeremy L ThompsonLDFLAGS += $(patsubst -L%, $(call pkgconf, --variable=ldflag_rpath $(PETSc.pc))%, $(call pkgconf, --libs-only-L $(PETSc.pc) $(ceed.pc))) 29ea10196cSJeremy L ThompsonLDLIBS = $(call pkgconf, --libs-only-l $(PETSc.pc) $(ceed.pc)) -lm 30ea10196cSJeremy L Thompson 31ea10196cSJeremy L Thompsonnavierstokes.c := $(wildcard navierstokes*.c) 32ea10196cSJeremy L Thompsonnavierstokes := $(navierstokes.c:%.c=%) 33ea10196cSJeremy L Thompson 34ea10196cSJeremy L Thompsonall: $(navierstokes) 35ea10196cSJeremy L Thompson$(navierstokes): | $(PETSc.pc) $(ceed.pc) 36ea10196cSJeremy L Thompson 37*4f863122SJeremy L Thompson# Quiet, color output 38*4f863122SJeremy L Thompsonquiet ?= $($(1)) 39*4f863122SJeremy L Thompson 40ea10196cSJeremy L Thompson# Rules for building the example 41ea10196cSJeremy L Thompson%: %.c 42*4f863122SJeremy L Thompson $(call quiet,CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(CEED_LDFLAGS) $(abspath $<) -o $@ $(LDLIBS) 43ea10196cSJeremy L Thompson 44ea10196cSJeremy L Thompsonprint: $(PETSc.pc) $(ceed.pc) 45ea10196cSJeremy L Thompson $(info CC : $(CC)) 46ea10196cSJeremy L Thompson $(info CFLAGS : $(CFLAGS)) 47ea10196cSJeremy L Thompson $(info CPPFLAGS: $(CPPFLAGS)) 48ea10196cSJeremy L Thompson $(info LDFLAGS : $(LDFLAGS)) 49ea10196cSJeremy L Thompson $(info LDLIBS : $(LDLIBS)) 50ea10196cSJeremy L Thompson $(info OPT : $(OPT)) 51ea10196cSJeremy L Thompson @true 52ea10196cSJeremy L Thompson 53ea10196cSJeremy L Thompsonclean: 54ea10196cSJeremy L Thompson $(RM) $(navierstokes) *.vtr *.vts *.vtu *.bin* 55ea10196cSJeremy L Thompson 56ea10196cSJeremy L Thompson$(PETSc.pc): 57ea10196cSJeremy L Thompson $(if $(wildcard $@),,$(error \ 58ea10196cSJeremy L Thompson PETSc config not found. Please set PETSC_DIR and PETSC_ARCH)) 59ea10196cSJeremy L Thompson 60ea10196cSJeremy L Thompson.PHONY: all print clean 61ea10196cSJeremy L Thompson 62ea10196cSJeremy L Thompsonpkgconf = $(shell pkg-config $1 | sed -e 's/^"//g' -e 's/"$$//g') 63