【发布时间】:2026-02-07 17:00:01
【问题描述】:
这是我运行的命令
make -d -f dump.makefile
我得到的错误:
Reading makefile `dump.makefile'...
dump.makefile:31: *** commands commence before first target. Stop.
来源
ifneq (,)
This makefile requires GNU Make.
endif
# force use of Bash
SHELL := /bin/bash
# function
today=$(shell date '+%Y-%m:%b-%d')
update-latest=$(shell ln -nf {$(call today),latest}.cfdict-"$(1)".localhot.sql)
# variables
credentials="$$HOME/.my.cfdict.cnf"
default: data-only structure-only csv-only all
data-only: what=data
argList=( --defaults-file="${credentials}" --no-create-db --no-create-info ) \
mysqldump "$${argList[@]}" cfdict > $(call today).cfdict-"${what}".localhot.sql
$(call update-latest,${what})
触发错误的行是$(call update-latest,${what}),调用update-latest函数。
问题
我检查制表符/空格,这似乎是正确的。
我是误用了call 还是错误地声明了update-latest?
【问题讨论】:
-
试试
update-latest=$(shell echo ln ...看看shell得到了什么。我想知道 $(call today) 是否在 ln 命令移交给 shell 之前被替换。
标签: bash function makefile gnu-make