Skip to content

Commit 7e5c55d

Browse files
jeplerdpgeorge
authored andcommitted
py/mkrules.mk: Add %.sz rule to print size of an object file.
It's frequently the case that a developer will want to compare the object code size of various alternatives. When this can be done at the single object code level, the turnaround is faster. Provide a rule `$(BUILD)/%.sz` to print the size of a given object. Because it is a normal Makefile target that depends on an object file, it rebuilds the object file if needed. Signed-off-by: Jeff Epler <[email protected]>
1 parent 70c4ffa commit 7e5c55d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

py/mkrules.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ $(BUILD)/%.pp: %.c FORCE
108108
$(ECHO) "PreProcess $<"
109109
$(Q)$(CPP) $(CFLAGS) -Wp,-C,-dD,-dI -o $@ $<
110110

111+
.PHONY: $(BUILD)/%.sz
112+
$(BUILD)/%.sz: $(BUILD)/%.o
113+
$(Q)$(SIZE) $<
114+
111115
# Special case for compiling auto-generated source files.
112116
$(BUILD)/%.o: $(BUILD)/%.c
113117
$(call compile_c)

0 commit comments

Comments
 (0)