Makefile:将命令行参数传递给Makefile中的文件 [英] Makefile: Passing command line arguments to file inside Makefile

查看:738
本文介绍了Makefile:将命令行参数传递给Makefile中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Makfile中,我有以下内容

Inside my Makfile I have the following,

smktestrun: smktest
    @../projects/test.sh

我用以下方法称呼它:

Make smktestrun

但是有时我需要将参数/参数与此文件(test.sh)一起传递

But sometimes I need to pass an parameter/argument along with this file (test.sh)

所以基本上我想:

test.sh -abc

但是,如果我只是在Makefile本身中传递参数,则不会执行该参数,因为仅执行了sheel脚本.

But if i just pass the argument in the Makefile itself, the argument is not taken as simply the sheel script is executed.

那么,有没有一种方法可以让我在Makefile中指定需要与该文件一起传递参数?

So is there a way I could specify in the Makefile that an argument needs to be passed with that file?

谢谢.

推荐答案

类似

smktestrun: smktest
        @../projects/test.sh $(TESTARGS)

然后使用以下命令调用Makefile

Then call the Makefile with

$ make smktestrun TESTARGS="-abc"

这篇关于Makefile:将命令行参数传递给Makefile中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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