用户工具

站点工具


语法:makefile

这是本文档旧的修订版!


makefile

1. for

NAME := a b c
run:
	@for tmp in $(NAME); do \
		echo $$tmp; \
	done

2. 根据文件内容循环执行

根据gen.txt文件内容,在makefile中循环执行。

输入文件:

> cat gen.txt 
items = a b c

Makefile文件:

run:
	@line=$$(head -n1 gen.txt); \
	tile_list=$$(echo "$$line" | awk '{for(i=3;i<=NF;i++) printf " %s", $$i}'); \
	for tile in $$tile_list; do \
		echo "process tile: $$tile"; \
	done

执行结果:

> make
process tile: a
process tile: b
process tile: c
语法/makefile.1787982491.txt.gz · 最后更改: 2026/08/29 13:48 由 user01

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki