#
# Basic KallistiOS skeleton / test program
# Copyright (C)2001-2004 Dan Potter
#   

PROJECT_ROOT = ../..
TARGET = ambition

# If you define this, the Makefile.rules will create a romdisk.o for you
# from the named dir.
KOS_ROMDISK_DIR = $(PROJECT_ROOT)/assets/ggj18/final/shared

OBJS = \
	$(PROJECT_ROOT)/src/main.o \
	$(PROJECT_ROOT)/src/engine/platform/abstract.o \
	$(PROJECT_ROOT)/src/engine/platform/dreamcast/dreamcast.o \
	$(PROJECT_ROOT)/src/engine/animation.o \
	$(PROJECT_ROOT)/src/game/ggj18/ggj18.o \
	$(PROJECT_ROOT)/src/game/ggj18/entities/static_mesh.o \
	$(PROJECT_ROOT)/src/game/ggj18/entities/skeletal_mesh.o \
	$(PROJECT_ROOT)/src/game/ggj18/entities/camera.o \
	$(PROJECT_ROOT)/src/game/ggj18/entities/planet.o \
	$(PROJECT_ROOT)/src/game/ggj18/entities/starfield.o \
	$(PROJECT_ROOT)/src/game/ggj18/entities/ship.o \
	$(PROJECT_ROOT)/src/game/ggj18/entities/straight_shot.o \
	$(PROJECT_ROOT)/src/engine/math_types.o \
	$(PROJECT_ROOT)/src/engine/joint.o \
	$(PROJECT_ROOT)/src/engine/mesh.o \
	$(PROJECT_ROOT)/src/engine/skeleton.o \
	romdisk.o

# The rm-elf step is to remove the target before building, to force the
# re-creation of the rom disk.
all: rm-elf $(TARGET)

# Flags specifically for C++
CXXFLAGS =-O3 -std=c++11 -I$(PROJECT_ROOT)/src/engine -Wfatal-errors

include $(KOS_BASE)/Makefile.rules

clean:
	-rm -rf $(TARGET).elf $(TARGET).bin selfboot $(OBJS) romdisk.img

rm-elf:
	-rm -f $(TARGET)

$(TARGET): $(OBJS)
	kos-c++ $(CXXFLAGS) -o $(TARGET).elf $(OBJS) -lpng -lz  -loggvorbisplay -lvorbis -logg -lm
	$(KOS_STRIP) $(TARGET).elf
	sh-elf-objcopy -O binary $(TARGET).elf $(TARGET).bin
	mkdir -p selfboot
	/opt/toolchains/dc/kos/utils/scramble/scramble $(TARGET).bin selfboot/1ST_READ.BIN

run: $(TARGET).elf
	arp -s 10.0.0.2 00:d0:f1:03:08:97
	dc-tool -t 10.0.0.2 -x $(TARGET).elf

