OpenCL入門をUbuntu14.04(CUDA6.0)でMakeするためのMakefile
(cudaのインストールディレクトリが変わった)
all: nvidia
is_64=$(shell s=`uname -m`; if (echo $$s | grep x86_64 > /dev/null); then echo 1; fi)
CFLAGS=-Wall -W -O2
EXE=""
ifeq ($(is_64), 1)
PATH_TO_NVIDIA_SDK:=/usr/local/cuda
PATH_TO_NVIDIA_INC:=$(PATH_TO_NVIDIA_SDK)/include
PATH_TO_NVIDIA_LIB:=$(PATH_TO_NVIDIA_SDK)/lib64
else
PATH_TO_NVIDIA_SDK:=/usr/local/cuda
PATH_TO_NVIDIA_INC:=$(PATH_TO_NVIDIA_SDK)/include
PATH_TO_NVIDIA_LIB:=$(PATH_TO_NVIDIA_SDK)/lib64
endif
EXE_NAME=$(patsubst %.cpp,%,$(wildcard *.cpp))
nvidia: $(patsubst %,%.nvidia,$(EXE_NAME))$(EXE)
%.nvidia$(EXE):%.cpp
g++ $(CFLAGS) -I$(PATH_TO_NVIDIA_INC) -L$(PATH_TO_NVIDIA_LIB) -o $@ $< -lOpenCL
clean:
rm -f *.nvidia$(EXE)
φ(..)メモメモ