首页 > 解决方案 > 将 MakeFile 转换为命令行输入或 bazel

问题描述

我目前正在开发一个项目,该项目特别要求我不要使用 Makefile 来构建所有依赖项,因为他们的整个 repo 使用 bazel 来构建文件。我对 MakeFile 的了解为零。我想知道如何将以下 Makefile 转换为命令行参数,然后我可以将其放入简单的 Python 脚本中。先感谢您!非常感谢您的解决方案!

# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS    =
SPHINXBUILD   = sphinx-build
SOURCEDIR     = .
BUILDDIR      = _build

# Put it first so that "make" without argument is like "make help".
help:
    @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
    @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

标签: python-3.xmakefileterminalpython-sphinxbazel

解决方案


如果执行“make”或“make help”,它将执行:

sphinx-build -M help . _build

如果您使用任何其他目标调用 Make,例如“make foo”,并且该目标不存在(或它存在但比 旧Makefile),它将执行:

sphinx-build -M foo . _build

推荐阅读