OSDN Git Service

modified: utilsrc/src/Admin/Makefile
[eos/others.git] / utiltools / X86MAC64 / cuda / samples / 3_Imaging / boxFilter / Makefile
1 ################################################################################
2 #
3 # Copyright 1993-2013 NVIDIA Corporation.  All rights reserved.
4 #
5 # NOTICE TO USER:   
6 #
7 # This source code is subject to NVIDIA ownership rights under U.S. and 
8 # international Copyright laws.  
9 #
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.  
20 #
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.
29 #
30 ################################################################################
31 #
32 # Makefile project only supported on Mac OS X and Linux Platforms)
33 #
34 ################################################################################
35
36 include ./findcudalib.mk
37
38 # Location of the CUDA Toolkit
39 CUDA_PATH       ?= /Developer/NVIDIA/CUDA-5.5
40
41 # internal flags
42 NVCCFLAGS   := -m${OS_SIZE}
43 CCFLAGS     :=
44 NVCCLDFLAGS :=
45 LDFLAGS     :=
46
47 # Extra user flags
48 EXTRA_NVCCFLAGS   ?=
49 EXTRA_NVCCLDFLAGS ?=
50 EXTRA_LDFLAGS     ?=
51 EXTRA_CCFLAGS     ?=
52
53 # OS-specific build flags
54 ifneq ($(DARWIN),) 
55   LDFLAGS += -rpath $(CUDA_PATH)/lib
56   CCFLAGS += -arch $(OS_ARCH) $(STDLIB)  
57 else
58   ifeq ($(OS_ARCH),armv7l)
59     ifeq ($(abi),gnueabi)
60       CCFLAGS += -mfloat-abi=softfp
61     else
62       # default to gnueabihf
63       override abi := gnueabihf
64       LDFLAGS += --dynamic-linker=/lib/ld-linux-armhf.so.3
65       CCFLAGS += -mfloat-abi=hard
66     endif
67   endif
68 endif
69
70 ifeq ($(ARMv7),1)
71 NVCCFLAGS += -target-cpu-arch ARM
72 ifneq ($(TARGET_FS),) 
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)
78 endif
79 endif
80
81 # Debug build flags
82 ifeq ($(dbg),1)
83       NVCCFLAGS += -g -G
84       TARGET := debug
85 else
86       TARGET := release
87 endif
88
89 ALL_CCFLAGS :=
90 ALL_CCFLAGS += $(NVCCFLAGS)
91 ALL_CCFLAGS += $(addprefix -Xcompiler ,$(CCFLAGS))
92 ALL_CCFLAGS += $(EXTRA_NVCCFLAGS)
93 ALL_CCFLAGS += $(addprefix -Xcompiler ,$(EXTRA_CCFLAGS))
94
95 ALL_LDFLAGS :=
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))
101
102 # Common includes and paths for CUDA
103 INCLUDES  := -I../../common/inc
104 LIBRARIES :=
105
106 ################################################################################
107
108 # Makefile include to help find GL Libraries
109 EXEC            ?=
110 include ./findgllib.mk
111
112 # OpenGL specific libraries 
113 ifneq ($(DARWIN),)
114   # Mac OSX specific libraries and paths to include
115   LIBRARIES += -L/System/Library/Frameworks/OpenGL.framework/Libraries 
116   LIBRARIES += -lGL -lGLU ../../common/lib/darwin/libGLEW.a
117   ALL_LDFLAGS += -Xlinker -framework -Xlinker GLUT
118 else
119   LIBRARIES += -L../../common/lib/$(OSLOWER)/$(OS_ARCH) $(GLLINK)
120   LIBRARIES += -lGL -lGLU -lX11 -lXi -lXmu -lglut -lGLEW
121 endif
122
123 # CUDA code generation flags
124 ifneq ($(OS_ARCH),armv7l)
125 GENCODE_SM10    := -gencode arch=compute_10,code=sm_10
126 endif
127 GENCODE_SM20    := -gencode arch=compute_20,code=sm_20
128 GENCODE_SM30    := -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=\"sm_35,compute_35\"
129 GENCODE_FLAGS   := $(GENCODE_SM10) $(GENCODE_SM20) $(GENCODE_SM30)
130
131 ################################################################################
132
133 # Target rules
134 all: build
135
136 build: boxFilter
137
138 boxFilter_kernel.o: boxFilter_kernel.cu
139         $(EXEC) $(NVCC) $(INCLUDES) $(ALL_CCFLAGS) $(GENCODE_FLAGS) -o $@ -c $<
140
141 boxFilter_cpu.o: boxFilter_cpu.cpp
142         $(EXEC) $(NVCC) $(INCLUDES) $(ALL_CCFLAGS) $(GENCODE_FLAGS) -o $@ -c $<
143
144 boxFilter.o: boxFilter.cpp
145         $(EXEC) $(NVCC) $(INCLUDES) $(ALL_CCFLAGS) $(GENCODE_FLAGS) -o $@ -c $<
146
147 boxFilter: boxFilter.o boxFilter_cpu.o boxFilter_kernel.o
148         $(EXEC) $(NVCC) $(ALL_LDFLAGS) -o $@ $+ $(LIBRARIES)
149         $(EXEC) mkdir -p ../../bin/$(OS_ARCH)/$(OSLOWER)/$(TARGET)$(if $(abi),/$(abi))
150         $(EXEC) cp $@ ../../bin/$(OS_ARCH)/$(OSLOWER)/$(TARGET)$(if $(abi),/$(abi))
151
152 run: build
153         $(EXEC) ./boxFilter
154
155 clean:
156         $(EXEC) rm -f boxFilter.o boxFilter_kernel.o boxFilter_cpu.o boxFilter
157         $(EXEC) rm -rf ../../bin/$(OS_ARCH)/$(OSLOWER)/$(TARGET)$(if $(abi),/$(abi))/boxFilter
158
159 clobber: clean