From 0da44473b32eb703cbd66f8ca4628cb5690ca85f Mon Sep 17 00:00:00 2001 From: Faidon Liambotis Date: Mon, 13 Mar 2023 15:27:40 +0000 Subject: [PATCH] flasher_stub: create %.json targets, make all a proper PHONY --- flasher_stub/Makefile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/flasher_stub/Makefile b/flasher_stub/Makefile index 2faf37162..41eae4558 100644 --- a/flasher_stub/Makefile +++ b/flasher_stub/Makefile @@ -93,13 +93,21 @@ endif .PHONY: all clean embed -all: $(STUBS_ELF) - @echo " WRAP $^ -> $(BUILD_DIR)" - $(Q) $(WRAP_STUB) $^ +all: $(STUBS_ELF:.elf=.json) + +embed: $(patsubst $(BUILD_DIR)/%.elf,$(ESPTOOL_STUBS_DIR)/%.json,$(STUBS_ELF)) $(BUILD_DIR): $(Q) mkdir $@ +$(BUILD_DIR)/%.json: $(BUILD_DIR)/%.elf + @echo " WRAP $^ -> $(BUILD_DIR)" + $(Q) $(WRAP_STUB) $^ + +$(ESPTOOL_STUBS_DIR)/%.json: $(BUILD_DIR)/%.elf + @echo " WRAP $^ -> $(ESPTOOL_STUBS_DIR)" + $(Q) $(WRAP_STUB) --embed $^ + CFLAGS = -std=c99 -Wall -Werror -Os \ -mtext-section-literals -mlongcalls -nostdlib -fno-builtin -flto \ -Wl,-static -g -ffunction-sections -Wl,--gc-sections -Iinclude -Lld @@ -157,9 +165,5 @@ $(STUB_ELF_32H2): $(SRCS) $(BUILD_DIR) ld/stub_32h2.ld @echo " CC(32H2) $^ -> $@" $(Q) $(CROSS_ESPRISCV32)gcc $(CFLAGS_ESPRISCV32) -DESP32H2=1 -Tstub_32h2.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS) -embed: $(STUBS_ELF) - @echo " WRAP $^ -> $(ESPTOOL_STUBS_DIR)" - $(Q) $(WRAP_STUB) --embed $^ - clean: $(Q) rm -rf $(BUILD_DIR)