-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
85 lines (65 loc) · 2.47 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
CXX=g++ # requires g++-8 or newer / icpc (with gcc compatibility 7.5 or newer) / clang++ with llvm-10 or newer
CXXFLAGS = -std=c++11 -fopenmp -Wall -Wfloat-conversion # need C++11 and OpenMP
SCTL_DIR=extern/SCTL
CXXFLAGS += -I${SCTL_DIR}/include
#Optional flags
DEBUG ?= 0
ifeq ($(DEBUG), 1)
CXXFLAGS += -O0 -fsanitize=address,leak,undefined,pointer-compare,pointer-subtract,float-divide-by-zero,float-cast-overflow -fno-sanitize-recover=all -fstack-protector # debug build
CXXFLAGS += -DSCTL_MEMDEBUG # Enable memory checks
else
CXXFLAGS += -O3 -march=native -DNDEBUG # release build
endif
OS = $(shell uname -s)
ifeq "$(OS)" "Darwin"
CXXFLAGS += -g -rdynamic -Wl,-no_pie # for stack trace (on Mac)
else
CXXFLAGS += -gdwarf-4 -g -rdynamic # for stack trace
endif
CXXFLAGS += -DSCTL_GLOBAL_MEM_BUFF=0 # Global memory buffer size in MB
CXXFLAGS += -DSCTL_PROFILE=5 -DSCTL_VERBOSE # Enable profiling
CXXFLAGS += -DSCTL_SIG_HANDLER
#CXXFLAGS += -DSCTL_QUAD_T=__float128 # Enable quadruple precision
CXXFLAGS += -lblas -DSCTL_HAVE_BLAS # use BLAS
CXXFLAGS += -llapack -DSCTL_HAVE_LAPACK # use LAPACK
#CXXFLAGS += -qmkl -DSCTL_HAVE_BLAS -DSCTL_HAVE_LAPACK -DSCTL_HAVE_FFTW3_MKL # use MKL BLAS, LAPACK and FFTW (Intel compiler)
#CXXFLAGS += -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -DSCTL_HAVE_BLAS -DSCTL_HAVE_LAPACK # use MKL BLAS and LAPACK (non-Intel compiler)
#CXXFLAGS += -lfftw3_omp -DSCTL_FFTW_THREADS
#CXXFLAGS += -lfftw3 -DSCTL_HAVE_FFTW
#CXXFLAGS += -lfftw3f -DSCTL_HAVE_FFTWF
#CXXFLAGS += -lfftw3l -DSCTL_HAVE_FFTWL
CXXFLAGS += -DSCTL_HAVE_LIBMVEC
#CXXFLAGS += -DSCTL_HAVE_SVML
#CXXFLAGS += -I${PETSC_DIR}/include -I${PETSC_DIR}/../include -DSCTL_HAVE_PETSC
#LDLIBS += -L${PETSC_DIR}/lib -lpetsc
RM = rm -f
MKDIRS = mkdir -p
BINDIR = ./bin
SRCDIR = ./src
OBJDIR = ./obj
INCDIR = ./include
TARGET_BIN = \
$(BINDIR)/table1 \
$(BINDIR)/table3 \
$(BINDIR)/table4 \
$(BINDIR)/table5 \
$(BINDIR)/table6 \
$(BINDIR)/table7 \
$(BINDIR)/example1 \
$(BINDIR)/quadrature-example \
$(BINDIR)/force-free-fields-example \
$(BINDIR)/double-layer-convergence \
$(BINDIR)/virtual-casing-principle
.PHONY: all clean
all : $(TARGET_BIN)
$(BINDIR)/%: $(OBJDIR)/%.o
-@$(MKDIRS) $(dir $@)
$(CXX) $^ $(CXXFLAGS) $(LDLIBS) -o $@
ifeq "$(OS)" "Darwin"
/usr/bin/dsymutil $@ -o $@.dSYM
endif
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
-@$(MKDIRS) $(dir $@)
$(CXX) $(CXXFLAGS) -I$(INCDIR) -c $^ -o $@
clean:
$(RM) -r $(BINDIR)/* $(OBJDIR)/*