magic/utils
Darryl L. Miles b3d6540f13 build: isolate build-info defines into utils/buildinfo.c (ccache-friendly)
MAGIC_VERSION / MAGIC_REVISION / MAGIC_COMMIT / MAGIC_BUILDDATE were on the
global DFLAGS, so every object's compile command line carried them.  Because
the command line is part of ccache/sccache's hash key and MAGIC_BUILDDATE
changes every second, that meant a cache miss on every unit on every build;
it also smeared the baked-in date/commit across "whenever each file last
recompiled".

Move the four values into a single translation unit:
  * utils/magic_buildinfo.h -- extern MagicVersion/MagicRevision/MagicCommit/
    MagicCompileTime (MagicCommit is new; the other three moved here from
    utils/magic.h, which now includes this header).
  * utils/buildinfo.c -- the ONLY unit compiled with the version defines
    (target-specific `buildinfo.o: DFLAGS += ${DFLAGS_MAGICVERSION}` in
    utils/Makefile.in); it defines the four globals.  ${DFLAGS_MAGICVERSION}
    is removed from the global DFLAGS/DFLAGS_NOSTUB.

Consumers updated to read the runtime symbol instead of the compile-time
macro:
  * magicTop.c / tclmagic.c no longer define the globals (the MAGIC_WRAPPER
    duplicate-symbol guard is gone -- buildinfo.o owns them for every variant,
    including WASM, which links both mains).
  * Tcl_PkgProvide/PkgRequire in router/ext2spice/lef/ext2sim/plot/tclmagic
    now pass MagicVersion.
  * extflat: EFVersion (a static-initialized copy of MAGIC_VERSION) is dropped;
    EFread.c compares the .ext version against MagicVersion directly -- the same
    value ExtCell.c already *writes* into .ext files, so read and write are now
    consistent.

