-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (41 loc) · 1.26 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
CC = nvcc
RM ?= @rm
MKDIR ?= @mkdir
CFLAGS := -O3
SRC_DIR = src
SRC_QH_DIR = $(SRC_DIR)/quickhull
OBJ_DIR = obj
BIN_DIR = bin
DATA_DIR = data
TEST_DIR = test
SRCS = $(wildcard $(SRC_QH_DIR)/*.cu)
SRCS += $(wildcard $(SRC_QH_DIR)/*.cpp)
OBJECTS = $(patsubst $(SRC_QH_DIR)/%.cu,$(OBJ_DIR)/%.o,$(SRCS))
OBJECTS := $(patsubst $(SRC_QH_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(OBJECTS))
BINARIES = $(patsubst $(OBJ_DIR)/%.o,$(BIN_DIR)/%.x,$(OBJECTS))
all: $(BIN_DIR) $(OBJ_DIR) $(BINARIES)
$(DATA_DIR):
@echo "Creating data directory: $(DATA_DIR)"
$(MKDIR) $(DATA_DIR)
$(BIN_DIR):
@echo "Creating binary directory: $(BIN_DIR)"
$(MKDIR) $(BIN_DIR)
$(BIN_DIR)/%.x: $(OBJ_DIR)/%.o $(OBJ_DIR)/points_generator.o
@echo "Generating binary $@"
$(CC) $(CFLAGS) -o $@ $^
$(OBJ_DIR):
@echo "Creating build directory: $(OBJ_DIR)"
$(MKDIR) $(OBJ_DIR)
$(OBJ_DIR)/points_generator.o: $(SRC_DIR)/points_generation/points_generator.cpp $(SRC_DIR)/points_generation/random_points.h
$(CC) $(CFLAGS) -c -o $@ $<
$(OBJ_DIR)/%.o: $(SRC_QH_DIR)/%.cu
@echo "Compiling $<"
$(CC) $(CFLAGS) -c -o $@ $^
$(OBJ_DIR)/%.o: $(SRC_QH_DIR)/%.cpp
@echo "Compiling $<"
$(CC) $(CFLAGS) -c -o $@ $^
clean:
@echo "Cleaning build directories: $(OBJ_DIR), $(BIN_DIR)"
$(RM) -Rf $(OBJ_DIR)
$(RM) -Rf $(BIN_DIR)
.PHONY: clean