Makefile 找不到规则
Makefile don't find rule
我在一个 Jekyll 项目中 makefile
:
project = jekyll-template-repository
e: execute
execute:
bundle
build
r: run
run:
jekyll serve -l -o -b /$(project)
b: build
build: clean
jekyll build
c: clean
clean:
jekyll clean
当我 运行 make execute
时,它抛出错误 make: build: Command not found
我想它正试图将它作为一个普通的 bash 命令来执行,但是我想调用我在文件中转发的 build
规则。当其他 make
规则不在另一个规则 :
之后时,是否需要一些特殊语法来指向它们?
您不能 "call" 在 makefile 中制定规则。规则不是函数。您可以 depend 在 target 上,在这种情况下,在该目标被认为是最新的之前,该目标将被更新。
规则的每个配方实际上都是一个 shell 脚本。它从来不是其他目标的列表。
你可以这样写:
execute: build
然后它将首先执行 build
目标的配方(假设它不是最新的),然后它将执行 execute
目标的配方。
我在一个 Jekyll 项目中 makefile
:
project = jekyll-template-repository
e: execute
execute:
bundle
build
r: run
run:
jekyll serve -l -o -b /$(project)
b: build
build: clean
jekyll build
c: clean
clean:
jekyll clean
当我 运行 make execute
时,它抛出错误 make: build: Command not found
我想它正试图将它作为一个普通的 bash 命令来执行,但是我想调用我在文件中转发的 build
规则。当其他 make
规则不在另一个规则 :
之后时,是否需要一些特殊语法来指向它们?
您不能 "call" 在 makefile 中制定规则。规则不是函数。您可以 depend 在 target 上,在这种情况下,在该目标被认为是最新的之前,该目标将被更新。
规则的每个配方实际上都是一个 shell 脚本。它从来不是其他目标的列表。
你可以这样写:
execute: build
然后它将首先执行 build
目标的配方(假设它不是最新的),然后它将执行 execute
目标的配方。