简体   繁体   English

Makefile匹配任何目标/任务

[英]Makefile match any target / task

I want to write a makefile that can be run with any task and just echo all the task names. 我想编写一个可以与任何任务一起运行的makefile,只需回显所有任务名称。
Is there any way to do this? 有没有办法做到这一点?

Like: 喜欢:

%.%: 
    echo "$@"

Assuming that your make is GNU make or alike, use the following Makefile: 假设您的make是GNU make或类似的,请使用以下Makefile:

.PHONY: all

%:
       @echo "Here I am! $@"

See the result: 看结果:

> make first
Here I am! first
> make second
Here I am! second
> make first second
Here I am! first
Here I am! second

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM