magic/scripts
Darryl L. Miles 1bc8537b5d build: per-file automatic dependencies (.deps), retire the Depend/sed machinery
Replace the monolithic per-directory `Depend` file -- generated by a separate,
serial `make depend` pass (one `gcc -MM` over all sources) and post-processed by
sed -- with automake-style per-file dependency fragments produced as a side
effect of each compile.

rules.mak's %.o rule now adds, when the compiler supports it,
  -MMD -MP -MF .deps/<stem>.d
so every object records the (non-system) headers it used.  Those fragments are
`-include`d best-effort: absent on a first build, present and correct after.
Benefits:
  * self-maintaining -- no explicit depend step; deps refresh on every compile;
  * parallel -- generated during the (already parallel) compile, no barrier;
  * -MMD already drops system headers (what the sed did) and -MP tolerates a
    removed/renamed header, so the sed post-processing is gone;
  * fixes out-of-tree incremental header tracking: with an absolute srcdir the
    old sed stripped the now-absolute *local* header paths too, silently losing
    them; the .d files keep them.

configure probes `-MMD -MP` (AUTODEP_FLAGS; empty and best-effort-skipped if the
compiler cannot).  clean/distclean remove .deps (rm -r); .gitignore replaces the
obsolete */Depend with .deps/.  `make depend` is kept as a no-op for callers that
still invoke it (e.g. the WASM build script).

Verified out-of-tree (--disable-ccache): 324 .d files, 0 Depend files, a header
touch recompiles its dependents, no-op rebuild is idle, clean clears .deps.  (The
top-level depend phase still runs here as a no-op; removed next.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-26 14:54:11 -04:00
..
.gitignore Allow Python 3 to not be in PATH, Fix `clean` re-building dependencies 2023-08-29 22:43:11 +03:00
config.guess Update config.guess/config.log 2020-12-24 21:59:14 -05:00
config.sub Update config.guess/config.log 2020-12-24 21:59:14 -05:00
configure build: per-file automatic dependencies (.deps), retire the Depend/sed machinery 2026-07-26 14:54:11 -04:00
configure.in build: per-file automatic dependencies (.deps), retire the Depend/sed machinery 2026-07-26 14:54:11 -04:00
configure_mac GHA: MacOS maintenance update 2025-01-04 11:23:39 -05:00
defs.mak.in build: per-file automatic dependencies (.deps), retire the Depend/sed machinery 2026-07-26 14:54:11 -04:00
install-sh Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
magic.spec.in Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
makedbh.in makedbh.in _DATABASE_H => _MAGIC__DATABASE__DATABASE_H 2025-07-29 10:50:32 -04:00
missing Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
mkdirs Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
mkinstalldirs Convert $Id$ placeholders to $Header$ placeholders. 2020-05-23 17:00:38 -04:00
preproc.py Use raw strings in preproc.py 2024-01-23 09:38:23 -06:00
printmans Build Updates 2023-08-25 12:24:14 -04:00