forked from ariannachiesa/Organic2D_project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (50 loc) · 2.12 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
BUILD_DIR ?= ./build
SRC_DIRS ?= ./src
all: $(BUILD_DIR)/test1_mesh $(BUILD_DIR)/test2_mesh $(BUILD_DIR)/test3_mesh $(BUILD_DIR)/test_Laplace \
$(BUILD_DIR)/test_LinPoisson $(BUILD_DIR)/test1_NLPoisson $(BUILD_DIR)/test2_NLPoisson $(BUILD_DIR)/test_CVcurve
# Directory where Bim++ is installed.
BIMPP_PREFIX = /vagrant/bimpp_install
SRCS := $(shell find $(SRC_DIRS) -name '*.cpp')
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
mkOctaveInc = ${mkOctavePrefix}/include/octave-4.2.0/
mkOctaveLib = ${mkOctavePrefix}/lib/octave/4.2.0/
mkP4estInc = /vagrant/p4est/include
mkP4estLib = /vagrant/p4est/lib
CPPFLAGS = -I./src/ -I$(BIMPP_PREFIX)/include \
-I$(mkP4estInc) -I$(mkOctaveInc) -I$(mkOctaveInc)/octave -I${mkMumpsInc}
CXXFLAGS = -Wall -std=c++14
CXX = mpic++
LIBS = $(BIMPP_PREFIX)/lib ${mkOpenblasLib} \
$(mkP4estLib) $(mkOctaveLib) ${mkOpenblasLib} \
${mkMumpsLib} ${mkScotchLib}
comma := ,
LDFLAGS = $(addprefix -Wl$(comma)-rpath$(comma), $(LIBS)) \
$(addprefix -L, $(LIBS))
LDLIBS = -lbim -lbimio -lbimlis \
-lp4est -lsc \
-lbimmumps -lbimp4est \
-lopenblas -loctave -loctinterp \
-lopenblas -lptscotcherr
$(BUILD_DIR)/test1_mesh: $(OBJS) $(BUILD_DIR)/test/test1_mesh.cpp.o
$(CXX) $^ -o $@ $(LDFLAGS) $(LDLIBS)
$(BUILD_DIR)/test2_mesh: $(OBJS) $(BUILD_DIR)/test/test2_mesh.cpp.o
$(CXX) $^ -o $@ $(LDFLAGS) $(LDLIBS)
$(BUILD_DIR)/test3_mesh: $(OBJS) $(BUILD_DIR)/test/test3_mesh.cpp.o
$(CXX) $^ -o $@ $(LDFLAGS) $(LDLIBS)
$(BUILD_DIR)/test_Laplace: $(OBJS) $(BUILD_DIR)/test/test_Laplace.cpp.o
$(CXX) $^ -o $@ $(LDFLAGS) $(LDLIBS)
$(BUILD_DIR)/test_LinPoisson: $(OBJS) $(BUILD_DIR)/test/test_LinPoisson.cpp.o
$(CXX) $^ -o $@ $(LDFLAGS) $(LDLIBS)
$(BUILD_DIR)/test1_NLPoisson: $(OBJS) $(BUILD_DIR)/test/test1_NLPoisson.cpp.o
$(CXX) $^ -o $@ $(LDFLAGS) $(LDLIBS)
$(BUILD_DIR)/test2_NLPoisson: $(OBJS) $(BUILD_DIR)/test/test2_NLPoisson.cpp.o
$(CXX) $^ -o $@ $(LDFLAGS) $(LDLIBS)
$(BUILD_DIR)/test_CVcurve: $(OBJS) $(BUILD_DIR)/test/test_CVcurve.cpp.o
$(CXX) $^ -o $@ $(LDFLAGS) $(LDLIBS)
$(BUILD_DIR)/%.cpp.o: %.cpp
$(MKDIR_P) $(dir $@)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
.PHONY: clean
clean:
$(RM) -r $(BUILD_DIR)
MKDIR_P ?= mkdir -p