-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (26 loc) · 816 Bytes
/
Copy pathMakefile
File metadata and controls
36 lines (26 loc) · 816 Bytes
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
export DEVKITPRO ?= /opt/devkitpro
export DEVKITARM ?= $(DEVKITPRO)/devkitARM
PREFIX := arm-none-eabi-
CC := $(PREFIX)gcc
LD := $(PREFIX)gcc
OBJCOPY := $(PREFIX)objcopy
CFLAGS := -mthumb -mthumb-interwork -O2 -Wall -Wextra -ffast-math -fno-builtin -mcpu=arm7tdmi -mtune=arm7tdmi
LDFLAGS := -specs=gba.specs -mthumb-interwork -Wl,-Map,build/output.map
INCLUDES := -I.
BUILD := build
TARGET := false_diagonal_test
SOURCES := main.c
OBJS := $(addprefix $(BUILD)/, $(SOURCES:.c=.o))
all: $(TARGET).gba
$(BUILD):
@mkdir -p $(BUILD)
$(BUILD)/%.o: %.c | $(BUILD)
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
$(TARGET).elf: $(OBJS)
$(LD) $(OBJS) $(LDFLAGS) -o $@
$(TARGET).gba: $(TARGET).elf
$(OBJCOPY) -O binary $< $@
@echo "Built $(TARGET).gba"
clean:
@rm -rf $(BUILD) *.elf *.gba *.map *.sav
.PHONY: all clean