blob: f5eb1b4c911f1dfb03a29aa3e8aa38837767497b (
plain)
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
|
CXX = g++
NVCC = nvcc
CUFLAGS = -O3
CXXFLAGS = -Wall -Wextra -std=c++17 -O3
LDFLAGS = -L/opt/cuda/lib64 -lcudart
CXXFLAGS += $(shell pkg-config --cflags sdl2)
LDFLAGS += $(shell pkg-config --libs sdl2)
TARGET = mandel
HEADERS = $(wildcard *.h)
OBJS = $(patsubst %.cpp,%.o,$(wildcard *.cpp))
CUSRC = $(wildcard *.cu)
CULIBS = $(patsubst %.cu,%.a,$(CUSRC))
CUOBJS = $(patsubst %.cu,%.o,$(CUSRC))
CUDLOBJS = $(patsubst %.cu,%.dlink.o,$(CUSRC))
.PHONY: all clean
all: $(TARGET)
clean:
rm -f $(TARGET) *.o *.a
$(TARGET): $(OBJS) $(CULIBS)
$(CXX) -o $@ $^ $(LDFLAGS)
$(OBJS): %.o: %.cpp $(HEADERS)
$(CXX) $(CXXFLAGS) -c -o $@ $<
$(CULIBS): %.a: %.o %.dlink.o
$(NVCC) -ccbin $(CXX) -lib -o $@ $^
$(CUOBJS): %.o: %.cu $(HEADERS)
$(NVCC) -ccbin $(CXX) -dc -c -o $@ $<
$(CUDLOBJS): %.dlink.o: %.o
$(NVCC) -ccbin $(CXX) -dlink -o $@ $<
|