diff options
author | Harald Welte <laforge@osmocom.org> | 2019-11-12 22:16:02 +0100 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2019-11-13 16:34:10 +0000 |
commit | f9a979a5f8d7fbd4b56accba269ff212b59d3af8 (patch) | |
tree | 2dade58343ad6c4d026f0f4cc448e83dce3ab18a | |
parent | 29d8db6d820dfdf3cfaeb217609e70b37162f509 (diff) |
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
-rw-r--r-- | sysmoOCTSIM/gcc/Makefile | 25 |
1 files changed, 18 insertions, 7 deletions
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 ../ 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 @@ $(OUTPUT_FILE_PATH): $(OBJS) -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) |