summaryrefslogtreecommitdiff
path: root/agbx/GNUmakefile
blob: fb83fa5e60aa2643862a4af04cc00ca5382f2952 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# 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/.

ifneq ($(DEBUG),)
ifneq ($(DEBUG),false)
ifneq ($(DEBUG),true)
$(error Invalid value \"$(DEBUG)\" for DEBUG)
endif
endif
endif

# TOOLS

AS      := arm-none-eabi-as
CC      := clang -target arm-none-eabi
#CC      := arm-none-eabi-gcc
OBJCOPY := arm-none-eabi-objcopy

# TOOL FLAGS

CFLAGS := \
	-Iinclude \
	-Iinclude-private \
	-Ofast \
	-Wall \
	-Wextra \
	-Wpedantic \
	-ffreestanding \
	-fno-builtin \
	-fno-strict-aliasing \
	-mcpu=arm7tdmi \
	-mthumb \
	-mtune=arm7tdmi \
	-nostdlib \
	--std=c2x

ifeq ($(DEBUG),true)
CFLAGS := \
	$(CFLAGS) \
	-D__agbx_dbg
endif

# HEADERS

HDRS := \
	include/agbx/bs.h \
	include/agbx/gfx.h \
	include-private/agbx/priv.h

# BINARIES

OBJS := \
	source/bs/done.o \
	source/bs/get.o \
	source/bs/set.o \
	source/gfx/flip.o \
	source/gfx/plot.o \
	source/gfx/setpx.o \
	source/key/getkeymap.o \
	source/priv/init.o

LIB := libagbx.a

# TARGETS

.PHONY: clean purge

$(LIB): $(OBJS)
	$(AR) r $(@) $(^)

$(OBJS): $(HDRS)

clean:
	$(RM) $(OBJS)

purge: clean
	$(RM) $(LIB)