summaryrefslogtreecommitdiff
path: root/demo/GNUmakefile
diff options
context:
space:
mode:
Diffstat (limited to 'demo/GNUmakefile')
-rw-r--r--demo/GNUmakefile45
1 files changed, 45 insertions, 0 deletions
diff --git a/demo/GNUmakefile b/demo/GNUmakefile
new file mode 100644
index 0000000..474f957
--- /dev/null
+++ b/demo/GNUmakefile
@@ -0,0 +1,45 @@
+# Copyright 2022 Gabriel Jensen.
+# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
+# If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
+
+# TOOLS
+
+AS := arm-none-eabi-as
+CC := clang -target arm-none-eabi
+#CC := arm-none-eabi-gcc
+LD := arm-none-eabi-ld
+OBJCOPY := arm-none-eabi-objcopy
+
+# TOOL FLAGS
+
+CFLAGS := \
+ -I../agbx/include \
+ -O3 \
+ -mcpu=arm7tdmi \
+ -nostdlib \
+ -std=c2x
+
+# BINARIES
+
+OBJS := \
+ demo.o
+
+ROMHDR := hdr.o
+
+BIN := demo.gba
+
+# TARGETS
+
+.PHONY: clean purge
+
+$(BIN): $(ROMHDR) $(OBJS)
+ $(LD) -L../agbx -Tldscript -odemo.elf -znoexecstack $(^) -lagbx
+ $(OBJCOPY) -Obinary demo.elf $(@)
+ agbsum -psi$(@)
+
+clean:
+ $(RM) $(OBJS) $(ROMHDR) demo.elf
+
+purge: clean
+ $(RM) $(BIN)
+