1# Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at 2# the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights 3# reserved. See files LICENSE and NOTICE for details. 4# 5# This file is part of CEED, a collection of benchmarks, miniapps, software 6# libraries and APIs for efficient high-order finite element and spectral 7# element discretizations for exascale applications. For more information and 8# source code availability see http://github.com/ceed. 9# 10# The CEED research is supported by the Exascale Computing Project 17-SC-20-SC, 11# a collaborative effort of two U.S. Department of Energy organizations (Office 12# of Science and the National Nuclear Security Administration) responsible for 13# the planning and preparation of a capable exascale ecosystem, including 14# software, applications, hardware, advanced system engineering and early 15# testbed platforms, in support of the nation's exascale computing imperative. 16 17CFLAGS = -std=c99 -Wall -Wextra -Wno-unused-parameter -fPIC -MMD -MP 18CFLAGS += $(if $(NDEBUG),-O2,-g) 19CPPFLAGS = -I. 20LDLIBS = -lm 21 22PROVE ?= prove 23DARWIN := $(filter Darwin,$(shell uname -s)) 24SO_EXT := $(if $(DARWIN),dylib,so) 25 26libceed := libceed.$(SO_EXT) 27libceed.c := $(wildcard ceed*.c) 28tests.c := $(sort $(wildcard tests/t[0-9][0-9]-*.c)) 29tests := $(tests.c:%.c=%) 30examples.c := $(sort $(wildcard examples/*.c)) 31examples := $(examples.c:%.c=%) 32 33.SUFFIXES: 34.SUFFIXES: .c .o .d 35 36$(libceed) : $(libceed.c:%.c=%.o) 37 $(CC) $(LDFLAGS) -shared -o $@ $^ $(LDLIBS) 38 39$(tests) $(examples) : $(libceed) 40$(tests) $(examples) : LDFLAGS += -Wl,-rpath,. -L. 41tests/t% : tests/t%.c $(libceed) 42examples/% : examples/%.c $(libceed) 43 44run-t% : tests/t% 45 @tests/tap.sh $(<:tests/%=%) 46 47test : $(tests:tests/%=run-%) 48 49prove : $(tests) 50 $(PROVE) --exec tests/tap.sh $(CEED_PROVE_OPTS) $(tests:tests/%=%) 51 52examples : $(examples) 53 54.PHONY: clean print test examples astyle 55clean : 56 $(RM) *.o tests/*.o *.d tests/*.d $(libceed) $(tests.c:%.c=%) 57 $(RM) -r *.dSYM 58 59astyle : 60 astyle --style=google --indent=spaces=2 --max-code-length=80 \ 61 --keep-one-line-statements --keep-one-line-blocks --lineend=linux \ 62 --suffix=none --preserve-date --formatted \ 63 *.[ch] tests/*.[ch] examples/*.[ch] 64 65 66print : 67 @echo $(VAR)=$($(VAR)) 68 69print-%: 70 $(info [ variable name]: $*) 71 $(info [ origin]: $(origin $*)) 72 $(info [ value]: $(value $*)) 73 $(info [expanded value]: $($*)) 74 $(info ) 75 @true 76 77-include $(libceed.c:%.c=%.d) $(tests.c:%.c=%.d) 78