-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (50 loc) · 1.54 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
EXECUTABLE := gravitysim
CU_FILES := cudaBHSpaceModel.cu
CU_DEPS :=
CC_FILES := $(wildcard *.cpp)
LOGS := logs
###########################################################
ARCH=$(shell uname | sed -e 's/-.*//g')
OBJDIR=objs
CXX=g++ -m64
CXXFLAGS=-g -std=c++11 -O0 -flto -Wall $(shell pkg-config --cflags --libs libglfw)
HOSTNAME=$(shell hostname)
LIBS :=
FRAMEWORKS :=
# normal mode
NVCCFLAGS=-std=c++11 -O3 -m64 --gpu-architecture compute_35
# debug mode
#NVCCFLAGS=-O0 -g -G -m64 --gpu-architecture compute_35
LIBS += GL glut cudart
ifneq ($(wildcard /opt/cuda-8.0/.*),)
# Latedays
LDFLAGS=-L/opt/cuda-8.0/lib64/ -lcudart
else
# GHC
LDFLAGS=-L/usr/local/cuda/lib64/ -lcudart
endif
LDLIBS := $(addprefix -l, $(LIBS))
LDFRAMEWORKS := $(addprefix -framework , $(FRAMEWORKS))
NVCC=nvcc
OBJS=$(OBJDIR)/main.o $(OBJDIR)/Object.o $(OBJDIR)/Perf.o $(OBJDIR)/QuadTree.o \
$(OBJDIR)/Report.o $(OBJDIR)/Screen.o $(OBJDIR)/SpaceController.o \
$(OBJDIR)/SpaceView.o $(OBJDIR)/basic_types.o \
$(OBJDIR)/SpaceModel.o \
$(OBJDIR)/BHSpaceModel.o \
$(OBJDIR)/MortonTree.o $(OBJDIR)/MortonSpaceModel.o \
$(OBJDIR)/cudaBHSpaceModel.o \
$(OBJDIR)/cudaMortonSpaceModel.o
.PHONY: dirs clean
default: $(EXECUTABLE)
dirs:
mkdir -p $(OBJDIR)/
clean:
rm -rf $(OBJDIR) *~ $(EXECUTABLE) $(LOGS)
check: default
./checker.pl
$(EXECUTABLE): dirs $(OBJS)
$(CXX) $(CXXFLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS) $(LDFRAMEWORKS)
$(OBJDIR)/%.o: %.cpp
$(CXX) $< $(CXXFLAGS) -c -o $@
$(OBJDIR)/%.o: %.cu
$(NVCC) $< $(NVCCFLAGS) -c -o $@