Skip to content

Commit

Permalink
Fix target dependencies and use automatic variables in Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrozap committed Mar 4, 2021
1 parent e2c8265 commit b371182
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ STARTUP += $(STM32_STARTUP:%.s=$(BUILD_DIR)/%.o)
all: $(TARGET).hex $(TARGET).bin size

$(TARGET).bin: $(TARGET).elf
$(OBJCOPY) -Obinary $(TARGET).elf $(TARGET).bin
$(OBJCOPY) -Obinary $< $@

$(TARGET).hex: $(TARGET).elf
$(OBJCOPY) -Oihex $(TARGET).elf $(TARGET).hex
$(OBJCOPY) -Oihex $< $@

$(TARGET).elf: $(OBJS) $(STARTUP)
$(CC) $(LDFLAGS) $^ -o $@
Expand All @@ -67,12 +67,12 @@ cppcheck: $(SRCS)
$(CPPCHECK) $(CHKFLAGS) $(STM32_INCLUDES) $(DEFINES) --output-file=$(CHKREPORT) $^

.PHONY: flash
flash: all
$(STFLASH) --format ihex write $(TARGET).hex
flash: $(TARGET).hex
$(STFLASH) --format ihex write $<

.PHONY: size
size:
$(SIZE) $(TARGET).elf
size: $(TARGET).elf
$(SIZE) $<

.PHONY: clean
clean:
Expand Down

0 comments on commit b371182

Please sign in to comment.