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 22DARWIN := $(filter Darwin,$(shell uname -s)) 23SO_EXT := $(if $(DARWIN),dylib,so) 24 25libceed := libceed.$(SO_EXT) 26libceed.c := $(wildcard ceed*.c) 27tests.c := $(sort $(wildcard t/t[0-9][0-9]-*.c)) 28tests := $(tests.c:%.c=%) 29examples.c := $(sort $(wildcard examples/*.c)) 30examples := $(examples.c:%.c=%) 31 32.SUFFIXES: 33.SUFFIXES: .c .o .d 34 35$(libceed) : $(libceed.c:%.c=%.o) 36 $(CC) $(LDFLAGS) -shared -o $@ $^ $(LDLIBS) 37 38$(tests) $(examples) : $(libceed) 39$(tests) $(examples) : LDFLAGS += -Wl,-rpath,. -L. 40t/t% : t/t%.c $(libceed) 41examples/% : examples/%.c $(libceed) 42 43run-t% : t/t% 44 @./tap.sh $(<:t/%=%) 45 46test : $(tests:t/%=run-%) 47 48examples : $(examples) 49 50.PHONY: clean print test examples astyle 51clean : 52 $(RM) *.o t/*.o *.d t/*.d $(libceed) $(tests.c:%.c=%) 53 $(RM) -r *.dSYM 54 55astyle : 56 @git diff --stat --exit-code HEAD || ( printf "error: Cannot run astyle in dirty tree.\nAborting.\n"; false ) 57 astyle --style=google --indent=spaces=2 --max-code-length=96 \ 58 --keep-one-line-statements --keep-one-line-blocks --lineend=linux \ 59 --suffix=none --preserve-date --formatted *.[ch] t/*.[ch] examples/*.[ch] 60 61 62print : 63 @echo $(VAR)=$($(VAR)) 64 65print-%: 66 $(info [ variable name]: $*) 67 $(info [ origin]: $(origin $*)) 68 $(info [ value]: $(value $*)) 69 $(info [expanded value]: $($*)) 70 $(info ) 71 @true 72 73-include $(libceed.c:%.c=%.d) $(tests.c:%.c=%.d) 74