scons安裝和使用

2021-06-23 01:13:02 字數 727 閱讀 4421

1. scons是神馬?

scons是linux下的自動構建工具,類似cmake。

2. 安裝

wget .

tar zxvf scons-2.2.0.tar.gz

cd scons-2.2.0

python setup.py install

正常情況下,scons將安裝到$/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. 參考資料

更多配置:

scons安裝和使用

1.scons是神馬?scons是linux下的自動構建工具,類似cmake。2.安裝 wget tar zxvf scons 2.2.0.tar.gz cd scons 2.2.0 python setup.py install 正常情況下,scons將安裝到 bin 下 3.hello worl...

Scons使用一二

無意中看到了乙個用python來寫makefile的工具scons,使用了一下,感覺還不錯,記錄一下。pip install scons以之前構建的freertos的simulator做範例。首先需要在目錄下建立乙個名為sconstruct的檔案,scons通過解析該檔案來進行編譯。我們在檔案中首先...

scons使用說明

前言 make 這個工具自上個世紀 70 年代 stuart feldman 在貝爾實驗室開發出以來,就一直是類 unix 程式設計師的最愛之一。通過檢查檔案的修改時間,make 工具可以知道編譯目標檔案所要依賴的其他檔案。在複雜的專案中,如果只有少數幾個檔案修改過,make 工具知道僅僅需要對哪些...