laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/16056 )

Change subject: sysmoOCTSIM: Proper Makefile targets
......................................................................

sysmoOCTSIM: Proper Makefile targets

It's really bad practsie to generate different output files from one
target, which breaks dependency generation and the like.  Let's have
separate Makefile targets for each output file we generate, all
depending on the .elf file.

Change-Id: Ie83722a9b61cfcd9865950ab4c088f59a15427ba
---
M sysmoOCTSIM/gcc/Makefile
1 file changed, 18 insertions(+), 7 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/sysmoOCTSIM/gcc/Makefile b/sysmoOCTSIM/gcc/Makefile
index c587fdd..595fd62 100644
--- a/sysmoOCTSIM/gcc/Makefile
+++ b/sysmoOCTSIM/gcc/Makefile
@@ -153,7 +153,13 @@
 vpath %.S ../

 # All Target
-all: $(SUB_DIRS) $(OUTPUT_FILE_PATH) sysmoOCTSIM.elf sysmoOCTSIM.bin
+all: $(SUB_DIRS) elf bin ihex eep lss
+
+elf: $(OUTPUT_FILE_NAME).elf sysmoOCTSIM.elf
+bin: $(OUTPUT_FILE_NAME).bin sysmoOCTSIM.bin
+ihex: $(OUTPUT_FILE_NAME).ihex
+eep: $(OUTPUT_FILE_NAME).eep
+lss: $(OUTPUT_FILE_NAME).lss

 # Linker target

@@ -167,13 +173,18 @@
 -L"../gcc/gcc"
        @echo Finished building target: $@

-       $(OBJCOPY) -O binary "$(OUTPUT_FILE_NAME).elf" "$(OUTPUT_FILE_NAME).bin"
-       $(OBJCOPY) -O ihex -R .eeprom -R .fuse -R .lock -R .signature  \
-               "$(OUTPUT_FILE_NAME).elf" "$(OUTPUT_FILE_NAME).hex"
+%.bin: %.elf
+       $(OBJCOPY) -O binary $< $@
+
+%.ihex: %.elf
+       $(OBJCOPY) -O ihex -R .eeprom -R .fuse -R .lock -R .signature $< $@
+
+%.eep: %.elf
        $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom=alloc,load 
--change-section-lma \
-               .eeprom=0 --no-change-warnings -O binary 
"$(OUTPUT_FILE_NAME).elf" \
-               "$(OUTPUT_FILE_NAME).eep" || exit 0
-       $(OBJDUMP) -h -S "$(OUTPUT_FILE_NAME).elf" > "$(OUTPUT_FILE_NAME).lss"
+               .eeprom=0 --no-change-warnings -O binary $< $@ || exit 0
+
+%.lss: %.elf
+       $(OBJDUMP) -h -S $< > $@
        $(SIZE) "$(OUTPUT_FILE_NAME).elf"

 sysmoOCTSIM.elf: $(OUTPUT_FILE_PATH)

--
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/16056
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: Ie83722a9b61cfcd9865950ab4c088f59a15427ba
Gerrit-Change-Number: 16056
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: Hoernchen <ew...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-MessageType: merged

Reply via email to