将Makefile转换为Shell脚本需要协助

问题描述 投票:-1回答:1

需要您的帮助以将Makefile中的代码转换为Shell脚本吗?请帮助,因为我是MakeFile和Shell脚本的新手。谢谢。

示例代码:

include Configfile
.PHONY: config-arch asoc-tool clone-repo generate-irx api-login \
    upload-file get-app run-scan show-scan-id get-asset-group create-app

config-arch:
    sudo dpkg --add-architecture i386
    sudo apt-get update
    sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386

asoc-tool: config-arch
    $(eval DIR := $(shell pwd))
    curl -o client.zip $(APPSCAN_TOOL)
    mkdir client ; mkdir tool
    unzip -qq client.zip -d client
    cd client ; ls | xargs -I {} sh -c "cp -r {}/* $(DIR)/tool"
    rm -rf client

clone-repo:
    git clone $(GIT_REPO)

# Generates the irx file for icp-cert-manager.
generate-irx: 
    $(eval DIR := $(shell pwd))

    cd $(PROJECT_NAME); $(DIR)/tool/bin/appscan.sh prepare $(flag)
shell makefile
1个回答
0
投票
#!/bin/sh

# config-arch
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386

# asoc-tool
curl -o client.zip $(APPSCAN_TOOL)
mkdir client ; mkdir tool
unzip -qq client.zip -d client
cd client ; ls | xargs -I {} sh -c "cp -r {}/* ./tool"
rm -rf client

# clone repo
git clone ${GIT_REPO} # you should overwrite ${GIT_REPO} to your git repo, maybe from Configfile

# generate-irx
cd $(PROJECT_NAME)
./tool/bin/appscan.sh prepare ${flag} # you should check your ${flag}, maybe from Configfile
© www.soinside.com 2019 - 2024. All rights reserved.