0
votes

I'm trying to use the Keil C51 compiler with scons as a build system.

The final problem I have is how to get $SOURCES to be output comma-separated to the linker. The default uses space as separator.

The relevant parts of the SConstruct is

path = ['C:\Keil\C51\BIN']
env = Environment(ENV = {'PATH' : path})

#Compiler settings
env['CC']        = 'c51.exe' 
env['CCCOM']     = '$CC $SOURCES $_CPPINCFLAGS $CFLAGS  $_CCCOMCOM ' #-o $TARGET 
env['INCPREFIX']  = 'INCDIR('
env['INCSUFFIX']  = ')'

# Linker settings
env.Replace(LINK='BL51.exe')
env['LINKCOM']     = '$LINK $SOURCES TO $TARGET $LINKFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'

With this I get:

BL51.exe driver.obj flash.obj initialization.obj power.obj TO Outfile.omf

What I want is:

BL51.exe driver.obj,flash.obj,initialization.obj,power.obj TO Outfile.omf

$SOURCES is a construction variable and I cant find how to change how it is printed to the command-line.

Anyone?

1
I dont think there is a standard way to do that in SCons without creating your own builder. - Brady
Where is it concatenated? Is it implicit from being a list or is it done in scons? - FkYkko
The Python list separator (look up the string.join(listVar) function) is quite easy to change. Considering that most C/C++ compilers expect a space between files, its probably concatenated internally by SCons. Unfortunately, you may have to write your own builder. - Brady

1 Answers

1
votes

I solved this by using:

    env['LINKCOM']     = '$LINK ",".join( $SOURCES ) TO $TARGET $LINKFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'