Browse code

Makefile.defs: get clang version only from --version output

- the full version with stderr output included has a different first
line on MacOS, making head -n 1 not extract the version number line

Daniel-Constantin Mierla authored on 04/08/2020 06:36:18
Showing 1 changed files
... ...
@@ -273,7 +273,7 @@ MKTAGS=ctags
273 273
 ifneq (,$(findstring gcc, $(CC_LONGVER)))
274 274
 	CC_NAME=gcc
275 275
 	RPAREN=)
276
-	CC_VER:=$(word 1,$(CC)) $(shell $(CC) - --version|head -n 1|\
276
+	CC_VER:=$(word 1,$(CC)) $(shell $(CC) - --version 2>/dev/null|head -n 1|\
277 277
 				sed  -e 's/([^$(RPAREN)]*)//g' \
278 278
 					 -e 's/^.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'\
279 279
 					 -e 's/^[^0-9].*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/')
... ...
@@ -335,7 +335,7 @@ endif
335 335
 ifneq (, $(findstring clang, $(CC_LONGVER)))
336 336
 	#clang should be gcc compatible
337 337
 	CC_NAME=clang
338
-	CC_FULLVER:=$(shell echo "$(CC_LONGVER)" | head -n 1 |  sed -e 's/.*version \([0-9]\.[0-9]\).*/\1/g' )
338
+	CC_FULLVER:=$(shell $(CC) --version 2>/dev/null | head -n 1 | sed -e 's/.*version \([0-9]\.[0-9]\).*/\1/g' )
339 339
 	CC_SHORTVER:=$(shell echo "$(CC_FULLVER)" | cut -d. -f1,2 )
340 340
 	CC_VER=$(CC) $(CC_FULLVER)
341 341
 	CC_OPT=-O3