1 ################################################################################
3 # Copyright 1993-2013 NVIDIA Corporation. All rights reserved.
7 # This source code is subject to NVIDIA ownership rights under U.S. and
8 # international Copyright laws.
10 # NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
11 # CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR
12 # IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH
13 # REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF
14 # MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
15 # IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
16 # OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
17 # OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
18 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
19 # OR PERFORMANCE OF THIS SOURCE CODE.
21 # U.S. Government End Users. This source code is a "commercial item" as
22 # that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of
23 # "commercial computer software" and "commercial computer software
24 # documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995)
25 # and is provided to the U.S. Government only as a commercial end item.
26 # Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through
27 # 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the
28 # source code with only those rights set forth herein.
30 ################################################################################
32 # Makefile project only supported on Mac OS X and Linux Platforms)
34 ################################################################################
36 include ./findcudalib.mk
38 # Location of the CUDA Toolkit
39 CUDA_PATH ?= /usr/local/cuda
42 NVCCFLAGS := -m${OS_SIZE}
53 # OS-specific build flags
55 LDFLAGS += -rpath $(CUDA_PATH)/lib
56 CCFLAGS += -arch $(OS_ARCH) $(STDLIB)
58 ifeq ($(OS_ARCH),armv7l)
60 CCFLAGS += -mfloat-abi=softfp
62 # default to gnueabihf
63 override abi := gnueabihf
64 LDFLAGS += --dynamic-linker=/lib/ld-linux-armhf.so.3
65 CCFLAGS += -mfloat-abi=hard
71 NVCCFLAGS += -target-cpu-arch ARM
73 CCFLAGS += --sysroot=$(TARGET_FS)
74 LDFLAGS += --sysroot=$(TARGET_FS)
75 LDFLAGS += -rpath-link=$(TARGET_FS)/lib
76 LDFLAGS += -rpath-link=$(TARGET_FS)/usr/lib
77 LDFLAGS += -rpath-link=$(TARGET_FS)/usr/lib/arm-linux-$(abi)
90 ALL_CCFLAGS += $(NVCCFLAGS)
91 ALL_CCFLAGS += $(addprefix -Xcompiler ,$(CCFLAGS))
92 ALL_CCFLAGS += $(EXTRA_NVCCFLAGS)
93 ALL_CCFLAGS += $(addprefix -Xcompiler ,$(EXTRA_CCFLAGS))
96 ALL_LDFLAGS += $(ALL_CCFLAGS)
97 ALL_LDFLAGS += $(NVCCLDFLAGS)
98 ALL_LDFLAGS += $(addprefix -Xlinker ,$(LDFLAGS))
99 ALL_LDFLAGS += $(EXTRA_NVCCLDFLAGS)
100 ALL_LDFLAGS += $(addprefix -Xlinker ,$(EXTRA_LDFLAGS))
102 # Common includes and paths for CUDA
103 INCLUDES := -I../../common/inc
106 ################################################################################
108 # CUDA code generation flags
109 ifneq ($(OS_ARCH),armv7l)
110 GENCODE_SM10 := -gencode arch=compute_10,code=sm_10
112 GENCODE_SM20 := -gencode arch=compute_20,code=sm_20
113 GENCODE_SM30 := -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=\"sm_35,compute_35\"
114 GENCODE_FLAGS := $(GENCODE_SM10) $(GENCODE_SM20) $(GENCODE_SM30)
116 ################################################################################
121 build: simpleMultiCopy
123 simpleMultiCopy.o: simpleMultiCopy.cu
124 $(NVCC) $(INCLUDES) $(ALL_CCFLAGS) $(GENCODE_FLAGS) -o $@ -c $<
126 simpleMultiCopy: simpleMultiCopy.o
127 $(NVCC) $(ALL_LDFLAGS) -o $@ $+ $(LIBRARIES)
128 mkdir -p ../../bin/$(OS_ARCH)/$(OSLOWER)/$(TARGET)$(if $(abi),/$(abi))
129 cp $@ ../../bin/$(OS_ARCH)/$(OSLOWER)/$(TARGET)$(if $(abi),/$(abi))
135 rm -f simpleMultiCopy simpleMultiCopy.o
136 rm -rf ../../bin/$(OS_ARCH)/$(OSLOWER)/$(TARGET)$(if $(abi),/$(abi))/simpleMultiCopy