summaryrefslogtreecommitdiff
path: root/demo/GNUmakefile
blob: 18d30839cccdcfe268c50ff03c86d7dba31e8816 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 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 \
	-Wall \
	-Wextra \
	-Wpedantic \
	-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)