1 # chemin des librairies
6 PATH_LIB = $(PATH_GCC)/lib/
7 PATH_SRC = $(PATH_GCC)/src/
8 PATH_EXEC = $(PATH_GCC)/exec/
10 # repertoires pour les headers
11 PATH_INCLUDE = $(PATH_GCC)/src/
15 NVCC = /usr/local/cuda/bin/nvcc
18 # options de compilation
20 # -g : debug (ex : gdb sas)
21 # -pg : profile memoire et cpu pour chaque fonctions (ex : gprof name | less)
22 # -O3 : optimisation code -O0 (rien) ~ -O3 (maxi)
23 # -fstrict-aliasing : aligne la memoire sur 32 bits
26 OPTION_CC1 = -Wall -O3 -static #-pg #-g -fprofile-arcs -ftest-coverage
27 OPTION_CC2 = $(OPTION_CC1) -funroll-all-loops -fstrict-aliasing
29 OPTION_CC = $(OPTION_CC2) -I$(PATH_INCLUDE) -I$(PATH_SRC)
32 # librairies pour la compilation
34 LIBSNV = -L/usr/local/cuda/lib64 -lcuda -lcudart
36 # sources utiles a la compilation des main
37 SRCS = lib_alloc.c lib_images.c lib_math.c lib_snake_common.c lib_contour.c
39 SRCS_NV = lib_test_gpu.cu lib_snake_2_gpu.cu lib_gpu.cu snake2D_gpu.cu
41 OBJS = $(SRCS:%.c=$(PATH_LIB)%.o) $(SRCS_NV:%.cu=$(PATH_LIB)%.o)
43 # dependances supplementaires
44 DEPS = $(PATH_SRC)/constantes.h $(PATH_SRC)/structures.h $(PATH_GCC)/makefile
46 @echo "cibles : snake2D doc clean"
51 -rm -rf $(PATH_GCC)/docs/
57 $(PATH_LIB)%_gpu.o : $(PATH_SRC)%_gpu.cu
58 $(NVCC) -arch=sm_20 --use_fast_math -c $< -o $@
60 $(PATH_LIB)%.o : $(PATH_SRC)%.c $(DEPS)
61 $(CC) $(OPTION_CC) -c $< -o $@
65 $(PATH_EXEC)SNAKE2D : $(PATH_SRC)snake2D_gpu.cu $(OBJS) $(DEPS)
66 $(CXX) $(OBJS) $(LIBSNV) \
67 -o $(PATH_EXEC)SNAKE2D
71 snake2D : $(PATH_EXEC)SNAKE2D
73 @echo "***** fin compil snake2D *****"
81 @echo "***** fin compil doc *****"