Makefile匹配任何目标/任务 [英] Makefile match any target / task

查看:59
本文介绍了Makefile匹配任何目标/任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个可以与任何任务一起运行的makefile,并且仅回显所有任务名称.
有什么办法吗?

I want to write a makefile that can be run with any task and just echo all the task names.
Is there any way to do this?

赞:

%.%: 
    echo "$@"

推荐答案

假设您的品牌是GNU品牌或类似品牌,请使用以下Makefile:

Assuming that your make is GNU make or alike, use the following Makefile:

.PHONY: all

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

查看结果:

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

这篇关于Makefile匹配任何目标/任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