################################################################################
#
# Build script for project
#
################################################################################

# Add source files here
TARGET	:= decPar
# Cuda source files (compiled with cudacc)
CUFILES	:= decPar.cu

################################################################################
# Rules and targets

.SUFFIXES : .cu .cu_dbg_o .c_dbg_o .cpp_dbg_o .cu_rel_o .c_rel_o .cpp_rel_o .cubin

# Compilers
NVCC       := nvcc
CXX        := g++
CC         := gcc
LINK       := g++ -fPIC

# Includes
CUDA_INSTALL_PATH ?= /usr/local/cuda
#INCLUDES  += -I$(CUDA_INSTALL_PATH)/include

# Warning flags
CXXWARN_FLAGS := \
        -W -Wall \
        -Wimplicit \
        -Wswitch \
        -Wformat \
        -Wchar-subscripts \
        -Wparentheses \
        -Wmultichar \
        -Wtrigraphs \
        -Wpointer-arith \
        -Wcast-align \
        -Wreturn-type \
        -Wno-unused-function

CWARN_FLAGS := $(CXXWARN_FLAGS) \
        -Wstrict-prototypes \
        -Wmissing-prototypes \
        -Wmissing-declarations \
        -Wnested-externs \
        -Wmain \

# Compiler-specific flags
NVCCFLAGS := $(INCLUDES) -DUNIX --ptx
#NVCCFLAGS := $(INCLUDES) -DUNIX --cubin
#NVCCFLAGS := $(INCLUDES) -DUNIX
CXXFLAGS  := $(INCLUDES) -Wall -fPIC -DUNIX $(CXXWARN_FLAGS) 
CFLAGS    := $(INCLUDES) -Wall -fPIC -DUNIX $(CWARN_FLAGS)  

# Debug/release configuration
#NVCCFLAGS   += -g -D_DEBUG
#CXXFLAGS    += -g
#CFLAGS      += -g
NVCCFLAGS   += -O3
CXXFLAGS    += -O3
CFLAGS      += -O3

CODE ?= compute_11

all:$(TARGET)

$(TARGET): Makefile $(CUFILES)
	$(NVCC) $(NVCCFLAGS) decPar.cu -o $(TARGET)

clean: 
	rm -rf *.o $(TARGET) $(TARGET).devcode $(TARGET).linkinfo

