1. makeの概要 | Overview of make.
| |
| 2. イントロダクション | An introduction to make.
| |
| 3. Makefileの記述 | Makefiles tell make what to do.
| |
| 4. ルールの記述 | Rules describe when a file must be remade. | |
| 5. ルールのなかでのコマンドの書き方 | Commands say how to remake a file. | |
| 6. 変数の使用法 | You can use variables to avoid repetition. | |
| 7. Makefileの条件文 | Use or ignore parts of the makefile based on the values of variables. | |
| 8. テキスト変換のためのファンクション | Many powerful ways to manipulate text. | |
9. makeをどのように実行するか | How to invoke make on the command line.
| |
| 10. 暗黙のルールの使用 | Use implicit rules to treat many files alike, based on their file names. | |
11. アーカイブファイルのアップデートにmakeを使用する | How make can update library archives.
| |
12. GNU makeの機能 | Features GNU make has over other makes.
| |
| 13. 非互換性と欠けている機能 | What GNU make lacks from other makes.
| |
| 14. Makefileの約束ごと | Conventions for makefiles in GNU programs. | |
| A. クイックリファレンス | A quick reference for experienced users. | |
| B. Makeが生成するエラー | A list of common errors generated by make.
| |
| C. 複雑なMakefileの例 | A real example of a straightforward, but nontrivial, makefile. | |
| 概念索引 | Index of Concepts | |
| 関数/変数/ディレクティブ索引 | Index of Functions, Variables, & Directives | |
— The Detailed Node Listing —
Overview of | ||
|---|---|---|
| • Preparing | Preparing and Running Make | |
| 1.1 マニュアルの読み方 | On Reading this Text | |
| 1.2 問題とバグについて | Problems and Bugs | |
An Introduction to Makefiles | ||
| 2.1 ルールとはどのようなものか | What a rule looks like. | |
| 2.2 簡単なMakefile | A Simple Makefile | |
2.3 makeはどのようにMakefileを処理するのか | How make Processes This Makefile
| |
| 2.4 変数によるMakefileの簡素化 | Variables Make Makefiles Simpler | |
2.5 makeに命令を導き出させる | Letting make Deduce the Commands
| |
| 2.6 もう1つのMakefileのスタイル | Another Style of Makefile | |
| 2.7 ディレクトリをクリーンにするルール | Rules for Cleaning the Directory | |
Writing Makefiles | ||
| 3.1 Makefileに含まれるもの | What makefiles contain. | |
| 3.2 Makefileの名前のつけ方 | How to name your makefile. | |
| 3.3 ほかのMakefileをインクルードする | How one makefile can use another makefile. | |
3.4 MAKEFILESの変数 | The environment can specify extra makefiles. | |
| 3.5 Makefileの作られ方 | How makefiles get remade. | |
| 3.6 ほかのMakefileの部分的なオーバーライド | How to override part of one makefile with another makefile. | |
3.7 makeはどのようにMakefileを解釈するか | How makefiles are parsed. | |
Writing Rules | ||
| • Rule Example | An example explained. | |
| 4.1 ルールのシンタックス | General syntax explained. | |
| 4.2 ファイル名におけるワイルドカードの使用 | Using wildcard characters such as ‘*’. | |
| 4.3 必要条件のためのディレクトリサーチ | Searching other directories for source files. | |
| 4.4 偽のターゲット | Using a target that is not a real file’s name. | |
| 4.5 命令または必要条件なしのルール | You can use a target without commands or prerequisites to mark other targets as phony. | |
| 4.6 レコードイベントに対する空のターゲットファイル | When only the date matters and the files are empty. | |
| 4.7 特別な組み込み済みのターゲット名 | Targets with special built-in meanings. | |
| 4.8 ルール中の複数のターゲット | When to make use of several targets in a rule. | |
| 4.9 1つのターゲットに対する複数のルール | How to use several rules with the same target. | |
| 4.10 静的なパターンルール | Static pattern rules apply to multiple targets and can vary the prerequisites according to the target name. | |
| 4.11 ダブルコロンルール | How to use a special kind of rule to allow several independent rules for one target. | |
| 4.12 必要条件の自動生成 | How to automatically generate rules giving prerequisites from source files themselves. | |
Using Wildcard Characters in File Names | ||
| 4.2.1 ワイルドカードの例 | Several examples | |
| 4.2.2 ワイルドカードの落とし穴 | Problems to avoid. | |
| 4.2.3 ワイルドカードの機能 | How to cause wildcard expansion where it does not normally take place. | |
Searching Directories for Prerequisites | ||
4.3.1 VPATH:すべての必要条件のサーチパス | Specifying a search path that applies to every prerequisite. | |
4.3.2 vpathディレクティブ | Specifying a search path for a specified class of names. | |
| 4.3.3 ディレクトリサーチはどのように行なわれるのか | When and how search paths are applied. | |
| 4.3.4 ディレクトリサーチにおけるシェルコマンドの記述 | How to write shell commands that work together with search paths. | |
| 4.3.5 ディレクトリサーチと暗黙のルール | How search paths affect implicit rules. | |
| 4.3.6 リンクライブラリに対するディレクトリサーチ | Directory search for link libraries. | |
Static Pattern Rules | ||
| 4.10.1 静的なパターンルールのシンタックス | The syntax of static pattern rules. | |
| 4.10.2 静的なパターンルール対暗黙のルール | When are they better than implicit rules? | |
Writing the Commands in Rules | ||
| 5.1 コマンドエコー | How to control when commands are echoed. | |
| 5.2 コマンド実行 | How commands are executed. | |
| 5.3 パラレル実行 | How commands can be executed in parallel. | |
| 5.4 コマンドのエラー | What happens after a command execution error. | |
5.5 makeの中断あるいはkill | What happens when a command is interrupted. | |
5.6 makeの再帰的用法 | Invoking make from makefiles.
| |
| 5.7 コマンドの組み合わせの定義 | Defining canned sequences of commands. | |
| 5.8 空のコマンドの使用 | Defining useful, do-nothing commands. | |
Recursive Use of | ||
5.6.1 MAKE変数の働き | The special effects of using ‘$(MAKE)’. | |
5.6.2 サブのmakeへの変数の伝達 | How to communicate variables to a sub-make.
| |
5.6.3 サブのmakeへのオプションの伝達 | How to communicate options to a sub-make.
| |
| 5.6.4 ‘--print-directory’オプション | How the ‘-w’ or ‘--print-directory’ option
helps debug use of recursive make commands.
| |
How to Use Variables | ||
| 6.1 変数参照の基礎 | How to use the value of a variable. | |
| 6.2 変数の2つのフレーバー | Variables come in two flavors. | |
| 6.3 変数参照の進んだ機能 | Advanced features for referencing a variable. | |
| 6.4 変数の値の取得の仕方 | All the ways variables get their values. | |
| 6.5 変数の設定 | How to set a variable in the makefile. | |
| 6.6 変数へのテキストの追加 | How to append more text to the old value of a variable. | |
6.7 overrideディレクティブ | How to set a variable in the makefile even if the user has set it with a command argument. | |
| 6.8 変数のまったく同一の定義 | An alternate way to set a variable to a verbatim string. | |
| 6.9 環境(変数)からの変数の取得 | Variable values can come from the environment. | |
| 10.5.3 自動変数 | Some special variables have predefined meanings for use with implicit rules. | |
Advanced Features for Reference to Variables | ||
| 6.3.1 代用の参照 | Referencing a variable with substitutions on the value. | |
| 6.3.2 計算された変数名 | Computing the name of the variable to refer to. | |
Conditional Parts of Makefiles | ||
| 7.1 条件文の例 | Example of a conditional | |
| 7.2 条件文のシンタックス | The syntax of conditionals. | |
| 7.3 フラグテストの条件文 | Conditionals that test flags. | |
Functions for Transforming Text | ||
| 8.1 ファンクションコールのシンタックス | How to write a function call. | |
| 8.2 文字列の代用と分析のファンクション | General-purpose text manipulation functions. | |
| 8.3 ファイル名に対するファンクション | Functions for manipulating file names. | |
8.4 foreachファンクション | Repeat some text with controlled variation. | |
8.6 callファンクション | Expand a user-defined function. | |
8.7 originファンクション | Find where a variable got its value. | |
8.8 shellファンクション | Substitute the output of a shell command. | |
How to Run | ||
| 9.1 Makefile指定の引数 | How to specify which makefile to use. | |
| 9.2 ゴールを指定する引数 | How to use goal arguments to specify which parts of the makefile to use. | |
| 9.3 コマンド実行の代替 | How to use mode flags to specify what kind of thing to do with the commands in the makefile other than simply execute them. | |
| 9.4 いくつかのファイルの再コンパイルの回避 | How to avoid recompiling certain files. | |
| 9.5 変数のオーバーライド | How to override a variable to specify an alternate compiler and other things. | |
| 9.6 プログラムのコンパイルテスト | How to proceed past some errors, to test compilation. | |
| 9.7 オプションのサマリー | Summary of Options | |
Using Implicit Rules | ||
| 10.1 暗黙のルールの使用 | How to use an existing implicit rule to get the commands for updating a file. | |
| 10.2 暗黙のルールのカタログ | A list of built-in implicit rules. | |
| 10.3 暗黙のルールで使用される変数 | How to change what predefined rules do. | |
| 10.4 暗黙のルールの連鎖 | How to use a chain of implicit rules. | |
| 10.5 パターンルールの定義と再定義 | How to define new implicit rules. | |
| 10.6 最後の手段のルールの定義 | How to defining commands for rules which cannot find any. | |
| 10.7 古いスタイルのサフィックスルール | The old-fashioned style of implicit rule. | |
| 10.8 暗黙のルールのサーチアルゴリズム | The precise algorithm for applying implicit rules. | |
Defining and Redefining Pattern Rules | ||
| 10.5.1 パターンルールへのイントロダクション | An introduction to pattern rules. | |
| 10.5.2 パターンルールの例 | Examples of pattern rules. | |
| 10.5.3 自動変数 | How to use automatic variables in the commands of implicit rules. | |
| 10.5.4 パターンマッチの方法 | How patterns match. | |
| 10.5.5 何にでもマッチするパターンルール | Precautions you should take prior to defining rules that can match any target file whatever. | |
| 10.5.6 暗黙のルールのキャンセル | How to override or cancel built-in rules. | |
Using | ||
| 11.1 ターゲットとしてのアーカイブメンバー | Archive members as targets. | |
| 11.2 アーカイブメンバーのターゲットに対する暗黙のルール | The implicit rule for archive member targets. | |
| 11.3 アーカイブ使用する際の危険性 | Dangers to watch out for when using archives. | |
| 11.4 アーカイブファイルに対するサフィックスルール | You can write a special kind of suffix rule for updating archives. | |
Implicit Rule for Archive Member Targets | ||
| 11.2.1 アーカイブシンボルディレクトリのアップデート | How to update archive symbol directories. | |
| [ < ] | [ > ] | [ << ] | [上] | [ >> ] | [冒頭] | [目次] | [見出し] | [ ? ] |
makeの概要makeユーティリティは、大規模なプログラムのどの部分が再コンパイル
されなければならないか、あるいは再コンパイルの命令に関する問題を自動的に
決定します。
本書は、Richard StallmanとRoland McGrathによって実装されたGNU make
について書かれたもので、開発自体は、Version 3.76からはPaul D. Smithによって
行なわれています。
GNU make は、IEEE Standard 1003.2-1992 (POSIX.2)
の6.2節に適合します。
ここでは、もっとも一般的なC言語によるプログラム例を示しますが、シェルコマンド
によって動作するコンパイラを用いるプログラム言語であれば、どんなコンパイラでも
このmakeを利用することができます。実際、makeはプログラム自体の
制約を受けず、たとえば一部のファイルが自動的に更新されなければならないような
タスクを記述することができます。
| • Preparing | Preparing and Running Make | |
| 1.1 マニュアルの読み方 | On Reading this Text | |
| 1.2 問題とバグについて | Problems and Bugs |
makeを使用するためには、プログラムのファイル間の関係を記述する
makefileを準備しなければならず、これによってそれぞれのファイルの更新を
指示することになります。一般的には、ソースファイルから次々にコンパイルされる
オブジェクトファイルの更新によって実行可能ファイルが作られていきます。
したがって、適切なmakefileがあれば、ソースファイルに変更を加えるたびに この簡単なシェルコマンドを実行すればよいのです。
make |
これだけで再コンパイルに必要なすべてが行なわれます。makeはどのファイルが
更新されなければならないかを決定するためにmakefileデータベースと
ファイルの最終更新時刻を用います。これによって、それぞれのファイルについて
データベースに記録された命令が実行されるのです。
また、makeに引数を付加することによって、どのファイルをあるいは
どのようにコンパイルするかの制御を行なうこともできます。
See section makeをどのように実行するか.。
| [ < ] | [ > ] | [ << ] | [上] | [ >> ] | [冒頭] | [目次] | [見出し] | [ ? ] |
読者がmakeに不慣れだったり、一般的な入門書を探している場合には、
各章の始めの部分を読み、そのあとの節は読み飛ばしてください。各章の
始めの節では入門的な、あるいは一般的なことが記述されていて、続く
節では特殊なまたはテクニカルなことが記述されています。
読者がほかのmakeプログラミングに慣れている場合には、
GNU makeの機能.を読んでください。それにはGNUの
makeの拡張されている部分と
非互換性と欠けている機能.にあるように
GNUmakeの非互換な部分や機能として持たないものについて記述されています。
また、短時間で要約を見るためには、オプションのサマリー. やクイックリファレンス.や 特別な組み込み済みのターゲット.を参照してください。
| [ < ] | [ > ] | [ << ] | [上] | [ >> ] | [冒頭] | [目次] | [見出し] | [ ? ] |
さらに、読者がmakeについて問題を抱えたり、バグを発見した場合には、
開発者まで報告をお願いします。すべてについての確約はできませんが、
バグフィックスはしていきたいと考えます。
ただし、バグの報告のまえに必ずそれが本当にバグなのかどうかを確認してください。 ドキュメントを慎重に読み返して、試そうとしていることが可能なことかどうかを 確認してください。可能なのかどうかが明確でない場合にはそのことを報告して ください。なぜなら、それ自体がドキュメントのバグである可能性もあるためです。
バグを報告したり、自分でバグフィックスを行なうまえに、問題を再現できる最低限の
makefileに分離して、それをmakeの結果とともに送ってください。また、
実行によって期待していた結果についても送ってください。それによって、問題が
ドキュメントにあったのかどうかを判断することができます。
そして、たしかに問題がある場合には以下に電子メールを送ってください。
bug-make@gnu.org |
その際には、使用したmakeのバージョンを書くようにしてください。
バージョンは、コマンド‘make --version’によって取得できます。併せて、
使用しているマシンのタイプやオペレーティングシステム、さらに可能であれば、
コンフィギュレーションプロセスで生成される‘config.h’の内容も含むように
してください。
| [ << ] | [ >> ] | [冒頭] | [目次] | [見出し] | [ ? ] |
この文書は新堂 安孝によって2009年9月22日にtexi2html 1.82を用いて生成されました。