-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
59 lines (43 loc) · 1.64 KB
/
Makefile
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
export PATH := $(DEVKITARM)/bin:$(PATH)
CC=arm-none-eabi-gcc
CP=arm-none-eabi-g++
OC=arm-none-eabi-objcopy
LD=arm-none-eabi-ld
AM=armips
CFLAGS=-std=gnu11 -Os -g -mword-relocations -fomit-frame-pointer -ffast-math -fshort-wchar -Wall -Wextra -Wpedantic -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused
C9FLAGS=-mcpu=arm946e-s -march=armv5te -mlittle-endian
C11FLAGS=-mcpu=mpcore -mlittle-endian
LDFLAGS=
OCFLAGS=--set-section-flags .bss=alloc,load,contents
OUT_DIR=obj/arm11 bin
ARM11_OBJS=$(patsubst %.c, obj/%.o, $(wildcard arm11/*.c))
ARM11_OBJS+=$(patsubst %.s, obj/%.o, $(wildcard arm11/*.s))
ARM11_OBJS+=$(patsubst %.S, obj/%.o, $(wildcard arm11/*.S))
.PHONY: clean
all: bin/arm11.bin
bin/arm11.bin: $(ARM11_OBJS) | dirs
$(LD) -T arm11.ld $(ARM11_OBJS) $(LDFLAGS) -o [email protected]
$(OC) $(OCFLAGS) -O binary [email protected] $@
obj/%.11.o: %.11.c | dirs
@echo Compiling $<
$(CC) -c $(CFLAGS) $(C11FLAGS) $< -o $@
obj/%.11.o: %.11.s | dirs
@echo Compiling $<
$(CC) -c $(CFLAGS) $(C11FLAGS) -fno-toplevel-reorder $< -o $@
obj/%.11.o: %.11.S | dirs
@echo Compiling $<
$(CC) -c $(CFLAGS) $(C11FLAGS) -fno-toplevel-reorder $< -o $@
obj/%.o: %.c | dirs
@echo Compiling $<
$(CC) -c $(CFLAGS) $(C9FLAGS) $< -o $@
obj/%.o: %.s | dirs
@echo Compiling $<
$(CC) -c $(CFLAGS) $(C9FLAGS) $< -o $@
obj/%.o: %.S | dirs
@echo Compiling $<
$(CC) -c $(CFLAGS) $(C9FLAGS) $< -o $@
dirs: ${OUT_DIR}
${OUT_DIR}:
mkdir -p ${OUT_DIR}
clean:
rm -rf bin/*.elf bin/*.bin obj/*