- Cross platform. Same script will compile your sources for Linux or Windows or ...
- Support many tools out of the box (such as gcc/VC/java/tar ...)
- Calculate if a file has change by digital signature (and not by time stamp)
- Automatically cleans after itself (no more make clean)
Scons Makefile is called SConstruct, here is a simple one:
Program("hw", ["hw.c"])
Which tells scons to build an executable called hw from the source file hw.c
Calling scons on Linux will produce:
[15:10] /tmp/hw $scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o hw.o -c hw.c
gcc -o hw hw.o
scons: done building targets.
[15:10]
and on Windows it finds VC and invokes it:
C:\Temp\hw>scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cl /nologo /c hw.c /Fohw.obj
hw.c
link /nologo /OUT:hw.exe hw.obj
scons: done building targets.
C:\Temp\hw>
Cleaning is simple as well:
[15:19] /tmp/hw $scons -c
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Cleaning targets ...
Removed hw.o
Removed hw
scons: done cleaning targets.
[15:19] /tmp/hw $
All of this in one line of SConstruct.
(Shameless plug: See here for a longer article on the subject)
No comments:
Post a Comment