diff --git a/Makefile b/Makefile index 3b44e25..161a559 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,15 @@ +# Git Submodules +SUBMODULES = \ + gbit + +GIT_SUBMODULES := $(shell git submodule update --init $(SUBMODULES)) +GBIT_OBJS = \ + gbit/lib/tester.o \ + gbit/lib/ref_cpu.o \ + gbit/lib/inputstate.o \ + gbit/lib/disassembler.o + +# Flags CFLAGS = -std=gnu99 -O2 -Wall -Wextra LDFLAGS = -lm @@ -50,9 +62,9 @@ $(OUT)/cpu_instrs.h: tests/cpu_instrs.gb tests/rom2h.c $(Q)$(CC) -o $(OUT)/rom2h tests/rom2h.c @$(OUT)/rom2h -$(OUT)/bench: $(OUT)/cpu_instrs.h prof.h cpu.c bench.c gameboy.h +$(OUT)/bench: $(GBIT_OBJS) $(OUT)/cpu_instrs.h prof.h cpu.c bench.c gameboy.h $(VECHO) " CC+LD\t$@\n" - $(Q)$(CC) -DENABLE_LCD=0 -o $@ cpu.c bench.c + $(Q)$(CC) -DENABLE_LCD=0 -DGBIT -o $@ cpu.c bench.c $(GBIT_OBJS) # Download Game Boy ROMs with full source download_rom: @@ -64,7 +76,7 @@ download_rom: wget -O roms/Frapball.gb https://github.com/1r3n33/frapball/releases/download/refs%2Fheads%2Fmaster/game.gb clean: - $(RM) $(BIN) $(OBJS) $(deps) + $(RM) $(BIN) $(OBJS) $(GBIT_OBJS) $(deps) distclean: clean $(RM) prof.h $(RM) -r roms