2023-11-11 22:42:07 +00:00
|
|
|
TARGET = patches.elf
|
|
|
|
|
2024-06-03 08:05:31 +00:00
|
|
|
CC ?= clang
|
|
|
|
LD ?= ld.lld
|
|
|
|
OBJCOPY ?= llvm-objcopy
|
2023-11-11 22:42:07 +00:00
|
|
|
|
2024-03-25 03:06:41 +00:00
|
|
|
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
|
2024-05-18 02:23:48 +00:00
|
|
|
LDFLAGS := -nostdlib -T patches.ld -T syms.ld --just-symbols=../mm.us.rev1.rom_uncompressed.elf --allow-multiple-definition -Map patches.map
|
2024-03-21 02:16:51 +00:00
|
|
|
BINFLAGS := -O binary --remove-section=.bss --remove-section=.pad --remove-section=.text
|
2023-11-11 22:42:07 +00:00
|
|
|
|
|
|
|
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
|
2023-11-28 04:39:18 +00:00
|
|
|
$(LD) $(C_OBJS) $(LDFLAGS) -o $@
|
2023-11-11 22:42:07 +00:00
|
|
|
|
|
|
|
$(C_OBJS): %.o : %.c
|
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) $< -MMD -MF $(@:.o=.d) -c -o $@
|
|
|
|
|
|
|
|
clean:
|
2024-06-04 23:12:43 +00:00
|
|
|
rm -rf $(C_OBJS) $(TARGET) $(DATABIN) $(C_DEPS)
|
2023-11-11 22:42:07 +00:00
|
|
|
|
|
|
|
-include $(C_DEPS)
|
|
|
|
|
|
|
|
.PHONY: clean
|