-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (21 loc) · 726 Bytes
/
Makefile
File metadata and controls
30 lines (21 loc) · 726 Bytes
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
# Compiler
NVCC = nvcc
CXX = g++
# Compiler Flags
CXXFLAGS = -O2 -Wall -std=c++17
NVCCFLAGS = -arch=all-major -O2 --compiler-options "-Wall"
# Directories
SRC_DIR = src
BIN_DIR = bin
LDFLAGS = -L${LD_LIBRARY_PATH} -lcudart
# Find all projects (directories in exercises/)
PROJECTS = $(shell find $(SRC_DIR) -maxdepth 1 -type d | tail -n +2 | xargs -n 1 basename)
# Generate executable names (bin/project1, bin/project2, ...)
EXECUTABLES = $(addprefix $(BIN_DIR)/, $(PROJECTS))
all: $(EXECUTABLES)
# Rule to compile each project with nvcc
$(BIN_DIR)/%: $(SRC_DIR)/%/*.cu $(SRC_DIR)/%/*.cpp
mkdir -p $(BIN_DIR)
$(NVCC) $(NVCCFLAGS) -x cu $(SRC_DIR)/$*/main.cpp $(SRC_DIR)/$*/kernel.cu -o $@
clean:
rm -rf $(BIN_DIR)