Last Update: "2010/04/16 08:27:05 makoto"
組込変数
参考:
http://www.ecoop.net/coop/translated/GNUMake3.77/make_10.jp.html#SEC97
自動変数とも言います。
| | | gmake | bmake |
| $@ | 目的譜名 | | |
| $% | 目的が保存形式の構成譜だった時の目的構成名 | | |
| $< | 最初の依存譜名 | ○ | |
| $? | 目的より新しい全ての依存する譜名 | | |
| $^ | 全ての依存する譜名 | | |
| $+ | $^ と良く似ているが、Makefile に登場する順に並んだ譜名 | | |
| $* | 目的名から接尾辞を除いた名前 | | |
接尾辞規則
(Suffix Rules)
接尾辞規則: *.c -> *.o
.SUFFIXES: .o .c
The default rule for generating anyfile.o from anyfile.c is written as
.c.o:
$(CC) $(CFLAGS) -c $<
.c.o:
cc -c $<
というのは古い方法だそうだ:
http://theory.uwinnipeg.ca/localfiles/infofiles/make/make_103.html
Pattern Rules
最近はその代りに pattern rules を使う:
http://www.rzg.mpg.de/~dpc/gmake/make_93.html
Substitution References
TARGETS = $(HOST:%=%.t)
SRC = hoge.s bar.s
OBJS = $(SRC:%.s=%.o)
これで OBJS には hoge.o, bar.o が代入される。参照:
http://www.rzg.mpg.de/~dpc/gmake/make_toc.html#SEC59
- 12 Features of GNU make
-
http://www.gnu.org/software/make/manual/html_node/Features.html
- 13 Incompatibilities and Missing Features
-
http://www.gnu.org/software/make/manual/html_node/Missing.html
- 2007/09/16 の日記
-
http://www.ki.nu/~makoto/diary/2007/09/16/
上の日記の続きで、hoge:: と書くのと hoge: と書くのには実は大きな違いがある。
hoge:: は一時譜で、なくても作ってくれ、使い終れば消してくれる。
hoge: はそれがないと始まらない。そこで、大雑把に言えば、Pattern rule の時には、
一時的に必要なものには :: を使っておいた方が安全である。
|