SCons User Guide 0.96 | ||
---|---|---|
<<< Previous | Next >>> |
In this chapter, you will see several examples of very simple build configurations using SCons, which will demonstrate how easy it is to use SCons to build programs from several different programming languages on different types of systems.
You've seen that when you call the Program builder method, it builds the resulting program with the same base name as the source file. That is, the following call to build an executable program from the hello.c source file will build an executable program named hello on POSIX systems, and an executable program named hello.exe on Windows systems:
Program('hello.c') |
If you want to build a program with a different name than the base of the source file name, you simply put the target file name to the left of the source file name:
Program('new_hello', 'hello.c') |
(SCons requires the target file name first, followed by the source file name, so that the order mimics that of an assignment statement in most programming languages, including Python: "program = source files".)
Now SCons will build an executable program named new_hello when run on a POSIX system:
% scons -Q cc -c -o hello.o hello.c cc -o new_hello hello.o |
And SCons will build an executable program named new_hello.exe when run on a Windows system:
C:\>scons -Q cl /nologo /c hello.c /Fohello.obj link /nologo /OUT:new_hello.exe hello.obj |
<<< Previous | Home | Next >>> |
Making the SCons Output Less Verbose | Compiling Multiple Source Files |