尝试从 gnu make 中的命令获取值时出错

Error while trying to get value from command in gnu make

我有以下代码 运行 生成 gnu 文件

apps := $(shell tbd run apps)
apps := $(subst ],,$(subst [,,$(app)))

现在我想打印应用程序值,我尝试使用

@echo $(app)

我收到错误

Makefile:12: *** commands commence before first target. Stop.

更新:

目前我的代码是这样的

apps := $(shell tbd run apps)
apps := $(subst ],,$(subst [,,$(apps)))


build:
    @for app in $(apps) ; do \
     bsd start $$app ; \
    done

如果我这样尝试,我会得到错误

start: 
   apps := $(shell tbd run apps)
   apps := $(subst ],,$(subst [,,$(apps)))

build:
    @for app in $(apps) ; do \
        bsd start $$app ; \
    done

如果您只想打印一些内容而不考虑任何规则,那么请使用 info 函数...

$(info $(app))

您不能有意义地将 Makefile 函数调用放在 shell 调用中。我猜你真的只是在寻找

build:
    tbd run apps \
    | sed 's/\[//;s/\]//' \
    | xargs -n 1 bsd start