OSDN Git Service

modified: utilsrc/src/Admin/Makefile
[eos/others.git] / utiltools / X86MAC64 / cuda / samples / 2_Graphics / volumeFiltering / findgllib.mk
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 #  findgllib.mk is used to find the necessary GL Libraries for specific distributions
33 #               this is supported on Mac OSX and Linux Platforms
34 #
35 ################################################################################
36
37 # OS Name (Linux or Darwin)
38 OSUPPER = $(shell uname -s 2>/dev/null | tr "[:lower:]" "[:upper:]")
39 OSLOWER = $(shell uname -s 2>/dev/null | tr "[:upper:]" "[:lower:]")
40
41 # Flags to detect 32-bit or 64-bit OS platform
42 OS_SIZE = $(shell uname -m | sed -e "s/i.86/32/" -e "s/x86_64/64/" -e "s/armv7l/32/")
43 OS_ARCH = $(shell uname -m | sed -e "s/i386/i686/")
44
45 # Determine OS platform and unix distribution
46 ifeq ("$(OSLOWER)","linux")
47    # first search lsb_release
48    DISTRO  = $(shell lsb_release -i -s 2>/dev/null | tr "[:upper:]" "[:lower:]")
49    DISTVER = $(shell lsb_release -r -s 2>/dev/null)
50    # $(info DISTRO1 = $(DISTRO) $(DISTVER))
51    ifeq ($(DISTRO),)
52      # second search and parse /etc/issue
53      DISTRO = $(shell more /etc/issue | awk '{print $$1}' | sed '1!d' | sed -e "/^$$/d" 2>/dev/null | tr "[:upper:]" "[:lower:]")
54      DISTVER= $(shell more /etc/issue | awk '{print $$2}' | sed '1!d' 2>/dev/null)
55      # $(info DISTRO2 = $(DISTRO) $(DISTVER))
56    endif
57    ifeq ($(DISTRO),)
58      # third, we can search in /etc/os-release or /etc/{distro}-release
59      DISTRO = $(shell awk '/ID/' /etc/*-release | sed 's/ID=//' | grep -v "VERSION" | grep -v "ID" | grep -v "DISTRIB")
60      DISTVER= $(shell awk '/DISTRIB_RELEASE/' /etc/*-release | sed 's/DISTRIB_RELEASE=//' | grep -v "DISTRIB_RELEASE")
61      # $(info DISTRO3 = $(DISTRO) $(DISTVER))
62    endif
63 endif
64
65 # Take command line flags that override any of these settings
66 ifeq ($(i386),1)
67         OS_SIZE = 32
68         OS_ARCH = i686
69 endif
70 ifeq ($(x86_64),1)
71         OS_SIZE = 64
72         OS_ARCH = x86_64
73 endif
74 ifeq ($(ARMv7),1)
75         OS_SIZE = 32
76         OS_ARCH = armv7l
77 endif
78
79 ifeq ("$(OSUPPER)","LINUX")
80     # $(info) >> findgllib.mk -> LINUX path <<<)
81     # Each set of Linux Distros have different paths for where to find their OpenGL libraries reside
82     ifeq ("$(DISTRO)","ubuntu")
83         GLPATH    ?= /usr/lib/nvidia-current
84         GLLINK    ?= -L/usr/lib/nvidia-current
85         DFLT_PATH ?= /usr/lib
86     endif
87     ifeq ("$(DISTRO)","kubuntu")
88         GLPATH    ?= /usr/lib/nvidia-current
89         GLLINK    ?= -L/usr/lib/nvidia-current
90         DFLT_PATH ?= /usr/lib
91     endif
92     ifeq ("$(DISTRO)","debian")
93         GLPATH    ?= /usr/lib/nvidia-current
94         GLLINK    ?= -L/usr/lib/nvidia-current
95         DFLT_PATH ?= /usr/lib
96     endif
97     ifeq ("$(DISTRO)","suse")
98       ifeq ($(OS_SIZE),64)
99         GLPATH    ?= /usr/X11R6/lib64 /usr/X11R6/lib
100         GLLINK    ?= -L/usr/X11R6/lib64 -L/usr/X11R6/lib
101         DFLT_PATH ?= /usr/lib64
102       else
103         GLPATH    ?= /usr/X11R6/lib
104         GLLINK    ?= -L/usr/X11R6/lib
105         DFLT_PATH ?= /usr/lib
106       endif
107     endif
108     ifeq ("$(DISTRO)","suse linux")
109       ifeq ($(OS_SIZE),64)
110         GLPATH    ?= /usr/X11R6/lib64 /usr/X11R6/lib
111         GLLINK    ?= -L/usr/X11R6/lib64 -L/usr/X11R6/lib
112         DFLT_PATH ?= /usr/lib64
113       else
114         GLPATH    ?= /usr/X11R6/lib
115         GLLINK    ?= -L/usr/X11R6/lib
116         DFLT_PATH ?= /usr/lib
117       endif
118     endif
119     ifeq ("$(DISTRO)","opensuse")
120       ifeq ($(OS_SIZE),64)
121         GLPATH    ?= /usr/X11R6/lib64 /usr/X11R6/lib
122         GLLINK    ?= -L/usr/X11R6/lib64 -L/usr/X11R6/lib
123         DFLT_PATH ?= /usr/lib64
124       else
125         GLPATH    ?= /usr/X11R6/lib
126         GLLINK    ?= -L/usr/X11R6/lib
127         DFLT_PATH ?= /usr/lib
128       endif
129     endif
130     ifeq ("$(DISTRO)","fedora")
131       ifeq ($(OS_SIZE),64)
132         GLPATH    ?= /usr/lib64/nvidia
133         GLLINK    ?= -L/usr/lib64/nvidia
134         DFLT_PATH ?= /usr/lib64
135       else
136         GLPATH    ?=
137         GLLINK    ?=
138         DFLT_PATH ?= /usr/lib
139       endif
140     endif
141     ifeq ("$(DISTRO)","redhat")
142       ifeq ($(OS_SIZE),64)
143         GLPATH    ?= /usr/lib64/nvidia
144         GLLINK    ?= -L/usr/lib64/nvidia
145         DFLT_PATH ?= /usr/lib64
146       else
147         GLPATH    ?=
148         GLLINK    ?=
149         DFLT_PATH ?= /usr/lib
150       endif
151     endif
152     ifeq ("$(DISTRO)","red")
153       ifeq ($(OS_SIZE),64)
154         GLPATH    ?= /usr/lib64/nvidia
155         GLLINK    ?= -L/usr/lib64/nvidia
156         DFLT_PATH ?= /usr/lib64
157       else
158         GLPATH    ?=
159         GLLINK    ?=
160         DFLT_PATH ?= /usr/lib
161       endif
162     endif
163     ifeq ("$(DISTRO)","redhatenterpriseworkstation")
164       ifeq ($(OS_SIZE),64)
165         GLPATH    ?= /usr/lib64/nvidia
166         GLLINK    ?= -L/usr/lib64/nvidia
167         DFLT_PATH ?= /usr/lib64
168       else
169         GLPATH    ?=
170         GLLINK    ?=
171         DFLT_PATH ?= /usr/lib
172       endif
173     endif
174     ifeq ("$(DISTRO)","centos")
175       ifeq ($(OS_SIZE),64)
176         GLPATH    ?= /usr/lib64/nvidia
177         GLLINK    ?= -L/usr/lib64/nvidia
178         DFLT_PATH ?= /usr/lib64
179       else
180         GLPATH    ?=
181         GLLINK    ?=
182         DFLT_PATH ?= /usr/lib
183       endif
184     endif
185  
186     ifeq ($(ARMv7),1)
187       GLPATH := /usr/arm-linux-gnueabihf/lib
188       GLLINK := -L/usr/arm-linux-gnueabihf/lib
189       ifneq ($(TARGET_FS),) 
190         GLPATH += $(TARGET_FS)/usr/lib/nvidia-current $(TARGET_FS)/usr/lib/arm-linux-gnueabihf
191         GLLINK += -L$(TARGET_FS)/usr/lib/nvidia-current -L$(TARGET_FS)/usr/lib/arm-linux-gnueabihf
192       endif 
193     endif
194
195   # find libGL, libGLU, libXi, 
196   GLLIB  := $(shell find $(GLPATH) $(DFLT_PATH) -name libGL.so  -print 2>/dev/null)
197   GLULIB := $(shell find $(GLPATH) $(DFLT_PATH) -name libGLU.so -print 2>/dev/null)
198   X11LIB := $(shell find $(GLPATH) $(DFLT_PATH) -name libX11.so -print 2>/dev/null)
199   XILIB  := $(shell find $(GLPATH) $(DFLT_PATH) -name libXi.so  -print 2>/dev/null)
200   XMULIB := $(shell find $(GLPATH) $(DFLT_PATH) -name libXmu.so -print 2>/dev/null)
201
202   ifeq ("$(GLLIB)",'')
203       $(info >>> WARNING - libGL.so not found, refer to CUDA Samples release notes for how to find and install them. <<<)
204       EXEC=@echo "[@]"
205   endif
206   ifeq ("$(GLULIB)",'')
207       $(info >>> WARNING - libGLU.so not found, refer to CUDA Samples release notes for how to find and install them. <<<)
208       EXEC=@echo "[@]"
209   endif
210   ifeq ("$(X11LIB)",'')
211       $(info >>> WARNING - libX11.so not found, refer to CUDA Samples release notes for how to find and install them. <<<)
212       EXEC=@echo "[@]"
213   endif
214   ifeq ("$(XILIB)",'')
215       $(info >>> WARNING - libXi.so not found, refer to CUDA Samples release notes for how to find and install them. <<<)
216       EXEC=@echo "[@]"
217   endif
218   ifeq ("$(XMULIB)",'')
219       $(info >>> WARNING - libXmu.so not found, refer to CUDA Samples release notes for how to find and install them. <<<)
220       EXEC=@echo "[@]"
221   endif
222 else
223     # This would be the Mac OS X path if we had to do anything special
224 endif
225