Can I use GNU make's SHELL variable to connect to a remote shell?

孤街浪徒 提交于 2020-01-06 19:57:42

问题


One of the projects I'm working on uses gnu make for testing. I would like to test on a platform that doesn't have a make implementation, but does have a POSIX shell.

Is it possible to create a script (preferably in python) that can "stitch" a remote shell to make, and put it in make's SHELL environment variable?

If not, is there another way anyone can think of to do it?


回答1:


It is possible.

Create a script that forwards commands to a remote host. For example:

#!/bin/bash
shift # remove -c argument
exec ssh remote_host "$@"

And make it executable (chmod +x).

And then in Makefile:

SHELL := './my_shell.sh'
all :
    @echo `hostname` is making $@

Outputs:

$ make
remote_host.peer1.net is making all


来源:https://stackoverflow.com/questions/11396816/can-i-use-gnu-makes-shell-variable-to-connect-to-a-remote-shell

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!