Makefile: avoid error message from 'uname -o'
The platform specific tweaking part was using 'uname -o' which is not always available. Squelch error message from it. It was suggested to chain the if..else, but I chose not to, because maintaining the nested if..else if..else..endif endif to match is a pain. If we had "elif", things would have been different, though. While we are at it, try not to invoke 'uname -s' for each platform candidate. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Oct 9, 2005 at 12:52 UTC
f7c153431b4049e7697664dee4a3d71013422f9d
1 file changed
+15
-7
Makefile
+15
-7
@@ -166,11 +166,19 @@ LIBS += -lz
166
#
167
# Platform specific tweaks
168
#
169
-ifeq ($(shell uname -s),Darwin)
169
+
170
+# We choose to avoid "if .. else if .. else .. endif endif"
171
+# because maintaining the nesting to match is a pain. If
172
+# we had "elif" things would have been much nicer...
173
+uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
174
+uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
175
+uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
176
+
177
+ifeq ($(uname_S),Darwin)
178
NEEDS_SSL_WITH_CRYPTO = YesPlease
179
NEEDS_LIBICONV = YesPlease
180
endif
173
-ifeq ($(shell uname -s),SunOS)
181
+ifeq ($(uname_S),SunOS)
182
NEEDS_SOCKET = YesPlease
183
NEEDS_NSL = YesPlease
184
SHELL_PATH = /bin/bash
@@ -180,20 +188,20 @@ ifeq ($(shell uname -s),SunOS)
188
TAR = gtar
189
PLATFORM_DEFINES += -D__EXTENSIONS__
190
endif
183
-ifeq ($(shell uname -o),Cygwin)
191
+ifeq ($(uname_O),Cygwin)
192
NO_STRCASESTR = YesPlease
193
NEEDS_LIBICONV = YesPlease
194
NO_IPV6 = YesPlease
195
X = .exe
196
PLATFORM_DEFINES += -DUSE_SYMLINK_HEAD=0
197
endif
190
-ifneq (,$(findstring arm,$(shell uname -m)))
191
- ARM_SHA1 = YesPlease
192
-endif
193
-ifeq ($(shell uname -s),OpenBSD)
198
+ifeq ($(uname_S),OpenBSD)
199
NEEDS_LIBICONV = YesPlease
200
PLATFORM_DEFINES += -I/usr/local/include -L/usr/local/lib
201
endif
202
+ifneq (,$(findstring arm,$(uname_M)))
203
+ ARM_SHA1 = YesPlease
204
+endif
205
206
ifndef NO_CURL
207
ifdef CURLDIR