Skip to content

Instantly share code, notes, and snippets.

@AbigailBuccaneer
Created February 24, 2016 15:09
Show Gist options
  • Save AbigailBuccaneer/96398670bcc79413bc70 to your computer and use it in GitHub Desktop.
Save AbigailBuccaneer/96398670bcc79413bc70 to your computer and use it in GitHub Desktop.
Single SConstruct
$ touch libfoo.c
$ echo "int main(void) { return 0; }" > foo.c
$ cat SConstruct
env = Environment()
lib = env.Library('libfoo', 'libfoo.c')
program = env.Program('foo', LIBS=[lib])
$ scons --tree=all
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o foo.o -c foo.c
gcc -o libfoo.o -c libfoo.c
ar rc libfoo.a libfoo.o
ranlib libfoo.a
gcc -o foo foo.o libfoo.a
+-.
+-SConstruct
+-foo
| +-foo.o
| | +-foo.c
| | +-/usr/bin/gcc
| +-/usr/bin/gcc
| +-libfoo.a
| +-libfoo.o
| | +-libfoo.c
| | +-/usr/bin/gcc
| +-/usr/bin/ar
| +-/usr/bin/ranlib
+-foo.c
+-foo.o
| +-foo.c
| +-/usr/bin/gcc
+-libfoo.a
| +-libfoo.o
| | +-libfoo.c
| | +-/usr/bin/gcc
| +-/usr/bin/ar
| +-/usr/bin/ranlib
+-libfoo.c
+-libfoo.o
+-libfoo.c
+-/usr/bin/gcc
scons: done building targets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment