view example/multiply/Makefile.cuda @ 1927:4eefec26e3e2 draft

add file
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Fri, 31 Jan 2014 07:15:07 +0900
parents
children 58aa5452584c
line wrap: on
line source

include ./Makefile.def

SRCS_TMP = $(wildcard *.cc)
SRCS_EXCLUDE =  # 除外するファイルを書く
SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
OBJS = $(SRCS:.cc=.o)

TASK_DIR  = ppe
CUDA_TASK_DIR = cuda

TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc)
TASK_SRCS_EXCLUDE = 
TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP)) $(wildcard $(CUDA_TASK_DIR)/*.cc)
TASK_OBJS = $(TASK_SRCS:.cc=.o)

CUDA_SRCS_TMP = $(wildcard $(CUDA_TASK_DIR)/*.cu)
CUDA_SRCS_EXCLUDE = # 除外するファイルを書く
CUDA_SRCS = $(filter-out $(CUDA_TASK_DIR)/$(CUDA_SRCS_EXCLUDE),$(CUDA_SRCS_TMP))
CUDA_OBJS = $(CUDA_SRCS:.cu=.ptx)

CFLAGS += -D__CERIUM_GPU__
LIBS += `sdl-config --libs` -lCudaManager -F/Library/Frameworks -framework CUDA

INCLUDE += -I/Developer/NVIDIA/CUDA-5.5/include

NVCC = nvcc
NVCCFLAGS = -ptx -arch=sm_20

.SUFFIXES: .cc .o

.cc.o:
	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@

all: $(TARGET) 

$(TARGET): $(OBJS) $(TASK_OBJS) $(CUDA_SRCS_TMP)
	$(NVCC) $(NVCCFLAGS) $(CUDA_SRCS_TMP)
	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)

link:
	$(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)

debug: $(TARGET)
	sudo ppu-gdb ./$(TARGET) 

clean:
	rm -f $(TARGET) $(OBJS) $(TASK_OBJS) $(CUDA_OBJS)
	rm -f *~ \#*
	rm -f gpu/*~ gpu/\#*