linux内核使用scons构建,scons安装和使用

scons安装和使用

1. scons是神马?

scons是linux下的自动构建工具,类似cmake。

2. 安装

wget http://prdownloads.sourceforge.net/scons/scons-2.2.0.tar.gz .

tar zxvf scons-2.2.0.tar.gz

cd scons-2.2.0

python setup.py install

正常情况下,scons将安装到${PYTHON_INSTALL_DIR}/bin/下

3. hello world程序

三个文件hello.h hello.c main.c hello.h定义函数void hello(); hello.c中实现该函数,main.c中调用该函数。

编写SConstruct,scons构建时使用。内容如下:

Program('hello', ['hello.c', 'main.c'])

开始构建

scons: Reading SConscript files ...

scons: done reading SConscript files.

scons: Building targets ...

gcc -o hello.o -c hello.c

gcc -o main.o -c main.c

gcc -o hello hello.o main.o

scons: done building targets.

此时二进制文件已经构建完成,scons贼好用。

4. 参考资料

更多配置:http://www.linuxidc.com/Linux/2013-02/79467.htm

相关代码下载:

具体下载目录在 /2013年资料/2月/16日/scons安装和使用0b1331709591d260c1c78e86d0c51c18.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值