-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (33 loc) · 1006 Bytes
/
Makefile
File metadata and controls
49 lines (33 loc) · 1006 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
37
38
39
40
41
42
43
44
45
46
47
48
PATH := $(DEVKITARM)/bin:$(PATH)
# --- Project details -------------------------------------------------
PROJ := main
TARGET := $(PROJ)
OBJS := $(PROJ).o
# --- Build defines ---------------------------------------------------
PREFIX := arm-none-eabi-
CC := $(PREFIX)gcc
LD := $(PREFIX)gcc
OBJCOPY := $(PREFIX)objcopy
ARCH := -mthumb-interwork -mthumb
SPECS := -specs=gba.specs
CFLAGS := $(ARCH) -O2 -Wall -fno-strict-aliasing
LDFLAGS := $(ARCH) $(SPECS)
.PHONY : build clean
# --- Build -----------------------------------------------------------
# Build process starts here!
build: $(TARGET).gba
# Strip and fix header (step 3,4)
$(TARGET).gba : $(TARGET).elf
$(OBJCOPY) -v -O binary $< $@
-@gbafix $@
# Link (step 2)
$(TARGET).elf : $(OBJS)
$(LD) $^ $(LDFLAGS) -o $@
# Compile (step 1)
$(OBJS) : %.o : %.c
$(CC) -c $< $(CFLAGS) -o $@
# --- Clean -----------------------------------------------------------
clean :
@rm -fv *.gba
@rm -fv *.elf
@rm -fv *.o