# Using CUDA makefile template by Mark Murphy 2008 # Fill in the name of the output binary here target := test # List of sources, with .c, .cu, and .cpp extensions ccsources = cusources := test.cu # Other things that need to be built, e.g. .cubin files extradeps := # Flags common to all compilers. You can set these on the comamnd line, e.g: # $ make opt="" dbg="-g" warn="-Wno-deptrcated-declarations -Wall -Werror" opt ?= -O1 dbg ?= -g warn ?= -Wall -Werror cudaroot := /usr/local/cuda cupproot := /media/disk/dinh/cupp sdkroot := /usr/local/cuda/NVIDIA_CUDA_SDK #----- C compilation options ------ gcc := /usr/bin/gcc cflags += $(opt) $(dbg) $(warn) clib_paths := cinc_paths := -I $(cudaroot)/include clibraries := -lcuda -lcudart #----- C++ compilation options ------ gpp= g++ #ccflags += $(opt) $(dbg) cclib_paths := -L $(cupproot)/lib ccinc_paths := -I $(cupproot)/include cclibraries := -lcupp #----- SOAP compilation options ------ BIN = $(DESTDIR)/usr/bin ccflags += -static -DMAXGAP=3 -DMAXHITS=10000 -DTHREAD -O1 -g -Wall #-g -fno-inline #-DTHREAD -O1 -g REF_HUGE= -DDB_HUGE OLIGOLEN= -DREAD_60 #-DREAD_36 -DREAD_48 LIBS= THREAD= -lpthread #----- CUDA compilation options ----- nvcc := $(cudaroot)/bin/nvcc cuflags += $(opt) $(dbg) -arch sm_11 culib_paths := -L$(cudaroot)/lib -L$(sdkroot)/lib cuinc_paths := -I$(cudaroot)/include -I$(sdkroot)/common/inc culibraries := -lcutil lib_paths := $(culib_paths) $(cclib_paths) $(clib_paths) libraries := $(culibraries) $(cclibraries) $(clibraries) # This code generates a list of object files by replacing filename extensions objects := $(patsubst %.cu,%.o,$(cusources)) objects += $(patsubst %,%.huge.o,$(ccsources)) #----- Build rules ------ $(target): $(extradeps) $(target): $(objects) $(gpp) -o $@ -O1 $(lib_paths) $(libraries) $(objects) %.o: %.cu $(nvcc) -c $^ $(cuflags) $(cuinc_paths) $(ccinc_paths) --ptxas-options=-v -maxrregcount=8192 -deviceemu -o $@ %.cubin: %.cu $(nvcc) -cubin $(cuflags) $(cuinc_paths) $^ #---- Build SOAP objects ---- %.huge.o:%.cpp $(gpp) $(ccflags) $(ccinc_paths) $(cuinc_paths) $(lib_paths) $(libraries) $(REF_HUGE) $(OLIGOLEN) -c $< -o $@ clean: rm -f *.o $(target) makefile.*dep