Question/Proposal: Incomplete debug graph output when using -o (--old-file)
WaitronCharm <[email protected]> Tue, 26 May 2026 13:29:50 +0000
| Newsgroups | gmane.comp.gnu.make.bugs |
|---|---|
| Message-ID | <COUmRkuhV6tx5Tji4gKkJUYVBZgeZpqob3RebsuuNOHex-o7wsmayDLmCpuzn7ondYCr3yiregvsp6M5i_aSDzyMTcimKcZsYEHTq-_Zzvc=@proton.me> |
Hello, I am working on reconstructing the visual dependency graph of a build using= GNU Make's --debug output. However, I have run into a limitation when comb= ining debugging with the -o (--old-file) option. When a target is marked as old via -o, GNU Make seems to immediately optimi= ze away the traversal of that target's prerequisites. Because these prerequ= isites are not traversed, they are completely omitted from the debug log. T= his leaves the reconstructed visual graph incomplete. From an execution standpoint, optimizing out these checks makes perfect sen= se. However, for tooling and visualization, it creates a blind spot. Could = the final decision to consider a target up-to-date (based on -o) be deferre= d until after its prerequisites have been traversed in the graph? I tried using the -n (--just-print / dry-run) option as an alternative to s= ee the full graph without executing commands, but it has a different limita= tion: rules that update included makefiles are still actively executed unde= r -n. This leaves a gap in the current options. There appears to be no combinatio= n of flags that allows a user to safely skip a target's execution while sti= ll fully discovering and dumping its underlying dependency tree in the debu= g output. Here is a minimal example demonstrating the behavior: $ make --debug -f - -o t1 GNU Make 4.4.1 Built for x86_64-pc-cygwin Copyright (C) 1988-2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.ht= ml> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. t1: t2; echo $@ t2:; echo $@ Reading makefiles... Updating makefiles.... Updating goal targets.... make: 't1' is up to date. Notice that t2 is never mentioned or evaluated in the debug output above. C= ompare this to a normal run where the full relationship is explicitly print= ed: $ make --debug -f - GNU Make 4.4.1 Built for x86_64-pc-cygwin Copyright (C) 1988-2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.ht= ml> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. t1: t2; echo $@ t2:; echo $@ Reading makefiles... Updating makefiles.... Updating goal targets.... File 't1' does not exist. File 't2' does not exist. Must remake target 't2'. echo t2 t2 Successfully remade target file 't2'. Must remake target 't1'. echo t1 t1 Successfully remade target file 't1'. Is this immediate pruning of the graph an intentional design constraint for= performance, or would the maintainers consider a patch/option that forces = prerequisite traversal even when a target is short-circuited by -o? I would love to hear your thoughts on whether this use case is currently su= pported through other means, or if a feature request is appropriate here.