GNU Make - 在依赖项中分配变量会导致“配方在第一个目标之前开始”

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

我有一个干净/详细的构建目标,但它没有正确传播:

clean:
    $(eval export CLEAN_BUILD:=--no-cache)

verbose:
    $(eval export DOCKER_VERBOSE:=BUILDKIT_PROGRESS=plain)

docker.stop.rebuild:
    make -j 2 docker.build docker.stop

看起来这些变量并没有坚持下去。我已经尝试了一堆排列(= vs :=,使用

shell
,使用&&试图强制它传递重建目标,等等)

所以我尝试了这个,基于这个线程:Export environment variables from makefile to shell

clean: CLEAN_BUILD:=--no-cache

verbose: DOCKER_VERBOSE:=BUILDKIT_PROGRESS=plain

但是当我这样做时,我得到了这个错误:

Makefile:81: *** recipe commences before first target.  Stop.

知道为什么吗?我试过使用 GNU Make 4.3 和 4.4.1,两者都有这种行为。

makefile gnu-make
© www.soinside.com 2019 - 2024. All rights reserved.