From 26bf2d5fc0a0a0411da97545e9175bd6c1fc86e9 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 15 Dec 2016 11:47:17 +0900 Subject: [PATCH] Closes #3194: Refer the $MAKE environment variable to determine ``make`` command --- CHANGES | 1 + doc/invocation.rst | 9 +++++++++ sphinx/make_mode.py | 7 ++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index a71059dca..1fa361e03 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ Features added -------------- * #3241: emit latex warning if buggy titlesec (ref #3210) +* #3194: Refer the $MAKE environment variable to determine ``make`` command Bugs fixed ---------- diff --git a/doc/invocation.rst b/doc/invocation.rst index a16ab2128..18c6d5035 100644 --- a/doc/invocation.rst +++ b/doc/invocation.rst @@ -384,6 +384,15 @@ You can also give one or more filenames on the command line after the source and build directories. Sphinx will then try to build only these output files (and their dependencies). +Environment variables +--------------------- + +The :program:`sphinx-build` refers following environment variables: + +.. desribe:: MAKE + + A path to make command. A command name is also allowed. + :program:`sphinx-build` uses it to invoke sub-build process on make-mode. Makefile options ---------------- diff --git a/sphinx/make_mode.py b/sphinx/make_mode.py index 28316458e..6aeeab802 100644 --- a/sphinx/make_mode.py +++ b/sphinx/make_mode.py @@ -62,6 +62,7 @@ class Make(object): self.srcdir = srcdir self.builddir = builddir self.opts = opts + self.makecmd = os.environ.get('MAKE', 'make') # refer $MAKE to determine make command def builddir_join(self, *comps): return path.join(self.builddir, *comps) @@ -162,13 +163,13 @@ class Make(object): if self.run_generic_build('latex') > 0: return 1 with cd(self.builddir_join('latex')): - os.system('make all-pdf') + os.system('%s all-pdf' % self.makecmd) def build_latexpdfja(self): if self.run_generic_build('latex') > 0: return 1 with cd(self.builddir_join('latex')): - os.system('make all-pdf-ja') + os.system('%s all-pdf-ja' % self.makecmd) def build_text(self): if self.run_generic_build('text') > 0: @@ -189,7 +190,7 @@ class Make(object): if self.run_generic_build('texinfo') > 0: return 1 with cd(self.builddir_join('texinfo')): - os.system('make info') + os.system('%s info' % self.makecmd) def build_gettext(self): dtdir = self.builddir_join('gettext', '.doctrees')