view example/multiply/Makefile.cuda @ 1994:727e896269e9 draft

commit
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Mon, 21 Apr 2014 00:02:11 +0900
parents cad62ee741e2
children
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 = /Developer/NVIDIA/CUDA-5.5/bin/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) $(CUDA_TASK_DIR)
	$(NVCC) $(NVCCFLAGS) $(CUDA_SRCS_TMP) -o $(CUDA_TASK_DIR)/$@.ptx
	$(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 cuda/*~ cuda/\#*