MAKE = make
CC   = gcc -mcrt=newlib
CXX  = g++ -mcrt=newlib
CP	 = copy
RM   = delete

# Change these as required
OPTIMIZE = -O3
DEBUG = 
CFLAGS = $(OPTIMIZE) $(DEBUG) -Iinclude -Is98 #-DDEBUG
CXXFLAGS = $(CFLAGS)

# Flags passed to gcc during linking
LINK = $(OPTIMIZE) $(DEBUG)

# Additional linker libraries
LIBS = -lz

# Name of the "thing" to build
TARGET  = TN_S98.tnplug
VERSION = 1

# Source code files used in this project
# Add any additional files to this line

OBJS = init.o initplayer.o announceplayer.o openplayer.o \
	decodeframeplayer.o donotify.o s98/m_s98.o \
	s98/device/s98fmgen.o s98/device/fmgen/fmgen.o s98/device/fmgen/fmtimer.o \
	s98/device/fmgen/opm.o s98/device/fmgen/opna.o s98/device/fmgen/psg.o \
	s98/device/fmgen/file.o \
	s98/device/s98sng.o s98/device/s_sng.o s98/device/s_logtbl.o \
	s98/device/s98opll.o s98/device/emu2413/emu2413.o

# -------------------------------------------------------------
# Nothing should need changing below this line

# Rules for building
$(TARGET): $(OBJS)
	$(CXX) $(LINK) -nostartfiles -o $@ $^ $(LIBS)

init.o announceplayer.o: $(TARGET)_rev.h

.PHONY: install
install: $(TARGET)
	$(CP) $(TARGET) Apps:TuneNet/Plugins/

.PHONY: clean
clean: distclean
	$(RM) $(TARGET)

.PHONY: distclean
distclean:
	$(RM) $(OBJS)

.PHONY: revision
revision:
	bumprev $(VERSION) $(TARGET)
