2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-12-25 02:35:04 +01:00

Inserting LDFLAGS at the end of the command-line causes less overhead than expected, and LINKFLAGS can still be used for flags in the beginning of the line

This commit is contained in:
Thomas Nagy 2015-04-22 21:34:45 +02:00
parent 7d039ef84c
commit 924f8bbce8
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
5 changed files with 15 additions and 16 deletions

View File

@ -4,7 +4,7 @@
"Base for c programs/libraries"
from waflib import TaskGen, Task, Utils
from waflib import TaskGen, Task
from waflib.Tools import c_preproc
from waflib.Tools.ccroot import link_task, stlink_task
@ -24,7 +24,7 @@ class c(Task.Task):
class cprogram(link_task):
"Link object files into a c program"
run_str = '${LINK_CC} ${LINKFLAGS} ${CCLNK_SRC_F}${SRC} ${CCLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${FRAMEWORK_ST:FRAMEWORK} ${ARCH_ST:ARCH} ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} ${STLIB_ST:STLIB} ${SHLIB_MARKER} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB}'
run_str = '${LINK_CC} ${LINKFLAGS} ${CCLNK_SRC_F}${SRC} ${CCLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${FRAMEWORK_ST:FRAMEWORK} ${ARCH_ST:ARCH} ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} ${STLIB_ST:STLIB} ${SHLIB_MARKER} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB} ${LDFLAGS}'
ext_out = ['.bin']
vars = ['LINKDEPS']
inst_to = '${BINDIR}'

View File

@ -929,7 +929,7 @@ def get_config_header(self, defines=True, headers=False, define_prefix=''):
@conf
def cc_add_flags(conf):
"""
Read the CFLAGS/CPPFLAGS from os.environ and add to conf.env.CFLAGS
Add CFLAGS / CPPFLAGS from os.environ to conf.env
"""
conf.add_os_flags('CPPFLAGS', 'CFLAGS')
conf.add_os_flags('CFLAGS')
@ -937,7 +937,7 @@ def cc_add_flags(conf):
@conf
def cxx_add_flags(conf):
"""
Read the CXXFLAGS/CPPFLAGS and add to conf.env.CXXFLAGS
Add CXXFLAGS / CPPFLAGS from os.environ to conf.env
"""
conf.add_os_flags('CPPFLAGS', 'CXXFLAGS')
conf.add_os_flags('CXXFLAGS')
@ -945,10 +945,10 @@ def cxx_add_flags(conf):
@conf
def link_add_flags(conf):
"""
Read the LINKFLAGS/LDFLAGS and add to conf.env.LDFLAGS
Add LINKFLAGS / LDFLAGS from os.environ to conf.env
"""
conf.add_os_flags('LINKFLAGS')
conf.add_os_flags('LDFLAGS', 'LINKFLAGS')
conf.add_os_flags('LDFLAGS')
@conf
def cc_load_tools(conf):

View File

@ -4,7 +4,7 @@
"Base for c++ programs and libraries"
from waflib import TaskGen, Task, Utils
from waflib import TaskGen, Task
from waflib.Tools import c_preproc
from waflib.Tools.ccroot import link_task, stlink_task
@ -25,7 +25,7 @@ class cxx(Task.Task):
class cxxprogram(link_task):
"Link object files into a c++ program"
run_str = '${LINK_CXX} ${LINKFLAGS} ${CXXLNK_SRC_F}${SRC} ${CXXLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${FRAMEWORK_ST:FRAMEWORK} ${ARCH_ST:ARCH} ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} ${STLIB_ST:STLIB} ${SHLIB_MARKER} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB}'
run_str = '${LINK_CXX} ${LINKFLAGS} ${CXXLNK_SRC_F}${SRC} ${CXXLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${FRAMEWORK_ST:FRAMEWORK} ${ARCH_ST:ARCH} ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} ${STLIB_ST:STLIB} ${SHLIB_MARKER} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB} ${LDFLAGS}'
vars = ['LINKDEPS']
ext_out = ['.bin']
inst_to = '${BINDIR}'

View File

@ -7,11 +7,9 @@
fortran support
"""
import re
from waflib import Utils, Task, TaskGen, Logs
from waflib import Utils, Task, Logs
from waflib.Tools import ccroot, fc_config, fc_scan
from waflib.TaskGen import feature, before_method, after_method, extension
from waflib.TaskGen import feature, extension
from waflib.Configure import conf
ccroot.USELIB_VARS['fc'] = set(['FCFLAGS', 'DEFINES', 'INCLUDES'])
@ -152,7 +150,7 @@ class fc(Task.Task):
class fcprogram(ccroot.link_task):
"""Link fortran programs"""
color = 'YELLOW'
run_str = '${FC} ${LINKFLAGS} ${FCLNK_SRC_F}${SRC} ${FCLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FCSTLIB_MARKER} ${FCSTLIBPATH_ST:STLIBPATH} ${FCSTLIB_ST:STLIB} ${FCSHLIB_MARKER} ${FCLIBPATH_ST:LIBPATH} ${FCLIB_ST:LIB}'
run_str = '${FC} ${LINKFLAGS} ${FCLNK_SRC_F}${SRC} ${FCLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FCSTLIB_MARKER} ${FCSTLIBPATH_ST:STLIBPATH} ${FCSTLIB_ST:STLIB} ${FCSHLIB_MARKER} ${FCLIBPATH_ST:LIBPATH} ${FCLIB_ST:LIB} ${LDFLAGS}'
inst_to = '${BINDIR}'
class fcshlib(fcprogram):
@ -183,7 +181,7 @@ class fcprogram_test(fcprogram):
kw['output'] = 0
try:
(bld.out, bld.err) = bld.cmd_and_log(cmd, **kw)
except Exception as e:
except Exception:
return -1
if bld.out:

View File

@ -49,10 +49,11 @@ def fc_flags(conf):
@conf
def fc_add_flags(conf):
"""
FCFLAGS?
Add FCFLAGS / LDFLAGS / LINKFLAGS from os.environ to conf.env
"""
conf.add_os_flags('FCFLAGS')
conf.add_os_flags('LDFLAGS', 'LINKFLAGS')
conf.add_os_flags('LINKFLAGS')
conf.add_os_flags('LDFLAGS')
@conf
def check_fortran(self, *k, **kw):