makefike调用shell脚本
时间: 2023-11-28 18:46:29 浏览: 399
可以通过Makefile来调用shell脚本,具体方法如下所示:
假设有一个名为test.sh的shell脚本,内容如下:
```shell
#!/bin/bash
echo "Hello World!"
```
现在我们需要在Makefile中调用该脚本,可以按照以下步骤进行:
1.在Makefile中定义一个目标,例如:
```makefile
hello:
```
2.在该目标下添加命令,调用shell脚本,例如:
```makefile
hello:
sh test.sh
```
3.在终端中进入Makefile所在的目录,执行make命令,即可调用shell脚本,例如:
```shell
make hello
```
执行结果为:
```shell
Hello World!
```
阅读全文
相关推荐















