linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Heiser <markus.heiser@darmarit.de>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Josh Triplett <josh@joshtriplett.org>,
	Mauro Carvalho Chehab <mchehab@s-opensource.com>,
	Jonathan Corbet <corbet@lwn.net>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	ksummit-discuss@lists.linuxfoundation.org,
	linux-doc@vger.kernel.org
Subject: Re: [Ksummit-discuss] Including images on Sphinx documents
Date: Wed, 9 Nov 2016 23:11:46 +0100	[thread overview]
Message-ID: <a6b88e7d-9d6b-4dcc-3d2e-c09bdf366b40@darmarit.de> (raw)
In-Reply-To: <87shr0g90r.fsf@intel.com>


On 09.11.2016 12:58, Jani Nikula wrote:
 > On Wed, 09 Nov 2016, Markus Heiser <markus.heiser@darmarit.de> wrote:
 >> Am 09.11.2016 um 12:16 schrieb Jani Nikula <jani.nikula@linux.intel.com>:
 >>>> So I vote for :
 >>>>
 >>>>> 1) copy (or symlink) all rst files to Documentation/output (or to the
 >>>>> build dir specified via O= directive) and generate the *.pdf there,
 >>>>> and produce those converted images via Makefile.;
 >>>
 >>> We're supposed to solve problems, not create new ones.
 >>
 >> ... new ones? ...
 >
 > Handle in-tree builds without copying.
 >
 > Make dependency analysis with source rst and "intermediate" rst work.
 >
 > Make sure your copying gets the timestamps right.
 >
 > Make Sphinx dependency analysis look at the right copies depending on
 > in-tree vs. out-of-tree. Generally make sure it doesn't confuse Sphinx's
 > own dependency analysis.
 >
 > The stuff I didn't think of.

It might be easier than you think first.

 > Sure, it's all supposed to be basic Makefile stuff, but don't make the mistake
 > of thinking just one invocation of 'cp' will solve all the problems.

I act naif using 'cp -sa', see patch below.

 > It all adds to the complexity we were trying to avoid when dumping DocBook. It
 > adds to the complexity of debugging stuff. (And hey, there's still the one
 > rebuilding-stuff-for-no-reason issue open.)

And hey ;-) I wrote you [1], this is a bug in Sphinx. Yes, I haven't had time
to send a bugfix to Sphinx, but this won't even help us (bugfixes in Sphinx will
only apply on top).

 > If you want to keep the documentation build sane, try to avoid the Makefile
 > preprocessing.

I'am just the one helping Mauro to be productive, if he needs preprocessing I
implement proposals. I know that you fear preprocessing since it tend to
fall-back, what we had with DocBook's build process.  We discussed this already,
it might better you unify this with Mauro and the other who need preprocessing.

 > And same old story, if you fix this for real, even if as a Sphinx extension,
 > *other* people than kernel developers will be interested, and *we* don't have
 > to do so much ourselves.

I don't think so, this kind of parsing header files we have and the build of
content from MAINTAINERS, ABI, etc. is very kernel specific.

Anyway, back to my point 'copy (or symlink) all rst files'. Please take a look
at my patch below. Take in mind; its just a POC.

Could this POC persuade you, if so, I send a more elaborate RFC,
what do you think about?

[1] https://www.mail-archive.com/linux-doc@vger.kernel.org/msg07302.html

-- Markus --

 > BR,
 > Jani.
 >>
 >>>> IMO placing 'sourcedir' to O= is more sane since this marries the
 >>>> Linux Makefile concept (relative to $PWD) with the sphinx concept
 >>>> (in or below 'sourcedir').
 >>
 >> -- Markus --
 >

diff --git a/Documentation/Makefile.sphinx b/Documentation/Makefile.sphinx
index ec0c77d..8e904c1 100644
--- a/Documentation/Makefile.sphinx
+++ b/Documentation/Makefile.sphinx
@@ -13,6 +13,10 @@ BUILDDIR      = $(obj)/output
  PDFLATEX      = xelatex
  LATEXOPTS     = -interaction=batchmode

+ifdef SPHINXDIRS
+else
+endif
+
  # User-friendly check for sphinx-build
  HAVE_SPHINX := $(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi)

@@ -50,30 +54,38 @@ loop_cmd = $(echo-cmd) $(cmd_$(1))
  #    * dest folder relative to $(BUILDDIR) and
  #    * cache folder relative to $(BUILDDIR)/.doctrees
  # $4 dest subfolder e.g. "man" for man pages at media/man
-# $5 reST source folder relative to $(srctree)/$(src),
+# $5 reST source folder relative to $(obj),
  #    e.g. "media" for the linux-tv book-set at ./Documentation/media

  quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
-      cmd_sphinx = $(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/media all;\
-	BUILDDIR=$(abspath $(BUILDDIR)) SPHINX_CONF=$(abspath $(srctree)/$(src)/$5/$(SPHINX_CONF)) \
+      cmd_sphinx = $(MAKE) BUILDDIR=$(BUILDDIR) $(build)=Documentation/media all;\
+	BUILDDIR=$(BUILDDIR) SPHINX_CONF=$(obj)/$5/$(SPHINX_CONF) \
  	$(SPHINXBUILD) \
  	-b $2 \
-	-c $(abspath $(srctree)/$(src)) \
-	-d $(abspath $(BUILDDIR)/.doctrees/$3) \
+	-c $(obj) \
+	-d $(obj)/.doctrees/$3 \
  	-D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) \
  	$(ALLSPHINXOPTS) \
