Makefile: Reduce use of $^ in build rules
It's rare to use all of a target's prerequisites in a recipe - replace most cases with $< (the target's first prerequisite). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
9430fea2c5
commit
399d539969
|
@ -59,7 +59,7 @@ lib/bossac/bin/bossac:
|
|||
$(Q)make -C lib/bossac bin/bossac
|
||||
|
||||
flash: $(OUT)klipper.bin lib/bossac/bin/bossac
|
||||
@echo " Flashing $^ to $(FLASH_DEVICE) via bossac"
|
||||
@echo " Flashing $< to $(FLASH_DEVICE) via bossac"
|
||||
$(Q)if [ -z $(FLASH_DEVICE) ]; then echo "Please specify FLASH_DEVICE"; exit 1; fi
|
||||
$(Q)lib/bossac/bin/bossac -U -p "$(FLASH_DEVICE)" -a -e -w $(OUT)klipper.bin -v -b
|
||||
$(Q)lib/bossac/bin/bossac -U -p "$(FLASH_DEVICE)" -a -e -w $< -v -b
|
||||
$(Q)lib/bossac/bin/bossac -p "$(FLASH_DEVICE)" -b -R > /dev/null 2>&1 || true
|
||||
|
|
|
@ -61,6 +61,6 @@ BOSSAC_OFFSET-$(CONFIG_MACH_SAMD21) := 0x2000
|
|||
BOSSAC_OFFSET-$(CONFIG_MACH_SAMD51) := 0x4000
|
||||
|
||||
flash: $(OUT)klipper.bin lib/bossac/bin/bossac
|
||||
@echo " Flashing $^ to $(FLASH_DEVICE) via bossac"
|
||||
@echo " Flashing $< to $(FLASH_DEVICE) via bossac"
|
||||
$(Q)if [ -z $(FLASH_DEVICE) ]; then echo "Please specify FLASH_DEVICE"; exit 1; fi
|
||||
$(Q)lib/bossac/bin/bossac -U -p "$(FLASH_DEVICE)" -a --offset=$(BOSSAC_OFFSET-y) -w $(OUT)klipper.bin -v -b -R
|
||||
$(Q)lib/bossac/bin/bossac -U -p "$(FLASH_DEVICE)" -a --offset=$(BOSSAC_OFFSET-y) -w $< -v -b -R
|
||||
|
|
|
@ -29,6 +29,6 @@ $(OUT)klipper.elf.hex: $(OUT)klipper.elf
|
|||
$(Q)$(OBJCOPY) -j .text -j .data -O ihex $< $@
|
||||
|
||||
flash: $(OUT)klipper.elf.hex
|
||||
@echo " Flashing $^ to $(FLASH_DEVICE) via avrdude"
|
||||
@echo " Flashing $< to $(FLASH_DEVICE) via avrdude"
|
||||
$(Q)if [ -z $(FLASH_DEVICE) ]; then echo "Please specify FLASH_DEVICE"; exit 1; fi
|
||||
$(Q)avrdude -p$(CONFIG_MCU) -c$(CONFIG_AVRDUDE_PROTOCOL) -P"$(FLASH_DEVICE)" -D -U"flash:w:$(OUT)klipper.elf.hex:i"
|
||||
$(Q)avrdude -p$(CONFIG_MCU) -c$(CONFIG_AVRDUDE_PROTOCOL) -P"$(FLASH_DEVICE)" -D -U"flash:w:$(<):i"
|
||||
|
|
|
@ -31,7 +31,7 @@ $(OUT)pru0.elf: $(patsubst %.c, $(OUT)src/%.o,$(pru0-y))
|
|||
|
||||
$(OUT)pru1.elf: $(OUT)klipper.elf
|
||||
@echo " Linking $@"
|
||||
$(Q)$(CC) $(CFLAGS_pru1.elf) $^ -o $@
|
||||
$(Q)$(CC) $(CFLAGS_pru1.elf) $< -o $@
|
||||
|
||||
flash: $(OUT)pru0.elf $(OUT)pru1.elf
|
||||
@echo " Flashing"
|
||||
|
|
|
@ -47,5 +47,5 @@ $(OUT)klipper.bin: $(OUT)klipper.elf
|
|||
$(Q)$(OBJCOPY) -O binary $< $@
|
||||
|
||||
flash: $(OUT)klipper.bin
|
||||
@echo " Flashing $^ to $(FLASH_DEVICE) via stm32flash"
|
||||
$(Q)stm32flash -w $(OUT)klipper.bin -v -g 0 $(FLASH_DEVICE)
|
||||
@echo " Flashing $< to $(FLASH_DEVICE) via stm32flash"
|
||||
$(Q)stm32flash -w $< -v -g 0 $(FLASH_DEVICE)
|
||||
|
|
Loading…
Reference in New Issue