我有一个makefile,我想从那里调用一个shell脚本,它会做一些事情并将结果返回给makefile。
详细说明 :-
从我的make-file中,我调用shell脚本如下:-
source = $(PWD)
target = $(ROOT)
SCRIPT:= /home/........./temp.sh
FUNCTION:=$(shell $(SCRIPT $source $target))`
外壳脚本“temp.sh”:-
source=$1
target=$2
echo There are $# arguments to $0: $*
common_part=$source # for now
result="" # for now
while [[ "${target#$common_part}" == "${target}" ]]; do
common_part="$(dirname $common_part)"
if [[ -z $result ]]; then
result=".."
else
result="../$result"
fi
done
if [[ $common_part == "/" ]]; then
result="$result/"
fi
forward_part="${target#$common_part}"
if [[ -n $result ]] && [[ -n $forward_part ]]; then
result="$result$forward_part"
elif [[ -n $forward_part ]]; then
result="${forward_part:1}"
fi
echo "Result=$result"
- 我没有看到 Shell-Script 的“回声语句”,这可能是什么原因?
- 如何将结果返回到 makefile?
- 这是从make-file调用脚本的正确方法吗?
我是这个领域的新手。