-	$(abspath $(srctree)/$(src)/$5) \
-	$(abspath $(BUILDDIR)/$3/$4);
-
-htmldocs:
+	$(obj)/$5 \
+	$(BUILDDIR)/$3/$4;
+
+ifdef O
+sync:
+	rm -rf $(objtree)/$(obj)
+	cp -sa $(srctree)/$(obj) $(objtree)
+else
+sync:
+endif
+
+htmldocs: sync
  	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))

-latexdocs:
+latexdocs: sync
  	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,latex,$(var),latex,$(var)))

  ifeq ($(HAVE_PDFLATEX),0)

-pdfdocs:
+pdfdocs: sync
  	$(warning The '$(PDFLATEX)' command was not found. Make sure you have it installed and in PATH to produce PDF output.)
  	@echo "  SKIP    Sphinx $@ target."

@@ -84,10 +96,10 @@ pdfdocs: latexdocs

  endif # HAVE_PDFLATEX

-epubdocs:
+epubdocs: sync
  	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,epub,$(var),epub,$(var)))

-xmldocs:
+xmldocs: sync
  	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,xml,$(var),xml,$(var)))

  # no-ops for the Sphinx toolchain
@@ -98,6 +110,7 @@ installmandocs:

  cleandocs:
  	$(Q)rm -rf $(BUILDDIR)
+	$(Q)rm -rf $(obj)/.doctrees

  endif # HAVE_SPHINX

  reply	other threads:[~2016-11-09 22:12 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07  9:55 Including images on Sphinx documents Mauro Carvalho Chehab
2016-11-07 10:53 ` Jani Nikula
2016-11-07 11:46   ` Mauro Carvalho Chehab
2016-11-07 17:05     ` [Ksummit-discuss] " Josh Triplett
2016-11-08 10:50       ` Mauro Carvalho Chehab
2016-11-16 16:03         ` Arnd Bergmann
2016-11-16 20:26           ` Mauro Carvalho Chehab
2016-11-17 11:07             ` Arnd Bergmann
2016-11-17 11:28               ` Jani Nikula
2016-11-17 12:39                 ` Mauro Carvalho Chehab
2016-11-17 14:52               ` Theodore Ts'o
2016-11-17 15:16                 ` Mauro Carvalho Chehab
2016-11-17 15:28                   ` Johannes Berg
2016-11-17 16:25                   ` James Bottomley
2016-11-17 15:32               ` Mauro Carvalho Chehab
2016-11-17 16:02               ` Linus Torvalds
2016-11-17 16:04                 ` Linus Torvalds
2016-11-18  9:15                 ` Jani Nikula
2016-11-18 10:23                   ` Daniel Vetter
2016-11-19 17:15                 ` Jonathan Corbet
2016-11-19 17:38                   ` Andrew Lunn
2016-11-19 17:50                   ` Bart Van Assche
2016-11-19 17:55                   ` David Woodhouse
2016-11-19 18:45                     ` Linus Torvalds
2016-11-19 22:59                       ` David Woodhouse
2016-11-20 14:26                         ` Mauro Carvalho Chehab
2016-11-19 20:54                   ` Mauro Carvalho Chehab
2016-11-19 21:09                     ` Linus Torvalds
2016-11-21 10:39                   ` Johannes Berg
2016-11-21 14:06                     ` Mauro Carvalho Chehab
2016-11-21 15:41                       ` James Bottomley
2016-11-21 15:44                         ` Johannes Berg
2016-11-21 15:47                           ` Jani Nikula
2016-11-21 19:48                           ` Mauro Carvalho Chehab
2016-11-13 21:00     ` Jonathan Corbet
2016-11-14 14:16       ` Mauro Carvalho Chehab
2016-11-09 12:27   ` Mauro Carvalho Chehab
2016-11-07 17:01 ` [Ksummit-discuss] " Josh Triplett
2016-11-09  9:22   ` Markus Heiser
2016-11-09 11:16     ` Jani Nikula
2016-11-09 11:27       ` Mauro Carvalho Chehab
2016-11-09 11:45         ` Jani Nikula
2016-11-09 11:27       ` Markus Heiser
2016-11-09 11:58         ` Jani Nikula
2016-11-09 22:11           ` Markus Heiser [this message]
2016-11-10 10:35             ` Jani Nikula
2016-11-11 11:22               ` Jani Nikula
2016-11-11 11:45                 ` Markus Heiser
2016-11-11  9:34           ` Mauro Carvalho Chehab
2016-11-13 19:52 ` Jonathan Corbet
2016-11-14 13:30   ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a6b88e7d-9d6b-4dcc-3d2e-c09bdf366b40@darmarit.de \
    --to=markus.heiser@darmarit.de \
    --cc=corbet@lwn.net \
    --cc=jani.nikula@linux.intel.com \
    --cc=josh@joshtriplett.org \
    --cc=ksummit-discuss@lists.linuxfoundation.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@s-opensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).