05实用技术/Make - PHONY

.PHONY 用来告诉 make 和文件无关的命令。

PS:经我测试不加也行。。我用的版本:

1
2
3
$ make -v
GNU Make 4.3
Built for Windows32

测试代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# .PHONY: build build-bundle clean test-clean lint lint-js lint-ts

build: build-bundle
echo build

build-bundle: clean
echo build-bundle

clean: test-clean
echo clean

test-clean:
echo test-clean

lint: lint-js lint-ts
echo lint

lint-js:
echo lint-js

lint-ts:
echo lint-ts

See: What is the purpose of .PHONY in a Makefile? - Stack Overflow