28 lines
596 B
Makefile
28 lines
596 B
Makefile
|
|
AS := rl78-elf-gcc
|
|
LD := rl78-elf-gcc
|
|
OBJCOPY := rl78-elf-objcopy
|
|
|
|
all: test-rom.srec test-dbg.srec test-rom.bin test-dbg.bin
|
|
|
|
test.S.o: test.S hw.S
|
|
$(AS) -c -o "$@" "$<"
|
|
romhdr.S.o: romhdr.S
|
|
$(AS) -c -o "$@" "$<"
|
|
|
|
OBJFILES := test.S.o romhdr.S.o
|
|
|
|
test-%.elf test-%.elf.map: $(OBJFILES) link-%.ld
|
|
$(LD) -o "$@" $(OBJFILES) -T link-$*.ld -Wl,-Map="$@.map" -nostdlib -nostartfiles
|
|
|
|
test-%.bin: test-%.elf
|
|
$(OBJCOPY) -O binary "$<" "$@"
|
|
|
|
%.srec: %.elf
|
|
$(OBJCOPY) -O srec "$<" "$@"
|
|
|
|
clean:
|
|
@$(RM) -v test-*.bin test-*.bin.h test-*.elf test-*.elf.map test.S.o
|
|
.KEEP: test-rom.elf test-dbg.elf
|
|
|