[sr-dev] git:master:bff689cf: Makefile.defs: get clang version only from --version output

Daniel-Constantin Mierla miconda at gmail.com
Tue Aug 4 08:38:26 CEST 2020


Module: kamailio
Branch: master
Commit: bff689cfedca70149e17b6ec3584ca9ecab71418
URL: https://github.com/kamailio/kamailio/commit/bff689cfedca70149e17b6ec3584ca9ecab71418

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-08-04T08:36:18+02:00

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

---

Modified: src/Makefile.defs

---

Diff:  https://github.com/kamailio/kamailio/commit/bff689cfedca70149e17b6ec3584ca9ecab71418.diff
Patch: https://github.com/kamailio/kamailio/commit/bff689cfedca70149e17b6ec3584ca9ecab71418.patch

---

diff --git a/src/Makefile.defs b/src/Makefile.defs
index 296e7df727..d65a1e2f6b 100644
--- a/src/Makefile.defs
+++ b/src/Makefile.defs
@@ -273,7 +273,7 @@ MKTAGS=ctags
 ifneq (,$(findstring gcc, $(CC_LONGVER)))
 	CC_NAME=gcc
 	RPAREN=)
-	CC_VER:=$(word 1,$(CC)) $(shell $(CC) - --version|head -n 1|\
+	CC_VER:=$(word 1,$(CC)) $(shell $(CC) - --version 2>/dev/null|head -n 1|\
 				sed  -e 's/([^$(RPAREN)]*)//g' \
 					 -e 's/^.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'\
 					 -e 's/^[^0-9].*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/')
@@ -335,7 +335,7 @@ endif
 ifneq (, $(findstring clang, $(CC_LONGVER)))
 	#clang should be gcc compatible
 	CC_NAME=clang
-	CC_FULLVER:=$(shell echo "$(CC_LONGVER)" | head -n 1 |  sed -e 's/.*version \([0-9]\.[0-9]\).*/\1/g' )
+	CC_FULLVER:=$(shell $(CC) --version 2>/dev/null | head -n 1 | sed -e 's/.*version \([0-9]\.[0-9]\).*/\1/g' )
 	CC_SHORTVER:=$(shell echo "$(CC_FULLVER)" | cut -d. -f1,2 )
 	CC_VER=$(CC) $(CC_FULLVER)
 	CC_OPT=-O3




More information about the sr-dev mailing list