-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (28 loc) · 775 Bytes
/
Makefile
File metadata and controls
40 lines (28 loc) · 775 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
31
32
33
34
35
36
37
38
39
40
# From https://x.momo86.net/?p=29
CXX=g++
CXXFLAGS=-std=c++11 -I./include -O3 -g -Xcompiler -Wall
NVCC=nvcc
ARCH=sm_30
NVCCFLAGS= -I./include -arch=$(ARCH) -std=c++11 -O3 -g -Xcompiler -Wall --compiler-bindir=$(CXX)
SRCDIR=src
SRCS=$(shell find $(SRCDIR) -name '*.cu' -o -name '*.cpp')
OBJDIR=src
OBJS=$(subst $(SRCDIR),$(OBJDIR), $(SRCS))
OBJS:=$(subst .cpp,.o,$(OBJS))
OBJS:=$(subst .cu,.o,$(OBJS))
BIN := ./bin
TARGET=sputniPIC.out
all: dir $(BIN)/$(TARGET)
dir: ${BIN}
${BIN}:
mkdir -p $(BIN)
$(BIN)/$(TARGET): $(OBJS)
$(NVCC) $(NVCCFLAGS) $+ -o $@
$(SRCDIR)/%.o: $(SRCDIR)/%.cu
$(NVCC) $(NVCCFLAGS) $< -c -o $@
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
[ -d $(OBJDIR) ] || mkdir $(OBJDIR)
$(NVCC) $(CXXFLAGS) $< -c -o $@
clean:
rm -rf $(OBJS)
rm -rf $(TARGET)