2 ## @brief compute version of CXX, set GCCVERSION, assume CXX is gcc
4 ## calculate gcc version without . and save to GCCVERSION
5 ## Use following command in the Makefile to view the results
7 ## $(info GCCVERSION = $(GCCVERSION))
12 ## @param CXX given CXX and assume it is gcc
13 ## @param GCCVERSION set version of gcc
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
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)