Zelda64Recomp/patches/Makefile

35 lines
1.2 KiB
Makefile
Raw Normal View History

TARGET = patches.elf
2024-06-16 19:38:23 +00:00
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 -Map patches.map --unresolved-symbols=ignore-all --emit-relocs
BINFLAGS := -O binary --only-section=.ctors --only-section=.dtors --only-section=.rodata --only-section=.data
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:
2024-06-04 23:12:43 +00:00
rm -rf $(C_OBJS) $(TARGET) $(DATABIN) $(C_DEPS)
-include $(C_DEPS)
.PHONY: clean