backporting: cleanup Makefile, use -std=gnu99 by default, honor CFLAGS and LDFLAGS (CentOS 6.9)

pull/6573/head
Delyan Angelov 2020-10-07 06:45:36 +00:00
parent b940dc4f8a
commit 3d0f4fd756
2 changed files with 5 additions and 3 deletions

View File

@ -54,7 +54,7 @@ else
$(V) self $(V) self
endif endif
else 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 ifdef ANDROID
chmod 755 v chmod 755 v
endif endif

View File

@ -155,7 +155,7 @@ fn (mut v Builder) cc() {
// '-Werror', // '-Werror',
// TODO : try and remove the below workaround options when the corresponding // TODO : try and remove the below workaround options when the corresponding
// warnings are totally fixed/removed // 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'] '-Wno-unused-result', '-Wno-unused-function', '-Wno-missing-braces', '-Wno-unused-label']
if v.pref.os == .ios { if v.pref.os == .ios {
args << '-framework Foundation' 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' { if !v.pref.is_bare && v.pref.os == .js && os.user_os() == 'linux' {
linker_flags << '-lm' 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 { if v.pref.is_verbose {
println('cc args=$str_args') println('cc args=$str_args')
println(args) println(args)