-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
114 lines (94 loc) · 3.05 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
EXE = Heat++
TEST_EXE = TestHeat++
SRC_DIR = src
TEST_SRC_DIR = test/src
OBJ_DIR = obj
TEST_OBJ_DIR = test/obj
BIN_DIR = bin
TEST_BIN_DIR = test/bin
TEST_LIB_DIR = test/lib
SRC = $(wildcard $(SRC_DIR)/*.cpp)
TEST_SRC = $(wildcard $(TEST_SRC_DIR)/*.cpp)
OBJ = $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRC))
OBJ_WITHOUT_MAIN = $(filter-out $(OBJ_DIR)/main.o, $(OBJ))
TEST_OBJ = $(patsubst $(TEST_SRC_DIR)/%.cpp,$(TEST_OBJ_DIR)/%.o,$(TEST_SRC))
BIN = $(wildcard $(BIN_DIR)/*.out)
TEST_BIN = $(wildcard $(TEST_BIN_DIR)/*.out)
LIB = -llapack -lblas -lboost_program_options
TEST_LIB = $(wildcard $(TEST_LIB_DIR)/*.a)
# CXX = g++
CXX = mpicxx
RUN = mpirun -np 2
CXXFLAGS += -std=c++11 -Wall -O2
TEST_CXXFLAGS += -pthread
INC = -Iinclude
TEST_INC = -Itest/include/
default: compile
all: compile
compile: $(EXE)
$(EXE): $(OBJ)
$(CXX) $^ -o $(BIN_DIR)/$@.out $(LIB)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
$(CXX) $(CXXFLAGS) $(INC) -c $< -o $@
# test: $(TEST_EXE)
#
# $(TEST_EXE): $(TEST_OBJ) $(OBJ_WITHOUT_MAIN)
# $(CXX) $^ -o $(TEST_BIN_DIR)/$@.out $(TEST_LIB) $(LIB)
#
# $(TEST_OBJ_DIR)/%.o: $(TEST_SRC_DIR)/%.cpp
# $(CXX) $(CXXFLAGS) $(TEST_CXXFLAGS) $(TEST_INC) $(INC) -c $< -o $@
travis: $(TEST_EXE)
$(TEST_EXE): $(TEST_OBJ) $(OBJ_WITHOUT_MAIN)
$(CXX) $^ -o $(TEST_BIN_DIR)/$@.out -lgtest $(LIB)
$(TEST_OBJ_DIR)/%.o: $(TEST_SRC_DIR)/%.cpp
$(CXX) $(CXXFLAGS) $(TEST_CXXFLAGS) $(INC) -c $< -o $@
debug: CXXFLAGS += -DDEBUG -g
debug: $(EXE)
.PHONY: c1
c1:
$(BIN) -A 0.0 --left-height 1.0 --right-height 1.0 -L 2.0 -T 0.2 \
--k-xx 250.0 --k-xy 0.0 --k-yy 250.0 \
--n-x 60 --n-y 40 \
--flux-location right --flux-value 2500.0 \
--temp-location left --temp-value 10.0
.PHONY: c2
c2:
$(BIN) -A 0.0 --left-height 1.0 --right-height 1.0 -L 2.0 -T 0.2 \
--k-xx 250.0 --k-xy 0.0 --k-yy 250.0 \
--n-x 10 --n-y 5 \
--flux-location top --flux-value 2500.0 \
--temp-location bottom --temp-value 10.0
.PHONY: c3
c3:
$(BIN) -A 0.25 --left-height 1.0 --right-height 1.3 -L 3.0 -T 0.2 \
--k-xx 250.0 --k-xy 0.0 --k-yy 250.0 \
--n-x 15 --n-y 8 \
--flux-location bottom --flux-value -5000.0 \
--temp-location left --temp-value -20.0
.PHONY: c1p
c1p:
$(RUN) $(BIN) -A 0.0 --left-height 1.0 --right-height 1.0 -L 2.0 -T 0.2 \
--k-xx 250.0 --k-xy 0.0 --k-yy 250.0 \
--n-x 10 --n-y 5 \
--flux-location right --flux-value 2500.0 \
--temp-location left --temp-value 10.0
.PHONY: c2p
c2p:
$(RUN) $(BIN) -A 0.0 --left-height 1.0 --right-height 1.0 -L 2.0 -T 0.2 \
--k-xx 250.0 --k-xy 0.0 --k-yy 250.0 \
--n-x 10 --n-y 5 \
--flux-location top --flux-value 2500.0 \
--temp-location bottom --temp-value 10.0
.PHONY: c3p
c3p:
$(RUN) $(BIN) -A 0.25 --left-height 1.0 --right-height 1.3 -L 3.0 -T 0.2 \
--k-xx 250.0 --k-xy 0.0 --k-yy 250.0 \
--n-x 15 --n-y 8 \
--flux-location bottom --flux-value -5000.0 \
--temp-location left --temp-value -20.0
.PHONY: clean
clean:
$(RM) $(OBJ)
$(RM) $(BIN)
$(RM) $(TEST_OBJ)
$(RM) $(TEST_BIN)