-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmakefile
88 lines (77 loc) · 1.8 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
CART_OBJ := \
cart/cartinit.o \
cart/cartexit.o \
cart/cartcardinit.o \
cart/cartcardrddram.o \
cart/cartcardrdcart.o \
cart/cartcardwrdram.o \
cart/cartcardwrcart.o
CI_OBJ := \
ci/ci.o \
ci/ciinit.o \
ci/ciexit.o \
ci/cicardinit.o \
ci/cicardrddram.o \
ci/cicardrdcart.o \
ci/cicardwrdram.o \
ci/cicardwrcart.o
EDX_OBJ := \
edx/edxinit.o \
edx/edxexit.o \
edx/edxcard.o \
edx/edxcardinit.o \
edx/edxcardrddram.o \
edx/edxcardrdcart.o \
edx/edxcardwrdram.o \
edx/edxcardwrcart.o
ED_OBJ := \
ed/edinit.o \
ed/edexit.o \
ed/edcard.o \
ed/edcardinit.o \
ed/edcardrddram.o \
ed/edcardrdcart.o \
ed/edcardwrdram.o \
ed/edcardwrcart.o
SC_OBJ := \
sc/sc.o \
sc/scinit.o \
sc/scexit.o \
sc/sccardinit.o \
sc/sccardrddram.o \
sc/sccardrdcart.o \
sc/sccardwrdram.o \
sc/sccardwrcart.o
OBJ := \
cart.o \
cartbuf.o \
sd.o \
sdcrc16.o \
$(CART_OBJ) \
$(CI_OBJ) \
$(EDX_OBJ) \
$(ED_OBJ) \
$(SC_OBJ)
U64_PREFIX := mips-linux-gnu-
U64_CC := $(U64_PREFIX)gcc
U64_AR := $(U64_PREFIX)ar
U64_ARCH := -mabi=32 -march=vr4300 -mfix4300
U64_OPT := -Os
U64_WARN := -Wall -Wextra -Wpedantic -Werror=implicit-function-declaration
U64_CPPFLAGS = -Ilibultra/include -Iinclude -Isrc -D_ULTRA64
U64_CFLAGS = $(U64_ARCH) -mno-abicalls -fno-PIC -mno-check-zero-division -fno-builtin -ffast-math -ftrapping-math -fno-associative-math -fsingle-precision-constant -G 0 $(U64_OPT) $(U64_WARN)
U64_ASFLAGS = $(U64_ARCH) -mno-abicalls -fno-PIC -G 0 $(U64_FLAG) $(U64_OPT)
.PHONY: default
default: lib/libcart.a
.PHONY: clean
clean:
rm -f -r build lib
lib/libcart.a: $(addprefix build/,$(OBJ))
@mkdir -p $(dir $@)
$(U64_AR) rc $@ $^
build/%.o: src/%.s
@mkdir -p $(dir $@)
$(U64_CC) $(U64_ASFLAGS) -c -o $@ $<
build/%.o: src/%.c
@mkdir -p $(dir $@)
$(U64_CC) $(U64_CPPFLAGS) $(U64_CFLAGS) -c -o $@ $<