[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCHv5 02/46] build: Add a makefile function to check GCC version



Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>

On 10.08.2018 09:07, Wei Chen wrote:
From: Wei Chen <Wei.Chen@xxxxxxx>

In this patch, we add a gcc_version_ge function to test GCC
version and return a result. In this case, this function can
be used not only for processor flags check, but also can be
used in other places of Unikraft.

Signed-off-by: Wei Chen <Wei.Chen@xxxxxxx>
---
  Makefile                     | 4 ++++
  support/build/Makefile.rules | 5 +++++
  2 files changed, 9 insertions(+)

diff --git a/Makefile b/Makefile
index d10f53b..e133039 100644
--- a/Makefile
+++ b/Makefile
@@ -428,6 +428,10 @@ LIFTOFF            := liftoff -e -s
  override ARFLAGS:= rcs
  CC_VERSION    := $(shell $(CC) --version | \
                   sed -n -r 's/^.* ([0-9]*)\.([0-9]*)\.([0-9]*)[ ]*.*/\1.\2/p')
+# Retrieve GCC major and minor number from CC_VERSION. They would be used
+# to select correct optimization parameters for target CPUs.
+CC_VER_MAJOR   := $(word 1,$(subst ., ,$(CC_VERSION)))
+CC_VER_MINOR   := $(word 2,$(subst ., ,$(CC_VERSION)))
ASFLAGS += -DCC_VERSION=$(CC_VERSION)
  CFLAGS                += -DCC_VERSION=$(CC_VERSION)
diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index e317e3d..6e71c5e 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -29,6 +29,11 @@ lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst 
E,e,$(subst F,f,$(s
  # upper case
  uc = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst 
f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst 
l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst 
r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst 
x,X,$(subst y,Y,$(subst z,Z,$(1)))))))))))))))))))))))))))
+# test whether GCC version is greater than or equal to the minimum requirement
+# gcc_version_ge $gcc_major,$gcc_minor
+define gcc_version_ge =
+$(shell if [ $(CC_VER_MAJOR) -gt $(1) ] || ([ $(CC_VER_MAJOR) -eq $(1) ] && [ 
$(CC_VER_MINOR) -ge $(2) ]) ; then echo y ; fi)
+endef
################################################################################
  #


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.