
CC=gcc
OPTIMIZE=-O3 -mcpu=pentiumpro -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=686
CFLAGS=$(OPTIMIZE) -D_FILE_OFFSET_BITS=64
LIBS=-lasound

# This shows playback information on the screen, and outputs more info to stderr
#SHOW_INFO= -DSHOW_INFO

# Use this to play oddball DVDs
# Uncomment these two lines if you have installed libcss-0.1.0.tar.gz (or equivalent)
#LIBCSS= -DLIB_CSS
#CSSLIBS=-lcss

PLAY_DEPS=main.h play.h output/fbtools.h output/sound.h\
	output/video.h output/yuv2rgb.h output/mm_accel.h output/mmx.h
PLAY_OBJS=main.o play.o output/fbtools.o\
	output/sound.o output/video.o output/yuv2rgb.o output/yuv2rgb_mmx.o\
	output/cpu_accel.o
AC3_DEPS=ac3/ac3_internal.h ac3/bitstream.h ac3/decode.h ac3/imdct.h ac3/ac3.h ac3/stats.h ac3/coeff.h\
	ac3/exponent.h ac3/bit_allocate.h ac3/parse.h ac3/crc.h ac3/debug.h ac3/rematrix.h ac3/downmix.h\
	ac3/dither.h ac3/sanity_check.h
AC3_OBJS=ac3/bitstream.o ac3/decode.o ac3/imdct.o ac3/coeff.o ac3/exponent.o\
	ac3/bit_allocate.o ac3/parse.o ac3/crc.o ac3/debug.o ac3/rematrix.o\
	ac3/sanity_check.o ac3/stats.o ac3/downmix.o ac3/dither.o
MPEG_DEPS=mpeg2/mpeg2_internal.h mpeg2/vlc.h
MPEG_OBJS=mpeg2/header.o mpeg2/idct_mlib.o mpeg2/motion_comp.o mpeg2/motion_comp_mmx.o mpeg2/slice.o\
	mpeg2/decode.o mpeg2/idct.o mpeg2/idct_mmx.o mpeg2/motion_comp_mlib.o mpeg2/stats.o
DVD_DEPS=input/dvd.h input/dvd_udf.h
DVD_OBJS=input/playlist.o input/dvd.o input/dvd_udf.o
IFO_OBJS=input/ifo_read.o input/nav_read.o
IFO_DEPS=input/ifo_read.h input/ifo_types.h input/nav_read.h input/nav_types.h

all:	play

play:	$(PLAY_OBJS) $(AC3_OBJS) $(MPEG_OBJS) $(DVD_OBJS) $(IFO_OBJS)
	$(CC) $(LIBS) $(CSSLIBS) $^ -o play

%.o:	%.c main.h
	$(CC) -c $(CFLAGS) $(LIBCSS) $(SHOW_INFO) $< -o $@

clean:
	-rm -f play *.o */*.o *~ */*~
