From 00fc8fb38aa9bf1cc46ec80ea0e268a28a19eedb Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 5 Oct 2014 20:46:18 +0300 Subject: [PATCH] build: split --cflags into --cflags and --ldflags clang dislikes some cflags if given to its linker. Unfortunately this means some options will need to be repeated. --- configure.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/configure.py b/configure.py index 0c33f92bf9..7f7748ff1f 100755 --- a/configure.py +++ b/configure.py @@ -75,6 +75,8 @@ arg_parser.add_argument('--mode', action='store', choices=list(modes.keys()) + [ arg_parser.add_argument('--with', dest='artifacts', action='append', choices=all_artifacts, default=[]) arg_parser.add_argument('--cflags', action = 'store', dest = 'user_cflags', default = '', help = 'Extra flags for the C++ compiler') +arg_parser.add_argument('--ldflags', action = 'store', dest = 'user_ldflags', default = '', + help = 'Extra flags for the linker') arg_parser.add_argument('--compiler', action = 'store', dest = 'cxx', default = 'g++', help = 'C++ compiler path') args = arg_parser.parse_args() @@ -91,8 +93,8 @@ with open(buildfile, 'w') as f: configure_args = {configure_args} builddir = {outdir} cxx = {cxx} - cxxflags = -std=gnu++1y -g -Wall -Werror -fvisibility=hidden -pthread -I. {user_cflags} - ldflags = -Wl,--no-as-needed {static} + cxxflags = -std=gnu++1y -Wall -Werror -fvisibility=hidden -pthread -I. {user_cflags} + ldflags = -Wl,--no-as-needed {static} -fvisibility=hidden -pthread {user_ldflags} libs = {libs} rule ragel command = ragel -G2 -o $out $in @@ -108,7 +110,7 @@ with open(buildfile, 'w') as f: description = CXX $out depfile = $out.d rule link.{mode} - command = $cxx $cxxflags $cxxflags_{mode} $ldflags -o $out $in $libs $libs_{mode} + command = $cxx $cxxflags_{mode} $ldflags -o $out $in $libs $libs_{mode} description = LINK $out ''').format(mode = mode, **modeval)) f.write('build {mode}: phony {artifacts}\n'.format(mode = mode,