Tcl Source Code

View Ticket
Login
Ticket UUID: 0a908bb93bb99e1ec828cfa04f2ca2dd51c1a033
Title: make does not rebuild object files after a header file is changed
Type: Bug Created on: 2026-10-20 16:28:19
Submitter: serhiy.storchaka Assigned to:
Subsystem: 53. Configuration and Build Tools Severity: Minor
Priority: 5 Medium Last modified: 2026-10-20 16:28:19
Status: Open Closed by:
Resolution: None Closed on:
Version: 9.1
Description:

After changing a header file, make does not rebuild most of the object files which include it: in unix/Makefile.in only some object files list some headers ($(COMPILEHDR), $(IOHDR), etc), in win/Makefile.in none, and make depend needs makedepend ([427101ffff], [427105ffff]). For example, changing generic/tcl.h or unix/tclUnixPort.h rebuilds nothing, and changing generic/tclInt.h rebuilds 3 object files. The same issue in Tk is Tk ticket a0109510a8.

Proposed fix in branch header-dependencies, the same as in Tk: if the compiler supports -MMD -MP (gcc and clang) and ${MAKE-make} supports -include, the compiler writes the header dependencies of every object file into a .d file, which the Makefile includes. This is done in unix/ and win/ (MinGW, MSYS2, Cygwin). With it, changing tcl.h rebuilds 182 object files on Linux, tclInt.h 112 on Linux and 115 with MinGW and MSYS2. With win/makefile.vc, nmake -f makefile.vc depend already works.