Makefile 语法错误:单词意外(需要“)”)

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

我的 Makefile 中有以下脚本,它给了我错误

输入 make start-test 后,如果 .env 文件存在,脚本应运行命令 locust -ftests/load/,否则不应运行该命令。

start-test:
# Check if .env file exists
        ifeq ($(wildcard $(.env)),yes)
            include .env
# If the file doesn't exist, execute this rule
        all:
            echo ".env file does not exist"
        else
# If the file exists, execute this rule
        all:
            echo ".env file exists"
            locust -f tests/load/
        endif

语法错误:单词意外(需要“)”)

makefile
1个回答
0
投票

根据评论中的描述,您可以这样做:

start-test:
        if test -f .env; then locust -f tests/load/; fi

这适用于任何提供 POSIX shell 的系统。

© www.soinside.com 2019 - 2024. All rights reserved.