[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [UNIKRAFT PATCH 2/3] support/build: Add build functions for clang and gcc check
On 21.11.20 17:34, Vlad-Andrei Badoiu wrote: We add have_gcc and have_clang. We modify gcc_version_ge to use have_gcc. Signed-off-by: Alice Suiu <alicesuiu17@xxxxxxxxx> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxx> --- support/build/Makefile.rules | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules index 9a5963fd..ecd409f0 100644 --- a/support/build/Makefile.rules +++ b/support/build/Makefile.rules @@ -29,10 +29,20 @@ 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 if GCC is set as a compiler+define have_gcc = +$(shell if [ $(CC) = gcc ] ; then echo y ; else echo n ; fi) +endef + +# test if CLANG is set as a compiler +define have_clang = +$(shell if [ $(CC) == clang ] ; then echo y ; else echo n ; fi) I just found that use a double `=` for the clang check but a single `=` for the gcc check. In general, a single `=` should just work. +endef + # 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) +$(shell if [ $(call have_gcc) = y ] ; then if [ $(CC_VER_MAJOR) -gt $(1) ] || ([ $(CC_VER_MAJOR) -eq $(1) ] && [ $(CC_VER_MINOR) -ge $(2) ]) ; then echo y ; fi ; else echo n ; fi) endef Out of curiosity, I guess you also plan to add a command like `clang_version_ge`? ;-) # print error and stop build when GCC version doesn't meet the minimum requirement
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |