From 0cd060c394abd721b0cfb56d45e469dba3d81b11 Mon Sep 17 00:00:00 2001 From: Thomas Nagy Date: Tue, 11 Mar 2014 21:23:57 +0100 Subject: [PATCH] Make it easier to declare asm or preprocessed outputs to c/c++ tasks The following can be used to add asm outputs to a c++ task (gcc): from waflib import Task from waflib.TaskGen import feature, after_method @feature('cxx') @after_method('process_source') def add_asm_outputs(self): for tsk in self.compiled_tasks: node2 = tsk.outputs[0].change_ext('.s') tsk.env.append_value('CXXFLAGS', '-Wa,-adhln=%s' % node2.abspath()) tsk.outputs.append(node2) --- waflib/Tools/c.py | 2 +- waflib/Tools/cxx.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/waflib/Tools/c.py b/waflib/Tools/c.py index 4b8046ed..b97eee15 100644 --- a/waflib/Tools/c.py +++ b/waflib/Tools/c.py @@ -17,7 +17,7 @@ def c_hook(self, node): class c(Task.Task): "Compile C files into object files" - run_str = '${CC} ${ARCH_ST:ARCH} ${CFLAGS} ${CPPFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT}' + run_str = '${CC} ${ARCH_ST:ARCH} ${CFLAGS} ${CPPFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT[0].abspath()}' vars = ['CCDEPS'] # unused variable to depend on, just in case ext_in = ['.h'] # set the build order easily by using ext_out=['.h'] scan = c_preproc.scan diff --git a/waflib/Tools/cxx.py b/waflib/Tools/cxx.py index a982227a..9e1777d4 100644 --- a/waflib/Tools/cxx.py +++ b/waflib/Tools/cxx.py @@ -18,7 +18,7 @@ if not '.c' in TaskGen.task_gen.mappings: class cxx(Task.Task): "Compile C++ files into object files" - run_str = '${CXX} ${ARCH_ST:ARCH} ${CXXFLAGS} ${CPPFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CXX_SRC_F}${SRC} ${CXX_TGT_F}${TGT}' + run_str = '${CXX} ${ARCH_ST:ARCH} ${CXXFLAGS} ${CPPFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CXX_SRC_F}${SRC} ${CXX_TGT_F}${TGT[0].abspath()}' vars = ['CXXDEPS'] # unused variable to depend on, just in case ext_in = ['.h'] # set the build order easily by using ext_out=['.h'] scan = c_preproc.scan