Beautify make size prints

This commit is contained in:
CTCaer 2020-07-14 20:56:56 +03:00
parent ddc89c9f49
commit ffd5a198f9
2 changed files with 14 additions and 10 deletions

View file

@ -84,11 +84,14 @@ NYXDIR := $(wildcard nyx)
.PHONY: all clean $(MODULEDIRS) $(NYXDIR) .PHONY: all clean $(MODULEDIRS) $(NYXDIR)
all: $(TARGET).bin all: $(TARGET).bin
@echo -n "Payload size is " @printf ICTC49 >> $(OUTPUTDIR)/$(TARGET).bin
@echo "--------------------------------------"
@echo -n "Payload size: "
$(eval BIN_SIZE = $(shell wc -c < $(OUTPUTDIR)/$(TARGET).bin)) $(eval BIN_SIZE = $(shell wc -c < $(OUTPUTDIR)/$(TARGET).bin))
@echo $(BIN_SIZE) @echo $(BIN_SIZE)" Bytes"
@echo "Max size is 126296 Bytes." @echo "Payload Max: 126296 Bytes"
@if [ ${BIN_SIZE} -gt 126296 ]; then echo "\e[1;33mPayload size exceeds limit!\e[0m"; fi @if [ ${BIN_SIZE} -gt 126296 ]; then echo "\e[1;33mPayload size exceeds limit!\e[0m"; fi
@echo "--------------------------------------"
clean: clean:
@rm -rf $(OBJS) @rm -rf $(OBJS)
@ -96,14 +99,13 @@ clean:
@rm -rf $(OUTPUTDIR) @rm -rf $(OUTPUTDIR)
$(MODULEDIRS): $(MODULEDIRS):
@$(MAKE) -C $@ $(MAKECMDGOALS) -$(MAKEFLAGS) @$(MAKE) --no-print-directory -C $@ $(MAKECMDGOALS) -$(MAKEFLAGS)
$(NYXDIR): $(NYXDIR):
@$(MAKE) -C $@ $(MAKECMDGOALS) -$(MAKEFLAGS) @$(MAKE) --no-print-directory -C $@ $(MAKECMDGOALS) -$(MAKEFLAGS)
$(TARGET).bin: $(BUILDDIR)/$(TARGET)/$(TARGET).elf $(MODULEDIRS) $(NYXDIR) $(TARGET).bin: $(BUILDDIR)/$(TARGET)/$(TARGET).elf $(MODULEDIRS) $(NYXDIR)
$(OBJCOPY) -S -O binary $< $(OUTPUTDIR)/$@ $(OBJCOPY) -S -O binary $< $(OUTPUTDIR)/$@
@printf ICTC49 >> $(OUTPUTDIR)/$@
$(BUILDDIR)/$(TARGET)/$(TARGET).elf: $(OBJS) $(BUILDDIR)/$(TARGET)/$(TARGET).elf: $(OBJS)
@$(CC) $(LDFLAGS) -T $(SOURCEDIR)/link.ld $^ -o $@ @$(CC) $(LDFLAGS) -T $(SOURCEDIR)/link.ld $^ -o $@

View file

@ -86,8 +86,7 @@ CUSTOMDEFINES += -DNYX -DGFX_INC=$(GFX_INC) -DFFCFG_INC=$(FFCFG_INC)
#CUSTOMDEFINES += -DDEBUG #CUSTOMDEFINES += -DDEBUG
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb-interwork ARCH := -march=armv4t -mtune=arm7tdmi -mthumb-interwork
CFLAGS = $(ARCH) -O2 -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -std=gnu11 -Wall $(CUSTOMDEFINES) CFLAGS = $(ARCH) -O2 -g -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -std=gnu11 -Wall $(CUSTOMDEFINES)
CFLAGS += -g
LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections -Xlinker --defsym=NYX_LOAD_ADDR=$(NYX_LOAD_ADDR) LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections -Xlinker --defsym=NYX_LOAD_ADDR=$(NYX_LOAD_ADDR)
################################################################################ ################################################################################
@ -95,8 +94,11 @@ LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections -Xlinker --defs
.PHONY: all clean .PHONY: all clean
all: $(TARGET).bin all: $(TARGET).bin
@echo -n "Nyx size is " @echo "--------------------------------------"
@wc -c < $(OUTPUTDIR)/$(TARGET).bin @echo -n "Nyx size: "
$(eval BIN_SIZE = $(shell wc -c < $(OUTPUTDIR)/$(TARGET).bin))
@echo $(BIN_SIZE)" Bytes"
@echo "--------------------------------------"
clean: clean:
@rm -rf $(OBJS) @rm -rf $(OBJS)