在包含子 makefile 之前更新子模块
Update submodule before including a sub-makefile
我有一个包含另一个 makefile 的 makefile。这发生在 makefile 的早期。类似于:
include $(SOME_SDK)/Makefile.defines
然而 SOME_SDK
是一个子模块。
我想 运行 git submodule update --init --recursive
在开始包含之前。
理想情况下,这不应该是任何目标的一部分。
我该怎么做?
您不能将此命令作为某些目标的一部分,因为 include
指令在计算任何目标之前已完成。
但是您可以在 Makefile
的任何位置执行任何 shell 命令(或脚本),甚至在 include
之前。
dummy := $(shell git submodule update --init --recursive)
include $(SOME_SDK)/Makefile.defines
我有一个包含另一个 makefile 的 makefile。这发生在 makefile 的早期。类似于:
include $(SOME_SDK)/Makefile.defines
然而 SOME_SDK
是一个子模块。
我想 运行 git submodule update --init --recursive
在开始包含之前。
理想情况下,这不应该是任何目标的一部分。
我该怎么做?
您不能将此命令作为某些目标的一部分,因为 include
指令在计算任何目标之前已完成。
但是您可以在 Makefile
的任何位置执行任何 shell 命令(或脚本),甚至在 include
之前。
dummy := $(shell git submodule update --init --recursive)
include $(SOME_SDK)/Makefile.defines