Skip to content

Commit

Permalink
flasher_stub: create %.json targets, make all a proper PHONY
Browse files Browse the repository at this point in the history
  • Loading branch information
paravoid committed Mar 13, 2023
1 parent 2611f75 commit 0da4447
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions flasher_stub/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

0 comments on commit 0da4447

Please sign in to comment.