changeset 1920:273638411ebf draft

fix makefile
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Wed, 29 Jan 2014 14:49:54 +0900
parents d6e033734c12
children 91ada4e540f2
files example/Cuda/Makefile example/Cuda/Makefile.def
diffstat 2 files changed, 13 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/example/Cuda/Makefile	Tue Jan 28 18:33:19 2014 +0900
+++ b/example/Cuda/Makefile	Wed Jan 29 14:49:54 2014 +0900
@@ -2,36 +2,30 @@
 
 SRCS_TMP = $(wildcard *.cc)
 SRCS_EXCLUDE = # 除外するファイルを書く
-
 SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
 OBJS = $(SRCS:.cc=.o)
 
-TASK_SRCS_TMP = $(wildcard $(TASK_DIR2)/*.cc $(TASK_DIR1)/*.cc)
-TASK_SRCS = $(filter-out $(TASK_DIR1)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP))
-TASK_OBJS = $(TASK_SRCS:.cc=.o)
-
-CC += $(ABI)
-
-LIBS = -I/Developer/NVIDIA/CUDA-5.5/include -F/Library/Frameworks -framework CUDA
-
 CUDA_SRCS_TMP = $(wildcard *.cu)
 CUDA_SRCS_EXCLUDE = # 除外するファイルを書く
+CUDA_SRCS = $(filter-out $(CUDA_SRCS_EXCLUDE),$(CUDA_SRCS_TMP))
+CUDA_OBJS = $(CUDA_SRCS:.cu=.ptx)
 
-CUDA_SRCS = $(filter-out $(CUDA_SRCS_EXCLUDE),$(CUDA_SRCS_TMP))
-CUDA_OBJS = $(CUDA_SRCS:.cu)
+CC += $(ABI)
 
-CUDA_TASK_SRCS_TMP = $(wildcard $(TASK_DIR2)/*.cu $(TASK_DIR1)/*.cu)
-CUDA_TASK_SRCS = $(filter-out $(TASK_DIR1)/$(TASK_SRCS_EXCLUDE),$(CUDA_TASK_SRCS_TMP))
-CUDA_TASK_OBJS = $(CUDA_TASK_SRCS:.cu)
+LIBS = -F/Library/Frameworks -framework CUDA
+INCLUDE = -I/Developer/NVIDIA/CUDA-5.5/include
 
-.SUFFIXES: .cc .o .cu
+.SUFFIXES: .cc .o
+.cc.o:
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
 
-.cc.o:
-	$(CC) $(CFLAGS) $(LIBS) $(INCLUDE) -c $< -o $@
+.SUFFIXES: .cu .ptx
+	$(NVCC) $(NVCCFLAGS) $< $@
 
 all: $(TARGET)
 
-$(TARGET): $(OBJS) $(TASK_OBJS)
+$(TARGET): $(OBJS) $(TASK_OBJS) $(CUDA_SRCS_TMP)
+	$(NVCC) $(NVCCFLAGS) $(CUDA_SRCS_TMP)
 	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
 
 link:
@@ -41,5 +35,5 @@
 	sudo gdb ./$(TARGET)
 
 clean:
-	rm -f $(TARGET) $(OBJS) $(TASK_OBJS)
+	rm -f $(TARGET) $(OBJS) $(TASK_OBJS) $(CUDA_OBJS)
 	rm -f *~ \#*
--- a/example/Cuda/Makefile.def	Tue Jan 28 18:33:19 2014 +0900
+++ b/example/Cuda/Makefile.def	Wed Jan 29 14:49:54 2014 +0900
@@ -1,7 +1,5 @@
 TARGET = multiply
 
-ABIBIT=64
-
 OPT = -g -O0
 
 CC = clang++