訳注:このセクションは全体的に訳がおかしくなっています。
Another important part of debian/rules file but generally of the whole world of makefiles are PHONY targets; targets which don't actually create a file, but do something.
debian/rulesファイルの中でもう一つ重要な部分で、Makefileなどでも一般的に使われているものは、PHONYターゲットです。このターゲットではファイルを作成するということはありませんが、何かを行います。
You can have add "phony" targets to your debian/rules file too (usually are placed by default as end line); targets which don't actually create a file, but do something. These are created like normal targets: for instance, to add a "all" target to our makefile we would add :
debian/rulesにも"phony"(擬似)ターゲットを追加することをできます(通常はファイルの一番最後に配置します)。このターゲットではファイルを作成するということはありませんが、何かを行います。これは普通のターゲットと同じように作成されます。例えば、Makefileに"all"ターゲットを次のよう追加してみます:
all: foo
Make sure that file "all" it's not your build directory, if not the rule won't run correctly. So we can tell make that this is a phony target and should be rebuilt always this is by using the target .PHONY. so, we can add to our Makefile:
"all"というファイルがビルドディレクトリに存在しないことを確認してください。もし存在する場合は、このルールはうまく動作しません。そして、.PHONYターゲットを使うことにより、このターゲットが擬似ターゲットであり、常にリビルドされるべきだと伝えることができます。Makefileに次のように追加しましょう:
.PHONY: all
In fact these rule's commands won't create any target file, but will be executed every time the target comes up for remaking. Common example is the clean one:
実際、これらのルールで実行されるコマンドは、ターゲットファイルを作成しませんが、再構築ターゲットとして毎回実行されます。一般的な例としてcleanがあります:
.PHONY : clean clean: rm -.h
Once this has been definied, make clean will run the commands with every file named clean.
このように設定された場合、make cleanは、すべてのcleanという名前のファイルでこのコマンドを実行します。
<= |
=> |
|
PHONYターゲット |