Home | Mirror | Search

2. scons - a software construction tool

http://www.scons.org/

創建一個hello.c測試檔案

		
#include<stdio.h>

main()
{
    printf("Hello World!\n");
}
		
		

創建SConstruct檔案(相當於Makefile)

$ cat SConstruct
Program('hello.c')
		

開始編譯

$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o hello.o -c hello.c
gcc -o hello hello.o
scons: done building targets.
		

編譯後產生的檔案,嘗試運行hello程序

$ ls
hello  hello.c  hello.o  SConstruct

$ ./hello
Hello World!
		

下面操作想當於 make clean

$ scons -c
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Cleaning targets ...
Removed hello.o
Removed hello
scons: done cleaning targets.

$ ls
hello.c  SConstruct
		
comments powered by Disqus