5344
5432
1万
管理员
本站资源如失效,请点击反馈!
$ make a.txt
a.txt: b.txt c.txt cat b.txt c.txt > a.txt
$ make -f rules.txt# 或者$ make --file=rules.txt
: [tab]
clean: rm *.o
$ make clean
.PHONY: cleanclean: rm *.o temp
$ make
result.txt: source.txt cp source.txt result.txt
source.txt: echo "this is the source" > source.txt
$ make result.txt$ make result.txt
source: file1 file2 file3
$ make source
$ make file1$ make file2$ make file3
.RECIPEPREFIX = >all:> echo Hello, world
var-lost: export foo=bar echo "foo=[$$foo]"
var-kept: export foo=bar; echo "foo=[$$foo]"
var-kept: export foo=bar; \ echo "foo=[$$foo]"
.ONESHELL:var-kept: export foo=bar; echo "foo=[$$foo]"
# 这是注释result.txt: source.txt # 这是注释 cp source.txt result.txt # 这也是注释
test: # 这是测试
$ make test# 这是测试
test: @# 这是测试
test: @# 这是测试 @echo TODO
clean: rm -f *.o
%.o: %.c
f1.o: f1.cf2.o: f2.c
txt = Hello Worldtest: @echo $(txt)
test: @echo $$HOME
v1 = $(v2)
VARIABLE = value# 在执行时扩展,允许递归扩展。VARIABLE := value# 在定义时扩展。VARIABLE ?= value# 只有在该变量为空时才设置值。VARIABLE += value# 将值追加到变量的尾端。
output: $(CC) -o output input.c
a.txt b.txt: touch $@
a.txt: touch a.txtb.txt: touch b.txt
使用道具 举报
本版积分规则 发表回复 回帖后跳转到最后一页
手机版|飞雪团队
GMT+8, 2024-11-24 06:46 , Processed in 0.068019 second(s), 24 queries , Gzip On.
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.