Verified: only buildinfo.o carries -DMAGIC_* (hash/DBio/windCmdSZ carry none);
Tcl (375 files) and --without-tcl builds rc=0, version/commit/date embedded in
tclmagic.so, magicTop.o no longer defines MagicVersion; in-tree source clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-26 14:54:11 -04:00
..
LIBdbio.c Added the ability to read compressed .mag files (writing is not yet 2022-11-02 17:12:46 -04:00
LIBmain.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
LIBtextio.c LIBtextio.c: printf style constify fmt call-site 2025-01-03 09:08:14 +00:00
Makefile.in build: isolate build-info defines into utils/buildinfo.c (ccache-friendly) 2026-07-26 14:54:11 -04:00
args.c One additional modification to check for a space in the option 2026-05-13 08:38:11 -04:00
buildinfo.c build: isolate build-info defines into utils/buildinfo.c (ccache-friendly) 2026-07-26 14:54:11 -04:00
child.c utils/*.c: K&R conversion to ANSI 2025-01-06 16:14:34 +00:00
displays.proto Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
dqueue.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
dqueue.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
finddisp.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
flock.c CodeQL FileMayNotBeClosed.ql flock.c may also leak 'fd' in error paths 2025-08-04 16:31:07 -04:00
flsbuf.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
fraction.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
geofast.h header file #ifndef guard presence consistency 2025-07-29 10:50:32 -04:00
geometry.c utils/*.c: K&R conversion to ANSI 2025-01-06 16:14:34 +00:00
geometry.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
getrect.c 35 x warning: suggest parentheses around assignment used as truth value 2024-10-09 21:12:55 -04:00
hash.c codebase-wide: use flexible arrays where appropriate 2026-07-01 12:37:44 -04:00
hash.h hack: make flexible union members work on gcc≤14 2026-07-01 12:37:44 -04:00
heap.c hash.c: K&R conversion to ANSI and constify arguments / callback 2025-01-06 16:15:58 +00:00
heap.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
ihash.c callocMagic has same API argument convention as calloc() 2025-12-19 09:31:58 -05:00
ihash.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
list.c freeMagic1() idiom insertion at all sites reported by static code analysis 2025-12-19 09:31:58 -05:00
list.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
lookup.c util/lookup*.c: fix integer pointer arithmetic not using pointertype 2024-12-26 15:20:58 -05:00
lookupany.c utils/lookup*.c: constify the API 2024-12-26 15:20:58 -05:00
lookupfull.c util/lookup*.c: fix integer pointer arithmetic not using pointertype 2024-12-26 15:20:58 -05:00
macros.c Substantially revised the "macro" command callback functions and 2025-10-09 15:43:54 -04:00
macros.h Substantially revised the "macro" command callback functions and 2025-10-09 15:43:54 -04:00
magic.h build: isolate build-info defines into utils/buildinfo.c (ccache-friendly) 2026-07-26 14:54:11 -04:00
magic_alloca.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
magic_assert.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
magic_buildinfo.h build: isolate build-info defines into utils/buildinfo.c (ccache-friendly) 2026-07-26 14:54:11 -04:00
magic_stdbool.h C23: use AC_HEADER_STDBOOL #include <stdbool.h> 2025-07-26 17:44:45 -04:00
magic_zlib.h CodeQL FileMayNotBeClosed.ql flock.c may also leak 'fd' in error paths 2025-08-04 16:31:07 -04:00
magsgtty.h utils/magsgtty.h removal and fixup 2026-03-26 09:21:18 -04:00
main.c Added some support for the open PDKs in the technology manager GUI. 2026-06-08 15:10:14 -04:00
main.h Add WASM entry point and Emscripten build wiring 2026-05-11 14:20:47 -04:00
malloc.c malloc: remove #pragma weak as MacOS does not like 2025-12-19 09:31:58 -05:00
malloc.h malloc: remove #pragma weak as MacOS does not like 2025-12-19 09:31:58 -05:00
match.c utils/*.c: K&R conversion to ANSI 2025-01-06 16:14:34 +00:00
maxrect.c First cut of pulling the TT_SIDE bit out of the tile database 2026-01-09 12:05:03 -05:00
maxrect.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
netlist.c freeMagic1() idiom insertion at all sites reported by static code analysis 2025-12-19 09:31:58 -05:00
netlist.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
niceabort.c niceabort.c: include <time.h> remove preC89 declarations 2025-07-29 10:50:32 -04:00
parser.c parser.c: ParsSplit() constify (const char **remainder) 2025-10-04 20:50:31 -04:00
parsetest.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
path.c CodeQL FileMayNotBeClosed.ql flock.c may also leak 'fd' in error paths 2025-08-04 16:31:07 -04:00
paths.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
pathvisit.c freeMagic1() idiom insertion at all sites reported by static code analysis 2025-12-19 09:31:58 -05:00
pathvisit.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
port.c utils/*.c: K&R conversion to ANSI 2025-01-06 16:14:34 +00:00
printstuff.c Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
runstats.c Reworked the way that magic displays measurement values (both linear 2026-01-24 16:19:12 -05:00
runstats.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
set.c utils/*.c: K&R conversion to ANSI 2025-01-06 16:14:34 +00:00
show.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
signals.c Corrected the "char" casting of SigInterruptOnSigIO, which (1) must 2026-07-06 09:17:32 -04:00
signals.h Corrected the "char" casting of SigInterruptOnSigIO, which (1) must 2026-07-06 09:17:32 -04:00
stack.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
stack.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
strdup.c utils/strdup.c: StrDup() and mode constifiy impl 2024-12-26 15:10:35 -05:00
styles.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
tech.c Minor correction to the new "repeat <steps> ... endrepeat" function for 2026-03-02 12:24:46 -05:00
tech.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
touchingtypes.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
touchtypes.c First cut of pulling the TT_SIDE bit out of the tile database 2026-01-09 12:05:03 -05:00
undo.c codebase-wide: use flexible arrays where appropriate 2026-07-01 12:37:44 -04:00
undo.h header file #ifndef guard namespace consistency (global change) 2025-07-29 10:50:32 -04:00
utils.h parser.c: ParsSplit() constify (const char **remainder) 2025-10-04 20:50:31 -04:00