Skip to content

Instantly share code, notes, and snippets.

@WillSams
Created April 17, 2020 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WillSams/2e4ff8ffa9da4f7e92c8a6384ba10d45 to your computer and use it in GitHub Desktop.
Save WillSams/2e4ff8ffa9da4f7e92c8a6384ba10d45 to your computer and use it in GitHub Desktop.
Sonic 1 Disassembly Makefile
# This is a makefile for Andy Grind's Sonic 1 disassebly fork (https://github.com/andwn/s1disasm)
# and works with the Linux/Windows toolchain creaed from my script:that works with my toolchain.
# Script for my Linux toolchain -> https://gist.github.com/WillSams/c4cbf6235b467d8b595693969342237e
# Script for my Windows toolchain -> https://gist.github.com/WillSams/f592f9d494b51119945440f7e91079b0
GENDEV=/opt/m68k
AS = $(GENDEV)/bin/m68k-elf-as
LD = $(GENDEV)/bin/m68k-elf-ld
READELF = $(GENDEV)/bin/m68k-elf-readelf
OBJDUMP = $(GENDEV)/bin/m68k-elf-objdump
DEBUGGER = $(GENDEV)/tools/blastem/blastem
ASFLAGS = -m68000 --register-prefix-optional --bitwise-or
LDFLAGS = md.ld -nostdlib
OBJS = sonic.o
ROM = sonic1
BIN = $(ROM).bin
all: $(BIN) symbols dump
clean:
rm -rf $(BIN) $(shell find . -name '*.o') && rm -r $(ROM).dump symbols.txt || true
$(BIN): $(OBJS)
$(LD) $(LDFLAGS) $< --oformat binary -o $@
%.o: %.asm
@echo "AS $<"
@$(AS) $(ASFLAGS) $< -o $@
symbols: $(OBJS)
$(READELF) --symbols $< > symbols.txt
dump:
$(OBJDUMP) --disassemble-all --target=binary --architecture=m68k \
--start-address=0x0000 $(BIN) > $(ROM).dump
run:
$(DEBUGGER) $(BIN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment