# chemin des librairies PATH_GCC = $(PWD) PATH_LIB = $(PATH_GCC)/lib/ PATH_SRC = $(PATH_GCC)/src/ PATH_EXEC = $(PATH_GCC)/exec/ # repertoires pour les headers PATH_INCLUDE = $(PATH_GCC)/src/ # compilateur CC = gcc NVCC = /usr/local/cuda/bin/nvcc CXX = g++ # options de compilation # -Wall : Warning all # -g : debug (ex : gdb sas) # -pg : profile memoire et cpu pour chaque fonctions (ex : gprof name | less) # -O3 : optimisation code -O0 (rien) ~ -O3 (maxi) # -fstrict-aliasing : aligne la memoire sur 32 bits # gcc OPTION_CC1 = -Wall -O3 -static #-pg #-g -fprofile-arcs -ftest-coverage OPTION_CC2 = $(OPTION_CC1) -funroll-all-loops -fstrict-aliasing OPTION_CC = $(OPTION_CC2) -I$(PATH_INCLUDE) -I$(PATH_SRC) # librairies pour la compilation LIB_CC = -lm LIBSNV = -L/usr/local/cuda/lib64 -lcuda -lcudart # sources utiles a la compilation des main SRCS = lib_alloc.c lib_images.c lib_math.c lib_snake_common.c lib_contour.c SRCS_NV = lib_test_gpu.cu lib_snake_2_gpu.cu lib_gpu.cu snake2D_gpu.cu OBJS = $(SRCS:%.c=$(PATH_LIB)%.o) $(SRCS_NV:%.cu=$(PATH_LIB)%.o) # dependances supplementaires DEPS = $(PATH_SRC)/constantes.h $(PATH_SRC)/structures.h $(PATH_GCC)/makefile help : @echo "cibles : snake2D doc clean" all : snake2D doc clean : -rm -f $(PATH_LIB)*.o -rm -rf $(PATH_GCC)/docs/ # regle pour les .o # --use_fast_math # --ptxas-options=-v $(PATH_LIB)%_gpu.o : $(PATH_SRC)%_gpu.cu $(NVCC) -arch=sm_20 --use_fast_math -c $< -o $@ $(PATH_LIB)%.o : $(PATH_SRC)%.c $(DEPS) $(CC) $(OPTION_CC) -c $< -o $@ # regle pour l'exec $(PATH_EXEC)SNAKE2D : $(PATH_SRC)snake2D_gpu.cu $(OBJS) $(DEPS) $(CXX) $(OBJS) $(LIBSNV) \ -o $(PATH_EXEC)SNAKE2D # compilation main snake2D : $(PATH_EXEC)SNAKE2D @echo "" @echo "***** fin compil snake2D *****" @echo "" # generation des doc doc : doxygen doxygen.conf @echo "" @echo "***** fin compil doc *****" @echo ""