From 3d0f4fd756f4802bfd8dff41da9492e4d1ad43b0 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 7 Oct 2020 06:45:36 +0000 Subject: [PATCH] backporting: cleanup Makefile, use -std=gnu99 by default, honor CFLAGS and LDFLAGS (CentOS 6.9) --- Makefile | 2 +- vlib/v/builder/cc.v | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1a615909c7..855f91559b 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ else $(V) self endif else - $(CC) $(CFLAGS) -g -std=gnu11 -w -o $(V) $(VC)/$(VCFILE) $(LDFLAGS) -lm -lpthread + $(CC) $(CFLAGS) -g -std=gnu99 -w -o $(V) $(VC)/$(VCFILE) -lm -lpthread $(LDFLAGS) ifdef ANDROID chmod 755 v endif diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index 6d1ddf7a97..4d4e10b511 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -155,7 +155,7 @@ fn (mut v Builder) cc() { // '-Werror', // TODO : try and remove the below workaround options when the corresponding // warnings are totally fixed/removed - mut args := [v.pref.cflags, '-std=gnu11', '-Wall', '-Wextra', '-Wno-unused-variable', '-Wno-unused-parameter', + mut args := [v.pref.cflags, '-std=gnu99', '-Wall', '-Wextra', '-Wno-unused-variable', '-Wno-unused-parameter', '-Wno-unused-result', '-Wno-unused-function', '-Wno-missing-braces', '-Wno-unused-label'] if v.pref.os == .ios { args << '-framework Foundation' @@ -448,7 +448,9 @@ fn (mut v Builder) cc() { if !v.pref.is_bare && v.pref.os == .js && os.user_os() == 'linux' { linker_flags << '-lm' } - str_args := args.join(' ') + ' ' + linker_flags.join(' ') + env_cflags := os.getenv('CFLAGS') + env_ldflags := os.getenv('LDFLAGS') + str_args := env_cflags + ' ' + args.join(' ') + ' ' + linker_flags.join(' ') + ' ' + env_ldflags if v.pref.is_verbose { println('cc args=$str_args') println(args)