diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2018-03-31 09:57:57 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2018-03-31 09:57:57 +0200 |
commit | 08c6f6ea50aeadb3fae94d08b76556b5e2c88543 (patch) | |
tree | 1e57f1c3ed2350c22561bc7891479edd80b94b68 /Makefile |
Initial
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2b12c32 --- /dev/null +++ b/Makefile @@ -0,0 +1,40 @@ +CXX = g++ +NVCC = nvcc +CUFLAGS = -O3 +CXXFLAGS = -Wall -Wextra -std=c++11 -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 $@ $< |