magic/doc
Darryl L. Miles b2c35f8249 build: make the psfigures symlink source-safe and -j-safe
Out-of-tree, doc/latexfiles points a build-tree ../psfigures at the source
copy so latex/dvips resolve ../psfigures/*.ps.  The old
`test -e ../psfigures || ln -s ... ../psfigures` had two defects:

  * Under a parallel docs build two .ps jobs could both see ../psfigures
    absent and both run `ln -s`.  The second `ln -s DIR symlink-to-dir`
    nests the link *inside* the target, writing a stray
    doc/psfigures/psfigures INTO THE SOURCE TREE -- an out-of-tree build
    must never modify source.
  * (An order-only make prerequisite is not a fix here: VPATH makes make
    "find" ../psfigures in the source tree and skip creating the build link
    latex actually needs.)

Use a shell test (VPATH-immune) that is both idempotent and race/nest safe:
`test -d ../psfigures || ln -sfn ${MAGICSRC}/doc/psfigures ../psfigures`.
`test -d` is true in-tree (real source dir) and once the build symlink
exists; `ln -sfn` (force + no-dereference) replaces an existing symlink in
place instead of nesting inside it.

Verified in/out of tree under -j12: 28/28 docs, correct single-level build
symlink, source tree never touched (in-tree psfigures stays a real dir).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-26 14:54:11 -04:00
..
html build: doc/html install ships only content, not build files 2026-07-26 14:54:11 -04:00
latexfiles build: make the psfigures symlink source-safe and -j-safe 2026-07-26 14:54:11 -04:00
man build: nested-child Makefile.in use @srcdir@ 2026-07-26 14:54:11 -04:00
psfigures Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
psfiles Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
textfiles Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
tutcells build: nested-child Makefile.in use @srcdir@ 2026-07-26 14:54:11 -04:00
Makefile.in build: convert nested children + rewire parent recursion to native 2026-07-26 14:54:11 -04:00