forked from Zelda64Recomp/Zelda64Recomp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
34 lines (24 loc) · 1.21 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
TARGET = patches.elf
CC := clang
LD := ld.lld
OBJCOPY := llvm-objcopy
CFLAGS := -target mips -mips2 -mabi=32 -O2 -G0 -mno-abicalls -mno-odd-spreg -mno-check-zero-division \
-fomit-frame-pointer -ffast-math -fno-unsafe-math-optimizations -fno-builtin-memset \
-Wall -Wextra -Wno-incompatible-library-redeclaration -Wno-unused-parameter -Wno-unknown-pragmas -Wno-unused-variable -Wno-missing-braces -Wno-unsupported-floating-point-opt
CPPFLAGS := -nostdinc -D_LANGUAGE_C -DMIPS -I dummy_headers -I ../lib/mm-decomp/include -I ../lib/mm-decomp/src -I ../lib/mm-decomp/assets -I../lib/rt64/include
LDFLAGS := -nostdlib -T patches.ld -T syms.ld --just-symbols=../mm.us.rev1.elf --allow-multiple-definition -Map patches.map
BINFLAGS := -O binary --remove-section=.bss --remove-section=.pad --remove-section=.text
C_SRCS := $(wildcard *.c)
C_OBJS := $(C_SRCS:.c=.o)
C_DEPS := $(C_SRCS:.c=.d)
DATABIN := $(TARGET:.elf=.bin)
$(DATABIN): $(TARGET)
$(OBJCOPY) $(BINFLAGS) $(TARGET) $@
$(TARGET): $(C_OBJS) patches.ld syms.ld
$(LD) $(C_OBJS) $(LDFLAGS) -o $@
$(C_OBJS): %.o : %.c
$(CC) $(CFLAGS) $(CPPFLAGS) $< -MMD -MF $(@:.o=.d) -c -o $@
clean:
rm -rf $(C_OBJS) $(TARGET) $(DATABIN)
-include $(C_DEPS)
.PHONY: clean