From 0d0f4f1d23851c0c34e518834f7d316e61dec1f3 Mon Sep 17 00:00:00 2001 From: gbc dev Date: Sat, 4 Jul 2026 22:05:31 +0200 Subject: scaffolding: build system, cartridge loader with MBC1/2/3/5, core types --- Makefile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0d79c1f --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ +CC := gcc +CFLAGS := -std=c11 -O2 -Wall -Wextra -Wno-unused-parameter -g +LDFLAGS := +SRCDIR := src +BUILD := build +SRCS := $(wildcard $(SRCDIR)/*.c) +OBJS := $(patsubst $(SRCDIR)/%.c,$(BUILD)/%.o,$(SRCS)) +BIN := $(BUILD)/gbc + +.PHONY: all clean run + +all: $(BIN) + +$(BIN): $(OBJS) + $(CC) $(CFLAGS) $(OBJS) -o $@ $(LDFLAGS) + +$(BUILD)/%.o: $(SRCDIR)/%.c | $(BUILD) + $(CC) $(CFLAGS) -c $< -o $@ + +$(BUILD): + mkdir -p $(BUILD) + +clean: + rm -rf $(BUILD) + +run: $(BIN) + $(BIN) $(ROM) -- cgit v1.3.1-sl0p