注意事项
- 每个标签分支前都不能用空格,必须用tab
- 标签外调用bash命令用 $(shell …),标签内可以正常使用
- 标签后可以指定其他标签,执行顺序是先执行其他标签,而后在执行自己
- 比如 all: clean 会先执行clean
- make 没有参数时,默认会执行第一个标签
- 比如demo里会执行make all
demo
target=errno
CC:=gcc
all: clean
$(CC) -Wall -s -o $(target) *.c
install: all
cp -f $(target) /usr/sbin/
clean:
rm -rf *.o $(target)