Blame c++/contourgl/Makefile

383633
# config
383633
383633
# just comment following line to disable CUDA
383633
CUDA = cuda-9.2
383633
CUDA_PATH := /opt/$(CUDA)
383633
CUDA_BIN := $(CUDA_PATH)/bin
383633
CUDA_PKGCONFIG := $(CUDA_PATH)/pkgconfig
383633
c76ce8
DEPLIBS = gl x11 OpenCL
f2b8c4
383633
383633
# compute build options
383633
383633
CXXFLAGS := $(CXXFLAGS) -O3 -Wall -fmessage-length=0 -DGL_GLEXT_PROTOTYPES
383633
CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags $(DEPLIBS))
383633
LIBS := $(LIBS) $(shell pkg-config --libs $(DEPLIBS))
383633
383633
ifdef CUDA
383633
	CXXFLAGS := $(CXXFLAGS) -DCUDA $(shell PKG_CONFIG_PATH=$(CUDA_PKGCONFIG) pkg-config --cflags $(CUDA))
383633
	LIBS := $(LIBS) $(shell PKG_CONFIG_PATH=$(CUDA_PKGCONFIG) pkg-config --libs $(CUDA))
383633
endif
383633
383633
383633
# files lists
383633
383633
TARGET = contourgl
49e693
49e693
SOURCES = \
49e693
	contourgl.cpp \
49e693
	clcontext.cpp \
572d9c
	clrender.cpp \
49e693
	contour.cpp \
49e693
	contourbuilder.cpp \
49e693
	environment.cpp \
49e693
	geometry.cpp \
49e693
	glcontext.cpp \
49e693
	measure.cpp \
49e693
	polyspan.cpp \
49e693
	shaders.cpp \
572d9c
	swrender.cpp \
49e693
	test.cpp \
49e693
	triangulator.cpp \
49e693
	utils.cpp
49e693
383633
ifdef CUDA
6fa009
	SOURCES += \
6fa009
		cudacontext.cpp \
6fa009
		cudarender.cpp
383633
	CUDA_SOURCES = \
383633
		cuda/contour.cu \
383633
		cuda/hello.cu
383633
endif
f2b8c4
383633
383633
# files lists postprocessing 
383633
383633
OBJS = $(SOURCES:.cpp=.o)
383633
DEPS = $(SOURCES:.cpp=.d)
383633
PTXS = $(CUDA_SOURCES:.cu=.ptx)
383633
383633
# internal targets
383633
383633
%.ptx: %.cu
383633
	$(CUDA_PATH)/bin/nvcc -ptx $< -o $@
383633
383633
# rule for make *.d files with include (.h) dependencies
383633
%.d: %.cpp
383633
	@set -e; rm -f $@; \
383633
	 $(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \
383633
	 sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
383633
	 rm -f $@.$$$$
383633
383633
$(TARGET): $(PTXS) $(DEPS) $(OBJS)
f2b8c4
	$(CXX) -o $(TARGET) $(OBJS) $(LIBS)
f2b8c4
383633
# include rules with include (.h) dependencies
383633
-include $(DEPS)
383633
383633
# actual targets
383633
383633
# declare that 'all', 'cuda' and 'clean' are cannot be a filenames 
383633
.PHONY: all clean
383633
383633
all: $(TARGET)
f2b8c4
f2b8c4
clean:
383633
	rm -f $(PTXS) $(OBJS) $(DEPS) $(TARGET)