public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Jon Turney <jon.turney@dronecode.org.uk>
Cc: "newlib@sourceware.org" <newlib@sourceware.org>
Subject: Re: [PATCH 4/5 v3] newlib: move man page generation into top-level build
Date: Tue, 1 Feb 2022 18:12:17 -0500	[thread overview]
Message-ID: <Yfm+UaxukIDTwbGb@vapier> (raw)
In-Reply-To: <40acd8d2-b43f-e65e-d612-93d327a3052e@dronecode.org.uk>

[-- Attachment #1: Type: text/plain, Size: 3471 bytes --]

On 01 Feb 2022 14:37, Jon Turney wrote:
> On 01/02/2022 06:21, Mike Frysinger wrote:
> > +%D%/libc.xml.stamp: %D%/libc.in.xml $(LIBC_CHAPTERS) $(LIBC_DOCBOOK_OUT_FILES)
> > +	$(AM_V_at)\
> > +	for chapter in $(LIBC_CHAPTERS); do \
> > +	  $(TEXI2DOCBOOK) < $(srcdir)/$$chapter > %D%/`basename $${chapter%.tex}`.xml || exit 1; \
> > +	done
> > +	$(AM_V_GEN)xsltproc --xinclude --path $(builddir)/%D% --nonet $(srcdir)/refcontainers.xslt $< > $@.tmp
> > +	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $(@:.stamp=)
> > +	$(AM_V_at)touch $@
> > +%D%/libc.xml: %D%/libc.xml.stamp; @true
> 
> This doesn't seem right.
> 
> This rule produces a single output with a definite name 'lib.xml', so 
> there's no need for a timestamp file?

you can use this exact same argument for targetdep.tex.  i don't see why we'd
use the stamp idiom for one but not the other.  they both gather multiple
inputs and produce a single output.  i'm fine killing off the stamp logic
entirely and changing move-if-change to a plain mv, and skipping the minor
timestamp optimization altogether.  we obviously don't write directly to $@
in order to avoid an interrupt producing an incomplete file that the build
cannot recover itself.

the older rules that i'm replacing had more expensive checks for their inputs
(using recursive makes and recursive stamps), but by merging the Makefiles
all into one, we have full direct visibility into all the inputs.  but that
aspect doesn't matter to what these specific stamp files are saving: keeping
timestamp shifts from forcing info & pdf & html & man regens.

afaict, the only arguments for this are (1) dev time optimization (building
from git) and (2) release time requirements (toolchain builders don't need
full texinfo stack as the dist tarball includes the info/pdf/etc...).  the
stamp files gets us (1) but not (2) because the newlib dists have never had
the docs included.  i think it's just a tarball of the git state.

old rules:

targetdep.tex: stmp-targetdep ; @true
stmp-targetdep: force
    rm -f tmp.texi
    targetdoc=`pwd`/tmp.texi; \
    for d in $(SUBDIRS); do \
      if test "$$d" != "."; then \
        (cd $$d && $(MAKE) doc) || exit 1; \
      fi; \
    done
    $(SHELL) $(newlib_basedir)/../move-if-change tmp.texi targetdep.tex
    touch $@

man: math/stmp-xml complex/stmp-xml libm.in.xml
    xsltproc --xinclude --path ${builddir} --nonet ${srcdir}/../refcontainers.xslt ${srcdir}/libm.in.xml >libm.xml
    ...
docbook-recursive: force
    for d in $(SUBDIRS); do \
      if test "$$d" != "."; then \
        (cd $$d && $(MAKE) docbook) || exit 1; \
      fi; \
    done
math/stmp-xml complex/stmp-xml: docbook-recursive

new rules don't have any recursive makes:

LIBM_CHAPTERS = <complete list of source .tex files>
%D%/targetdep.tex: $(LIBM_CHAPTERS)
    $(AM_V_GEN)cat $^ > $@.tmp
    $(AM_V_at)mv $@.tmp $@

LIBM_DOCBOOK_OUT_FILES = <complete list of generated .c -> .def -> .xml files>
%D%/libm.xml: %D%/libm.in.xml $(LIBM_CHAPTERS) $(LIBM_DOCBOOK_OUT_FILES)
    $(AM_V_at)\
    for chapter in $(LIBM_CHAPTERS); do \
      $(TEXI2DOCBOOK) < $(srcdir)/$$chapter > %D%/`basename $${chapter%.tex}`.xml || exit 1; \
    done
    $(AM_V_GEN)xsltproc --xinclude --path $(builddir)/%D% --nonet $(srcdir)/refcontainers.xslt $< > $@.tmp
    $(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $@
    $(AM_V_at)touch $@
-mike

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-02-01 23:12 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-22  4:32 [PATCH 0/5] migrate documentation into top-level Mike Frysinger
2022-01-22  4:32 ` [PATCH 1/5] newlib: libm: move manual into top-level build Mike Frysinger
2022-01-22  4:32 ` [PATCH 2/5] newlib: libc: include all chapters all the time in the manual Mike Frysinger
2022-01-22  4:32 ` [PATCH 3/5] newlib: libc: move manual into top-level build Mike Frysinger
2022-01-24 14:30   ` Corinna Vinschen
2022-01-22  4:32 ` [PATCH 4/5] newlib: move man page generation " Mike Frysinger
2022-01-22  4:32 ` [PATCH 5/5] newlib: drop shared documentation rules Mike Frysinger
2022-01-28  7:58 ` [PATCH 1/5 v2] newlib: libm: move manual into top-level build Mike Frysinger
2022-01-28  7:58   ` [PATCH 2/5 v2] newlib: libc: include all chapters all the time in the manual Mike Frysinger
2022-01-28  7:58   ` [PATCH 3/5 v2] newlib: libc: move manual into top-level build Mike Frysinger
2022-01-28  7:58   ` [PATCH 4/5 v2] newlib: move man page generation " Mike Frysinger
2022-01-28  7:58   ` [PATCH 5/5 v2] newlib: drop shared documentation rules Mike Frysinger
2022-01-31 14:58   ` [PATCH 1/5 v2] newlib: libm: move manual into top-level build Jon Turney
2022-02-01  3:40     ` Mike Frysinger
2022-02-01 14:37       ` Jon Turney
2022-02-01  6:21 ` [PATCH 1/5 v3] " Mike Frysinger
2022-02-01  6:21   ` [PATCH 2/5 v3] newlib: libc: include all chapters all the time in the manual Mike Frysinger
2022-02-01  6:21   ` [PATCH 3/5 v3] newlib: libc: move manual into top-level build Mike Frysinger
2022-02-01  6:21   ` [PATCH 4/5 v3] newlib: move man page generation " Mike Frysinger
2022-02-01 14:37     ` Jon Turney
2022-02-01 23:12       ` Mike Frysinger [this message]
2022-02-01  6:21   ` [PATCH 5/5 v3] newlib: drop shared documentation rules Mike Frysinger
2022-02-05 12:13   ` [PATCH 1/5 v3] newlib: libm: move manual into top-level build Corinna Vinschen
2022-02-05 18:04     ` Mike Frysinger
2022-02-07 10:30       ` Corinna Vinschen

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=Yfm+UaxukIDTwbGb@vapier \
    --to=vapier@gentoo.org \
    --cc=jon.turney@dronecode.org.uk \
    --cc=newlib@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).