I have a implement a custom C compiler tool, but at the last step (linking) I am struggling to get it working. The linker produces to output files, one is the binary, and the second one is some file with additional information.
Normally you would have a wscript
with something like this:
def configure(cnf):
cnf.load('my_compiler_c')
def build(bld):
bld(features='c cprogram', source='main.c', target='app.bbin')
And I could fake a second target like this
class cprogram(link_task):
run_str = (
"${LINK_CC} ${CFLAGS} ${OTHERFLAGS} "
"${INFO_FILE}${TGT[0].relpath()+'.abc'} " # TGT[0] + some string concatenating will be the app.bbin.abc file
"${CCLNK_TGT_F}${TGT[0].relpath()} " # TGT[0] this is the app.bbin file
"${CCLNK_SRC_F}${SRC} ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} "
"${CSTLIB_ST:CSTLIB} ${STLIB_ST:STLIB} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB} ${LDFLAGS}"
)
ext_out = [".bbin"]
vars = ["LINKDEPS"]
But of course, with this hacky implementation waf does not know about the second target and rebuilds will not be triggered when app.bbin.abc is missing.
So how do I correctly pass two or more targets to the cprogram
class?