aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 27 insertions, 0 deletions
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)