Created
December 2, 2010 18:47
-
-
Save dbach/725835 to your computer and use it in GitHub Desktop.
sample scons source
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
driver_sources = [ ... ] | |
# original | |
#d = [env.Object(src, src) for src in driver_sources] | |
#env.Library(d) | |
# my comments: | |
# env.Object(src, src) is weird because you're using the same name | |
# for source and target. | |
# I prefer just to let scons sort out the object names: | |
env.Library('libdriver', driver_sources) | |
env_flag = env.Clone() | |
env_flag.Append(CPPDEFINES = ['FLAG']) | |
# in the new env, we can't let scons sort out the object names itself | |
# because that causes name conflicts | |
# the original solution ends up with weird object names | |
#d_wf = [env_flag.Object(src + '.flag', src) for src in driver_sources] | |
#env_flag.Library(d_wf) | |
# I ended up with the following: | |
# first generate a list of object names | |
flag_objects = [os.path.splitext(src)[0] + '_flag' + env['OBJSUFFIX'] for src in driver_sources] | |
# now tell scons how to make the objects | |
d_wf = [env_flag.Object(tgt, src) for tgt,src in zip(flag_objects, driver_sources)] | |
env_flag.Library(d_wf) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment