#  *** YatLike GBA ***
# Franois PESSAUX november 2005
# This program is freeware.
# Use its sources as you whant provided that you leave this copyright unchanged
# and that you drop a small word telling that I'm the author of these sources.
# Thank's a lot.
#   --Francois


# Makefile pour utiliser avec devKitARM.
CROSS = /usr/local/devkitARM_r6/bin/arm-elf-
ARCH = -mthumb -mthumb-interwork
# gba_mb.specs pour le multiboot
SPECS = -specs=gba.specs
CFLAGS	= -I.. \
	 -Wall -fno-common \
	-mcpu=arm7tdmi -mtune=arm7tdmi \
	-fomit-frame-pointer\
	-ffast-math \
	$(ARCH) $(SPECS)


GCC = $(CROSS)gcc
AS = $(CROSS)as
OBJCOPY = $(CROSS)objcopy
LD = $(CROSS)ld

# Uncomment to compile under Windows with devkit installed with Cygwin.
# LIBPREFIX = "C:\Cygwin"

MAP = map.out
LIBS = $(LIBPREFIX)/usr/local/devkitARM_r6/arm-elf/lib/interwork/libc.a \
	$(LIBPREFIX)/usr/local/devkitARM_r6/lib/gcc/arm-elf/3.4.0/interwork/libgcc.a
LDFLAGS = -marmelf -Map $(MAP) -nostartfiles -Tlnkscript

CFILES = \
	intrs.c \
	load_gfx_data.c \
	ihm.c \
	game_bg_gfx.c \
	game_shapes_gfx.c \
	shape_sprite_gfx.c \
	large_fonts_gfx.c \
	pause_gfx.c \
	cursor_sprite_gfx.c \
	menu_gfx.c \
	menu_flags_gfx.c \
	intro_gfx.c \
	shapes_configurations.c \
	key_control.c \
	ending_gfx.c \
	ending.c \
	starter.c \
	intro.c \
	game.c \
	pause.c \
	persistent.c \
	scoring.c \
	highscores_quiet_gfx.c \
	highscores_quiet_fonts_gfx.c \
	highscores_standard_gfx.c \
	highscores_standard_fonts_gfx.c \
	highscores_arcade_gfx.c \
	highscores_arcade_fonts_gfx.c \
	highscores_chrono1_gfx.c \
	highscores_chrono1_fonts_gfx.c\
	highscores_chrono5_gfx.c \
	highscores_chrono5_fonts_gfx.c\
	highscores_chrono10_gfx.c \
	highscores_chrono10_fonts_gfx.c \
	wav_deny_shape.c \
	wav_place_shape.c \
	wav_throw_shape.c \
	wav_time_warning.c \
	main.c
OBJS = $(CFILES:.c=.o)

.SUFFIXES:
.SUFFIXES: .c .o

all: yatlike.bin


crt0.o: crt0.S
	$(AS) -o $@ $<


# ELF to GBA conversion.
yatlike.bin: yatlike.elf
	$(OBJCOPY) -O binary yatlike.elf $@

# Final link.
yatlike.elf: crt0.o $(OBJS)
	$(LD) $(LDFLAGS) -o $@ crt0.o $(OBJS) $(LIBS)


.c.o:
	$(GCC) $(CFLAGS) -O3 -c $<


clean:
	rm -f yatlike.elf yatlike.bin $(OBJS) crt0.o map.out *~

