-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.common
executable file
·95 lines (75 loc) · 1.94 KB
/
Makefile.common
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
85
86
87
88
89
90
91
92
93
94
95
SHELL = /bin/sh
CC=clang++
# Common flags:
FLAGS = -std=c++11 -g -O3 -pedantic -fPIC \
-Wall -Werror=int-conversion -Werror=implicit \
-Werror=return-type -Werror=uninitialized -Weffc++
ifeq ($(CC),g++)
FLAGS += -frounding-math
endif
ifeq ($(CC),clang++)
FLAGS += -Wno-missing-braces
endif
PY_DIR = "/usr/include/python3.6m/"
LAMMPS_DIR = "/home/stefan/projects/lammps-mine/src/"
TIMER_DIR = "$(HOME)/projects/my_timer/lib/"
GSD_DIR = "/usr/local/lib/"
LNK = -L./ -lm -shared -L/usr/lib/openmpi/
INC = -I./ -I$(PY_DIR)
EXT = cpp
SRC = $(wildcard cpp_lib/*.$(EXT))
SRC += $(wildcard c_interface/*.$(EXT))
# Conditional flags:
ifeq ($(USE_OMP), 1)
FLAGS += -DUSE_OPENMP -fopenmp
endif
ifeq ($(USE_EXCEPTIONS), 1)
FLAGS += -DUSE_EXCEPTIONS
endif
ifeq ($(HAVE_LIB_CGAL), 1)
LNK += -lCGAL -lgmp
FLAGS += -DHAVE_LIB_CGAL
endif
ifeq ($(VERBOSE_LIB), 1)
FLAGS += -DVERBOSE_LIB
endif
ifeq ($(HAVE_LIB_ICP), 1)
FLAGS += -DHAVE_LIB_ICP -I./libicp/ -I./libicp/src/
SRC += $(wildcard ./libicp/src/*.$(EXT))
endif
ifeq ($(HAVE_LIB_LAMMPS), 1)
# LAMMPS-features depend on MPI, so then it needs to be compiled with mpicxx
CC = mpicxx
LNK += -lmpi -lmpi_cxx -llammps
FLAGS += -DHAVE_LIB_LAMMPS
INC += -I$(LAMMPS_DIR)
LMP_SRC := $(shell ls $(LAMMPS_DIR)/manifold_*.$(EXT) | grep -v rattle)
SRC += $(LMP_SRC)
endif
ifeq ($(HAVE_LIB_ARMADILLO), 1)
LNK += -larmadillo
endif
ifeq ($(HAVE_LIB_GSD), 1)
FLAGS += -DHAVE_GSD
INC += -I./gsd/
LNK += -L./gsd -L$(GSD_DIR) -lgsd
endif
ifeq ($(HAVE_BOOST_GZIP), 1)
FLAGS += -DHAVE_BOOST_GZIP
LNK += -lboost_iostreams
endif
COMP = $(CC) $(FLAGS) $(INC)
LINK = $(CC) $(FLAGS) $(INC) $(LNK)
AR = ar rcs
OBJ_DIR = obj
OBJ = $(SRC:%.$(EXT)=$(OBJ_DIR)$(S)%.o)
OBJ_DIRS = $(dir $(OBJ))
DEPS = $(OBJ:%.o=%.d)
OBJ_GUARD = $(OBJ_DIR)$(S).guard
# For windows:
#MAKE_DIR = $(if exist $(1),,mkdir $(1))
#S=\\
# Linux and Unix-like:
MAKE_DIR = mkdir -p $(1)
S=/
LIB_DIR=/usr/local/lib