The out-of-tree build puts absolute source-root paths on the command line
(-I${MAGICSRC}, -I${srcdir}, the source file itself), which are part of
ccache's key -- so same-tree rebuilds hit (proven) but different checkouts /
build dirs do not share cache.
New opt-in configure --enable-ccache-prefix-map adds
-ffile-prefix-map=${MAGICSRC}=.
to CFLAGS (requires ccache; the flag is probed for GCC-8+/clang support and
skipped with a warning otherwise). This relativizes the source paths embedded
in the compiled output (__FILE__, debug info) so a cached object is valid
regardless of which tree produced it.
Off by default: it makes debug paths relative, so gdb then needs
`set substitute-path . <srcdir>`. It is only for cross-tree *correctness* and
must be paired with CCACHE_BASEDIR=<build top> in the environment for cross-tree
*hits* (that half normalizes the command-line paths in the hash; this half keeps
the cached output tree-neutral). Same-tree caching needs neither.
Verified: default/--disable-ccache carry no -ffile-prefix-map;
--enable-ccache-prefix-map (probe "yes") adds it, and with --disable-ccache it
warns and is ignored. Full build rc=0 (375 files); the installed tclmagic.so
contains zero absolute /work/magic paths.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| .gitignore | ||
| config.guess | ||
| config.sub | ||
| configure | ||
| configure.in | ||
| configure_mac | ||
| defs.mak.in | ||
| install-sh | ||
| magic.spec.in | ||
| makedbh.in | ||
| missing | ||
| mkdirs | ||
| mkinstalldirs | ||
| preproc.py | ||
| printmans | ||