
CCBASE=/usr/local/devkitadv
CC = $(CCBASE)/bin/arm-agb-elf-gcc
CXX = $(CCBASE)/bin/arm-agb-elf-g++
LD = $(CCBASE)/bin/arm-agb-elf-gcc
AS = $(CCBASE)/bin/arm-agb-elf-as
AR = $(CCBASE)/bin/arm-agb-elf-ar
OBJCOPY = $(CCBASE)/bin/arm-agb-elf-objcopy

INCLUDES = -I. -I.. -Ilibpogo

#CFLAGS = $(INCLUDES) -DGP32 -O2 -fno-builtin -ffreestanding -fno-exceptions -mcpu=arm9tdmi -mtune=arm9tdmi -nostdinc -finline-functions
#CPPFLAGS = $(INCLUDES) -DGP32 -O2 -fno-builtin -ffreestanding -fno-exceptions -mcpu=arm9tdmi -mtune=arm9tdmi -nostdinc -finline-functions
CFLAGS = $(INCLUDES) -DGP32 -O3 -fno-builtin -ffreestanding -fno-exceptions -mcpu=arm9tdmi -mtune=arm9tdmi -nostdinc
CPPFLAGS = $(INCLUDES) -DGP32 -O3 -fno-builtin -ffreestanding -fno-exceptions -mcpu=arm9tdmi -mtune=arm9tdmi -nostdinc

%.o: %.c
	$(CC) $(CFLAGS) -c $<

%.o: %.cpp
	$(CXX) $(CPPFLAGS) -c $<

%.gxb: %.elf
	$(OBJCOPY) -v -O binary $< $@

%.o: %.s
	$(AS) -o $@ $<
 
%.fxe: %.gxb
	$(CCBASE)/bin/b2fxe $< $@


all: gpmisc.o input.o ui.o menu.o xlatgp32.o

clean:
	rm -f *.o *.a

