Wednesday, December 09, 2009

常用的 Makefile 建置目標

3.3 The most useful Makefile targets / 常用的 Makefile 建置目標

By now `configure' has generated the output files such as a `Makefile'. Most projects include a `Makefile' with a basic set of well-known targets (see section 4.1 Targets and dependencies). A target is a name of a task that you want make to perform -- usually it is to build all of the programs belonging to your package (commonly known as the all target). From your build directory, the following commands are likely to work for a configured package:

截至目前為止,我們已經提到 `configure' 會產生一些輸出檔,比如 `Makefile' 檔案。大部分的專案會準備一個內建有常見建置目標的 `Makefile' 檔案 (請見 4.1 建置目標與相依性)。一個建置目標是一個你希望 make 幫你完成的工作的名稱 -- 比如,建置所有套件中的程式 (常見的 all 建置目標)。在已經完成套件組態的建置資料夾中,通常可以使用以下的指令:

make all

Builds all derived files sufficient to declare the package built.

建置出所有足使這個套件發揮功能的必要檔案。

make check

Runs any self-tests that the package may have.

執行在套件內所準備的自我測試程式。

make install

Installs the package in a predetermined location.

將套件檔案安裝到預先設定好的路徑中。

make clean

Removes all derived files.

刪除所有在建置過程中所產生的檔案。

There are other less commonly used targets which are likely to be recognized, particularly if the package includes a `Makefile' which conforms to the GNU `Makefile' standard or is generated by automake. You may wish to inspect the generated `Makefile' to see what other targets have been included.

還有一些比較少用到但是通常有支援的建置目標,特別是那些遵守了 GNU `Makefile' 標準或是由 automake 所產生的 `Makefile' 檔案。要知道所產生的 `Makefile' 支援了哪些建置目標,你可能需要看看所產生出來的 `Makefile' 檔案的內容。