Makefile: sort out CFLAGS and LDFLAGS

This commit is contained in:
xinyangli 2024-12-11 17:01:38 +08:00
parent 5ca5e6972b
commit 3e33f2e0f1
Signed by: xin
SSH key fingerprint: SHA256:UU5pRTl7NiLFJbWJZa+snLylZSXIz5rgHmwjzv8v4oE
4 changed files with 39 additions and 20 deletions

View file

@ -56,7 +56,7 @@ $(eval $(call COMPILE_RULES,$(2)))
$(1).elf: $$($(2)OBJS)
@mkdir -p $$(dir $$@)
@echo + LD "->" $$(patsubst $$(CURDIR)/%,%,$(1).elf)
@$$(LD) $$($(2)_LDFLAGS) -o $$@ --start-group $$($(2)OBJS) --end-group
@$$(LD) $$($(2)LDFLAGS) -o $$@ --start-group $$($(2)OBJS) --end-group
$(1).bin: $(1).elf
@echo + OBJCOPY "->" $$(patsubst $$(CURDIR)/%,%,$(1))
@$$(OBJCOPY) -S --set-section-flags .bss=alloc,contents -O binary $(1).elf $(1).bin