最終更新:2013-12-20 (金) 17:08:46 (3773d)  

$@
Top / $@

シェルスクリプト

  • (1 から始まる) 全ての位置パラメータに展開されます。 ダブルクォートの内部で展開が行われたときは、 それぞれのパラメータは別々の単語に展開されます。 つまり "$@" は "$1" "$2?" ... と同じです。 単語の中でダブルクォートの展開が行われるときには、 最初のパラメータの展開結果に元の単語のダブルクォートより前の部分が 結び付き、最後のパラメータの展開結果に元の単語のダブルクォートより 後の部分が結び付きます。 位置パラメータがない場合には、"$@" や $@ を展開しても無かったことになります (つまり取り除かれます)。

Makefile

  • ターゲットのファイル名を表す
  • The file name of the target of the rule. If the target is an archive member, then ‘$@’ is the name of the archive file. In a pattern rule that has multiple targets (see Introduction to Pattern Rules), ‘$@’ is the name of whichever target caused the rule's recipe to be run.
    file.o : file.c
                $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
  • In this case, $< will be replaced with "file.c" and $@ will be "file.o"

関連