Skip to content

Instantly share code, notes, and snippets.

@AbigailBuccaneer
Last active January 22, 2016 16:01
Show Gist options
  • Save AbigailBuccaneer/c3c26cacf2c036895b0b to your computer and use it in GitHub Desktop.
Save AbigailBuccaneer/c3c26cacf2c036895b0b to your computer and use it in GitHub Desktop.
SConstruct won't find implicit dependencies on files which don't yet exist
#!/bin/bash
echo "hello world!"
dummy text
env = Environment()
# preprocess compiler.in to compiler
compiler = env.Command('compiler', 'compiler.in', 'cp $SOURCE $TARGET')
env['compiler'] = File(compiler)[0].abspath
# and then use that to compile foo.in
target = env.Command('foo', 'foo.in', '$compiler < $SOURCE > $TARGET')
Default(target)
$ scons -c
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Cleaning targets ...
scons: done cleaning targets.
$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
/home/abigail/scons/compiler < foo.in > foo
sh: 1: /home/abigail/scons/compiler: not found
scons: *** [foo] Error 127
scons: building terminated because of errors.
$ scons compiler
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cp compiler.in compiler
scons: done building targets.
$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
/home/abigail/scons/compiler < foo.in > foo
scons: done building targets.
$ echo 'echo "more stuff"' >> compiler.in
$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cp compiler.in compiler
/home/abigail/scons/compiler < foo.in > foo
scons: done building targets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment