diff --git a/src/Makefile b/src/Makefile index 3a29b7b..5295576 100644 --- a/src/Makefile +++ b/src/Makefile @@ -47,6 +47,12 @@ OBJ = $(SRC:.c=.o) blackmagic: $(OBJ) $(CC) -o $@ $^ $(LDFLAGS) +%.bin: % + $(OBJCOPY) -O binary $^ $@ + +%.hex: % + $(OBJCOPY) -O ihex $^ $@ + .PHONY: clean host_clean all_platforms clean: host_clean diff --git a/src/platforms/f4discovery/Makefile.inc b/src/platforms/f4discovery/Makefile.inc index d8f7754..01b3f61 100644 --- a/src/platforms/f4discovery/Makefile.inc +++ b/src/platforms/f4discovery/Makefile.inc @@ -24,8 +24,5 @@ SRC += cdcacm.c \ all: blackmagic.bin -blackmagic.bin: blackmagic - $(OBJCOPY) -O binary $^ $@ - host_clean: -rm blackmagic.bin diff --git a/src/platforms/launchpad-icdi/Makefile.inc b/src/platforms/launchpad-icdi/Makefile.inc index 8a0f9a3..e46b727 100644 --- a/src/platforms/launchpad-icdi/Makefile.inc +++ b/src/platforms/launchpad-icdi/Makefile.inc @@ -19,5 +19,3 @@ SRC += cdcacm.c \ all: blackmagic.bin -blackmagic.bin: blackmagic - $(OBJCOPY) -O binary $^ $@ diff --git a/src/platforms/native/Makefile.inc b/src/platforms/native/Makefile.inc index 8b76a53..b5c5c33 100644 --- a/src/platforms/native/Makefile.inc +++ b/src/platforms/native/Makefile.inc @@ -23,17 +23,9 @@ SRC += cdcacm.c \ all: blackmagic.bin blackmagic_dfu.bin blackmagic_dfu.hex -blackmagic.bin: blackmagic - $(OBJCOPY) -O binary $^ $@ - blackmagic_dfu: usbdfu.o dfucore.o dfu_f1.o $(CC) $^ -o $@ $(LDFLAGS_BOOT) -blackmagic_dfu.bin: blackmagic_dfu - $(OBJCOPY) -O binary $^ $@ - -blackmagic_dfu.hex: blackmagic_dfu - $(OBJCOPY) -O ihex $^ $@ host_clean: -rm blackmagic.bin blackmagic_dfu blackmagic_dfu.bin blackmagic_dfu.hex diff --git a/src/platforms/stlink/Makefile.inc b/src/platforms/stlink/Makefile.inc index f2ebce5..5b2e61f 100644 --- a/src/platforms/stlink/Makefile.inc +++ b/src/platforms/stlink/Makefile.inc @@ -22,27 +22,12 @@ SRC += cdcacm.c \ all: blackmagic.bin blackmagic_dfu.bin blackmagic_dfu.hex dfu_upgrade.bin dfu_upgrade.hex -blackmagic.bin: blackmagic - $(OBJCOPY) -O binary $^ $@ - blackmagic_dfu: usbdfu.o dfucore.o dfu_f1.o $(CC) $^ -o $@ $(LDFLAGS_BOOT) -blackmagic_dfu.bin: blackmagic_dfu - $(OBJCOPY) -O binary $^ $@ - -blackmagic_dfu.hex: blackmagic_dfu - $(OBJCOPY) -O ihex $^ $@ - dfu_upgrade: dfu_upgrade.o dfucore.o dfu_f1.o $(CC) $^ -o $@ $(LDFLAGS) -dfu_upgrade.bin: dfu_upgrade - $(OBJCOPY) -O binary $^ $@ - -dfu_upgrade.hex: dfu_upgrade - $(OBJCOPY) -O ihex $^ $@ - host_clean: -rm blackmagic.bin blackmagic_dfu blackmagic_dfu.bin blackmagic_dfu.hex dfu_upgrade dfu_upgrade.bin dfu_upgrade.hex diff --git a/src/platforms/swlink/Makefile.inc b/src/platforms/swlink/Makefile.inc index f891cb0..c415ecd 100644 --- a/src/platforms/swlink/Makefile.inc +++ b/src/platforms/swlink/Makefile.inc @@ -22,18 +22,9 @@ SRC += cdcacm.c \ all: blackmagic.bin blackmagic_dfu.bin blackmagic_dfu.hex -blackmagic.bin: blackmagic - $(OBJCOPY) -O binary $^ $@ - blackmagic_dfu: usbdfu.o dfucore.o dfu_f1.o $(CC) $^ -o $@ $(LDFLAGS_BOOT) -blackmagic_dfu.bin: blackmagic_dfu - $(OBJCOPY) -O binary $^ $@ - -blackmagic_dfu.hex: blackmagic_dfu - $(OBJCOPY) -O ihex $^ $@ - host_clean: -rm blackmagic.bin blackmagic_dfu blackmagic_dfu.bin blackmagic_dfu.hex