Limbo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCCVersion.mk
Go to the documentation of this file.
1 ## @file GCCVersion.mk
2 ## @brief compute version of CXX, set GCCVERSION, assume CXX is gcc
3 ##
4 ## calculate gcc version without . and save to GCCVERSION
5 ## Use following command in the Makefile to view the results
6 ##
7 ## $(info GCCVERSION = $(GCCVERSION))
8 ##
9 ## @author Yibo Lin
10 ## @date Aug 2015
11 ##
12 ## @param CXX given CXX and assume it is gcc
13 ## @param GCCVERSION set version of gcc
14 
15 ## @cond
16 
17 empty:=
18 space:= $(empty) $(empty)
19 GCCVERSIONSTRING := $(shell expr `$(CXX) -dumpversion`)
20 #Create version number without "."
21 GCCVERSION := $(shell expr `echo $(GCCVERSIONSTRING)` | cut -f1 -d.)
22 GCCVERSION += $(shell expr `echo $(GCCVERSIONSTRING)` | cut -f2 -d.)
23 GCCVERSION += $(shell expr `echo $(GCCVERSIONSTRING)` | cut -f3 -d.)
24 # Make sure the version number has at least 3 decimals
25 GCCVERSION += 00
26 # Remove spaces from the version number
27 GCCVERSION := $(subst $(space),$(empty),$(GCCVERSION))
28 # Crop the version number to 3 decimals.
29 GCCVERSION := $(shell expr `echo $(GCCVERSION)` | cut -b1-3)
30 
31 ## @endcond