Skip to content

Instantly share code, notes, and snippets.

@WillSams

WillSams/Makefile

Created Apr 17, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.