ps2rom/build/targets/ee.mk

42 lines
947 B
Makefile
Raw Normal View History

# common EE toolchain stuff
# EE toolchain root.
EE_TRIPLET=mips64r5900el-ps2-elf
CC=$(EE_TRIPLET)-gcc
AS=$(CC)
CXX=$(EE_TRIPLET)-g++
# we need to use this to link, because
# we target the 32bit ABI, which the
# EE linker really doesn't like.
# It seems like a hack, probably because it is.
LD=mipsel-ps2-irx-gcc
AR=$(EE_TRIPLET)-ar
OBJCOPY=$(EE_TRIPLET)-objcopy
ifeq ($(CONFIG),release)
CFLAGS := $(CFLAGS) -mabi=32 -G0 -O3 -Wall -Wextra -Werror -fno-common -fno-strict-aliasing
ASFLAGS := -mabi=32 -xassembler-with-cpp $(ASFLAGS)
LDFLAGS := -s $(LDFLAGS)
endif
ifeq ($(CONFIG),debug)
CFLAGS := $(CFLAGS) -mabi=32 -G0 -O0 -g3 -Wall -Wextra -fno-common -fno-strict-aliasing
ASFLAGS := -mabi=32 -xassembler-with-cpp -g3 $(ASFLAGS)
endif
CXXFLAGS := $(CXXFLAGS) $(CFLAGS)
# compile rules
$(OBJDIR)/%.o: %.c
$(CC) -c $(CFLAGS) $< -o $@
$(OBJDIR)/%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@
$(OBJDIR)/%.o: %.s
$(AS) -c $(ASFLAGS) $< -o $@