-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (55 loc) · 2.13 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
CUDA_ROOT_DIR=/usr/local/cuda
FOLLY_INSTALL_DIR=/data/pgera6/folly_23_install/installed/folly
FMT_INSTALL_DIR=/data/pgera6/folly_23_install/installed/fmt-5d79UHBn4Hso1yL1LQBoyTVMWd1GqtqLE_u_Lyf2M5s
CXX = /usr/bin/g++
CXXFLAGS = --std=c++17 -O3 -fPIC -fopenmp -Wall -I$(FOLLY_INSTALL_DIR)/include
LDFLAGS= -fopenmp -L$(FOLLY_INSTALL_DIR)/lib -L$(FMT_INSTALL_DIR)/lib
LDLIBS= -lstdc++fs -lglog -lfolly -ldouble-conversion -lboost_program_options -ldl -lfmt -lssl -lcrypto
# NVCC compiler options:
NVCC=/usr/local/cuda/bin/nvcc
NVCC_FLAGS= -lineinfo -O3 --expt-relaxed-constexpr -ccbin=$(CXX) --std=c++17\
-Xcompiler -O3,-fPIC,-fopenmp,-Wall,-Wno-unused-function,-I$(FOLLY_INSTALL_DIR)/include
NVCC_LIBS=
# CUDA library directory:
CUDA_LIB_DIR= -L$(CUDA_ROOT_DIR)/lib64
# CUDA include directory:
CUDA_INC_DIR= -I$(CUDA_ROOT_DIR)/include
# CUDA linking libraries:
CUDA_LINK_LIBS= -lcudart
MKDIR_P = mkdir -p
# Final binary
BIN = ef_bfs
# Put all auto generated stuff to this build dir.
SRC_DIR = ./src
BUILD_DIR = ./build
# List of all .cpp source files.
CPP = $(wildcard $(SRC_DIR)/*.cpp)
CU = $(wildcard $(SRC_DIR)/*.cu)
# All .o files go to build dir.
OBJ = $(CPP:$(SRC_DIR)/%.cpp=$(BUILD_DIR)/%.o) $(CU:$(SRC_DIR)/%.cu=$(BUILD_DIR)/%.o)
# Gcc/Clang will create these .d files containing dependencies.
DEP = $(OBJ:%.o=%.d)
# Default target named after the binary.
all: directories $(BIN)
directories: ${BUILD_DIR}
${BUILD_DIR}:
${MKDIR_P} ${BUILD_DIR}
# Actual target of the binary - depends on all .o files.
$(BIN) : $(OBJ)
$(CXX) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(CUDA_LIB_DIR) $(CUDA_LINK_LIBS)
# Include all .d files
-include $(DEP)
# Build target for every single object file.
# The potential dependency on header files is covered
# by calling `-include $(DEP)`.
$(BUILD_DIR)/%.o : $(SRC_DIR)/%.cpp
# The -MMD flags additionaly creates a .d file with
# the same name as the .o file.
$(CXX) $(CXXFLAGS) -MMD -c $< -o $@
$(BUILD_DIR)/%.o : $(SRC_DIR)/%.cu
# The -MMD flags additionaly creates a .d file with
# the same name as the .o file.
$(NVCC) $(NVCC_FLAGS) -MMD -c $< -o $@ $(NVCC_LIBS)
.PHONY : clean directories
clean :
-rm -f $(BIN) $(OBJ) $(DEP)