# Makefile for mpeg2decode

# Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved.

#
# Disclaimer of Warranty
#
# These software programs are available to the user without any license fee or
# royalty on an "as is" basis.  The MPEG Software Simulation Group disclaims
# any and all warranties, whether express, implied, or statuary, including any
# implied warranties or merchantability or of fitness for a particular
# purpose.  In no event shall the copyright-holder be liable for any
# incidental, punitive, or consequential damages of any kind whatsoever
# arising from the use of these programs.
#
# This disclaimer of warranty extends to the user of these programs and user's
# customers, employees, agents, transferees, successors, and assigns.
#
# The MPEG Software Simulation Group does not represent or warrant that the
# programs furnished hereunder are free of infringement of any third-party
# patents.
#
# Commercial implementations of MPEG-1 and MPEG-2 video, including shareware,
# are subject to royalty fees to patent holders.  Many of these patents are
# general enough such that they are unavoidable regardless of implementation
# design.
#
#

#WARNINGS = -Wall
#VERIFY = -DVERIFY

#disable this flag if you do not want bitstream element tracing 
#this will speed up the decoder some since it does not have to test
#the trace flag at several critical inner loop locations.
#TRACE = -DTRACE

#disable this flag if you do not need verbose trace, such as
#header information
#VERBOSE = -DVERBOSE

# uncomment the following two lines if you want to include X11 support

#USE_DISP = -DDISPLAY
#LIBS = -lX11

# uncomment the following two lines if you want to use shared memory
# (faster display if server and client run on the same machine)

#USE_SHMEM = -DSH_MEM
#LIBS = -lXext -lX11


VEX=$(HOME)/vex
LIBRARYDIR = -L$(VEX)/lib
CC = $(VEX)/bin/cc 
CFLAGS = $(USE_DISP) $(USE_SHMEM) $(INCLUDEDIR) $(TRACE) $(VERBOSE) $(VERIFY) $(WARNINGS) $(VEXCFLAGS)

OBJ = mpeg2dec.o getpic.o motion.o getvlc.o gethdr.o getblk.o getbits.o store.o recon.o spatscal.o idct.o idctref.o display.o systems.o subspic.o verify.o

.PHONY: all clean sim


all: mpeg2decode

clean:
	rm -f *.o *% ta.log.* ./data/tmp* core mpeg2decode

sim:
	./mpeg2decode -b ./data/mei16v2.m2v -f -o ./data/tmp%d
	/bin/bash -c 'for f in ./data/rec* ; do diff -qs $$f $${f//rec/tmp} ; done'

gen:
	./mpeg2decode -b ./data/mei16v2.m2v -f -o ./data/rec%d

mpeg2decode: $(OBJ)
	$(CC) $(VEXCFLAGS) $(LIBRARYDIR) -o mpeg2decode $(OBJ) -lc -lm $(LIBS)

display.o : display.c config.h global.h mpeg2dec.h 
getbits.o : getbits.c config.h global.h mpeg2dec.h 
getblk.o : getblk.c config.h global.h mpeg2dec.h 
gethdr.o : gethdr.c config.h global.h mpeg2dec.h 
getpic.o : getpic.c config.h global.h mpeg2dec.h 
getvlc.o : getvlc.c config.h global.h mpeg2dec.h getvlc.h 
idct.o : idct.c config.h 
idctref.o : idctref.c config.h 
motion.o : motion.c config.h global.h mpeg2dec.h 
mpeg2dec.o : mpeg2dec.c config.h global.h mpeg2dec.h 
recon.o : recon.c config.h global.h mpeg2dec.h 
spatscal.o : spatscal.c config.h global.h mpeg2dec.h 
store.o : store.c config.h global.h mpeg2dec.h 

# additions since July 4, 1994 edition
systems.o : systems.c config.h global.h mpeg2dec.h 
subspic.o : subspic.c config.h global.h mpeg2dec.h 
verify.o:   verify.c config.h global.h mpeg2dec.h
