pretty code

2008年9月29日 星期一

Global 使用說明

1.下載 win32版本
http://www.geocities.com/jadoxa/global/index.html

2.切到 source code root 目錄下

3.set path=e:\Global\bin

4.執行 gtags ,會在 2 的目錄下產生相關檔案。

5.執行 htags 搭配相關參數,便能產生你要的網頁。

htags -s
會產生變數的參照,方便尋找變數的宣告位置。

htags -a
會產生函數的參照,方便尋找函數的呼叫位置。

小型專案可以考慮 htags -sna
大型專案建議使用 htags -na


`-v', `--verbose'
Verbose mode.

`-s', `--symbol'
Make anchors not only for object definitions and references but also other symbols.

`-a', `--alphabet'
Make an alphabetical function index which is suitable for a large project.

`-n', `--line-number'[=columns]
Print line numbers. By default, doesn't print line numbers. The default value of columns is 4.

`-o', `--other'
Pick up not only source files but also other files except for binary files.

`-h', `--func-header'[=position]
Insert function header for each function. By default, htags doesn't generates it. You can specify the position using position argument, which allows one of before, right and after. The default position is after.

`-T', `--table-flist'[=fields]
Generate file list using tag. The fields is used for field number in a line. The default is 5.

`-F', `--frame'
Use frame for each part of the contents.

`-f', `--form'
Support search form using CGI program. You need to set up a web server, and you cannot move the hypertext from the source directory.

2008年9月2日 星期二

makefile 概述



如果 make 後面不指定 makefile name(gnu make use -f)
則預設使用當前路徑下的 makefile。

如果 make 後面不加 target
則預設去找第一個(本例的 test)
故只會印出 Just Test 的字串。

一般來說會將 all 擺在第一個
也就是預設 make 是做 make all。

make all 的順序:
1. 先找 mytest 的 target。
2. 做 mytest 前必須要有 main.o, TestDef.o。
3. 找到 main.o 的 target。
4. 做該 target 的事。
5. 找到 TestDef.o 的 target。
6. 做該 target 的事。
7. 最後做 mytest 要做的事,編出 mytest 的執行檔。

一些符號的意義:

- 表示忽略錯誤
@ 表示不印出訊息

以下來自 "http://www.study-area.org/cyril/opentools/opentools/x1176.html"

%.o: %.c

%表示所有相對於後面先決條件的檔名的意思,他不是*,因為他有一對一的相對應關係,foo.o 就要找foo.c。

foo.o: foo.c foo.h

$@ -- foo.o
$* -- 這個只有在內隱規則中有用。表示樣式或副檔名規則中對應到的字串。
$< -- foo.c
$? -- 同一個規則的所有先決條件名,但是只有原始程式碼改過的比 obj 檔新才會符合,也就是比 target 還新的先決條件檔案。
$^-- 所有先決條件,但是有的 make 像 solaris make 可能不認得這個自動變數。