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