Makefile: improve print-binary-sizes to be more meaningful.

Users care about memory more than disk, and they care about programs
they run more than our test programs and tools.

Also, fix dependencies on print-binary-sizes, as spotted by
https://github.com/Lagrang3

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2026-01-27 09:36:23 +10:30
parent c7d313ea00
commit c8eb54be48

View File

@@ -1152,7 +1152,8 @@ ccan-rune-rune.o: $(CCANDIR)/ccan/rune/rune.c
ccan-rune-coding.o: $(CCANDIR)/ccan/rune/coding.c
@$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<)
print-binary-sizes: $(ALL_PROGRAMS) $(ALL_TEST_PROGRAMS)
@find $(ALL_PROGRAMS) $(ALL_TEST_PROGRAMS) -printf '%p\t%s\n'
@echo 'Total program size: '`find $(ALL_PROGRAMS) -printf '%s\n' | awk '{TOTAL+= $$1} END {print TOTAL}'`
@echo 'Total tests size: '`find $(ALL_TEST_PROGRAMS) -printf '%s\n' | awk '{TOTAL+= $$1} END {print TOTAL}'`
print-binary-sizes: $(ALL_PROGRAMS) $(ALL_TEST_PROGRAMS) $(BIN_PROGRAMS)
@echo User programs:
@size -t $(PKGLIBEXEC_PROGRAMS) $(filter-out tools/reckless,$(BIN_PROGRAMS)) $(PLUGINS)
@echo All programs:
@size -t $(ALL_PROGRAMS) $(ALL_TEST_PROGRAMS) | tail -n1