+ rm -f *.o *.elf *.s19 *.b *.a rom.tar.bz2 romsrc.s crctab.h m68hc11-gdb gencrctab
+
+#
+# Some useful rules
+#
+dump: rom2.elf
+ $(OBJDUMP) -d $<
+
+size: rom2.s19
+ $(SIZE) $<
+
+rom.tar.bz2:
+ rm -f romsrc.s crctab.h
+ tar cjf rom.tar.bz2 README Makefile gdbsimrc *.pl *.c *.h *.s *.x
+
+romsrc.s: rom.tar.bz2 src2asm.pl
+ perl -w src2asm.pl < $< > $@
+
+xmodem.c: crctab.h
+
+gencrctab: gencrctab.c
+ gcc -o $@ $<
+
+crctab.h: gencrctab
+ ./gencrctab > $@
+
+#
+# Implicit rules
+#
+# .elf is for the simulator and gdb
+# .s19 is for some downloader and the simulator
+# .b is a binary dump
+#
+.SUFFIXES: .elf .s19 .b
+
+.elf.s19:
+ $(OBJCOPY) --output-target=srec $(OBJCOPY_FLAGS) $< $*.s19
+
+.elf.b:
+ $(OBJCOPY) --output-target=binary --gap-fill=255 \
+ $(OBJCOPY_FLAGS) $< $*.b
+ @perl -e '$$sum = 0;while(read STDIN, $$a, 1){$$sum += ord($$a); $$sum = $$sum&0xffff;} printf "Checksum is \%x\n", $$sum' < $@
+
+m68hc11-gdb: /usr/bin/m68hc11-gdb
+ sed -e 's|m68hc11eepr/reg 0xb000 512|m68hc11eepr/reg 0x4000 1 |' < $< > $@
+ chmod 755 $@
+
+sim: m68hc11-gdb rom2.elf
+ ./m68hc11-gdb -x gdbsimrc rom2.elf