-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (37 loc) · 957 Bytes
/
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
## project directories
SRC_DIR:=src
INCLUDE_DIR:=include
BUILD_DIR:=build
OUT_DIR=outfiles
## target executable
EXE:=lifeMPI
## set compiler, linker and preprocessor
CXX:=mpicxx
CXXFLAGS:=-Wall -Wextra
CPPFLAGS:=-MMD -MP
LDFLAGS:=
LDLIBS:=
# -----------------------------------------------------------------
SRC_FILES:=$(wildcard $(SRC_DIR)/*.cpp)
OBJ_FILES:=$(addprefix $(BUILD_DIR)/,$(addsuffix .o,$(notdir $(basename $(SRC_FILES)))))
DEP_FILES:=$(OBJ_FILES:.o=.d)
.PHONY : all
all : $(EXE)
$(EXE) : $(OBJ_FILES) | outfiles
$(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS)
.PHONY : clean
clean:
-$(RM) $(EXE) $(OBJ_FILES) $(DEP_FILES)
rm -rf $(BUILD_DIR) $(OUT_DIR) $(IN_DIR)
.PHONY : build
build:
mkdir -p $(BUILD_DIR)
.PHONY : outfiles
outfiles:
mkdir -p $(OUT_DIR)
.PHONY : test
test:
python scripts/test_life.py
-include $(DEP_FILES)
$(BUILD_DIR)/%.o : $(SRC_DIR)/%.cpp Makefile | build
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@