Set tval to 0 on traps with no specified tval
[riscv-isa-sim.git] / debug_rom / Makefile
index 9d286c9dc74b61c36e3671cc66de6c6c048dd7b5..0a67ba102623b9861ea713ef973a447a4a3cebce 100644 (file)
@@ -4,17 +4,21 @@
 CC = $(RISCV)/bin/riscv64-unknown-elf-gcc
 OBJCOPY = $(RISCV)/bin/riscv64-unknown-elf-objcopy
 
-%.o:   %.S
-       $(CC) -I.. -c $<
+COMPILE = $(CC) -nostdlib -nostartfiles -I.. -Tlink.ld
 
-debug_rom.h:   debug_rom.raw
+ELFS = debug_rom
+DEPS = debug_rom.S link.ld debug_rom_defines.h
+
+all: $(patsubst %,%.h,$(ELFS))
+
+%.h:   %.raw
        xxd -i $^ | sed "s/^unsigned/static const unsigned/" > $@
 
-debug_rom.raw: debug_rom
-       $(OBJCOPY) -O binary --only-section .text debug_rom debug_rom.raw
+%.raw: %
+       $(OBJCOPY) -O binary --only-section .text $^ $@
 
-debug_rom:     debug_rom.o
-       $(CC) -nostdlib -nostartfiles -Tlink.ld -o $@ $^
+debug_rom:     $(DEPS)
+       $(COMPILE) -o $@ $^
 
 clean:
-       rm -f debug_rom debug_rom.o debug_rom.raw debug_rom.h
+       rm -f $(ELFS) debug_rom*.raw debug_rom.h