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

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

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

# Additional linker libraries
LIBS = -lm

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

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

SRCS = init.c initplayer.c announceplayer.c openplayer.c \
	decodeframeplayer.c donotify.c raplay.c \
	decode144.c decode288.c decodednet.c \
	liba52/parse.c liba52/bitstream.c liba52/bit_allocate.c \
	liba52/downmix.c liba52/imdct.c

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

OBJS = $(SRCS:.c=.o)

# Rules for building
$(TARGET): $(OBJS)
	$(CC) $(LINK) -nostartfiles -o $(TARGET) $(OBJS) $(LIBS)

init.o: $(TARGET)_rev.h

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

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

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

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