# Makefile for the MPEG Library (based on the Berkeley decoder/player for X11).


# Step 1:
#	Set CC to the C compiler you want to use.  On Sun, gcc 
#	produces faster code.  Your mileage may vary.
#CC            = gcc
CC            = cc
AR            = ar
RANLIB        = true#     change to ranlib for SunOS

ARFLAGS       = ru#       this is supposed to replace only those .o files
                  #       than are newer than the .a file.  Should work
                  #       under most platforms. 

#
# Step 2:
#	Set CFLAGS.  Below are def's for some machines.  Uncomment the
#	appropriate one or make one of your own.  Note that some compilers
#       (the SGI cc, in its default "ANSI + extensions" mode in particular)
#       may not define __STDC__ even if they accept prototypes.
#       
#
#SGI C Flags
CFLAGS        = -O2 -D__STDC__ $(INCLUDEDIR)

#Sun C Flags
#CFLAGS	      =  -O3 -DNDEBUG -DBSD -DNONANSI_INCLUDES $(INCLUDEDIR)

#HP C Flags 
#CFLAGS        = -Ac +O3 -DNDEBUG $(INCLUDEDIR)

#DEC C Flags
#CFLAGS        = -O -DNDEBUG $(INCLUDEDIR)

#RS6000 C Flags
#CFLAGS        = -O $(INCLUDEDIR)

#MIPGS RISC/os 4.5{1,2} C Flags
#CFLAGS        = -O -systype sysv -DNONANSI_INCLUDES -DMIPS

#PTX Flags (Dynix)
#CFLAGS        = -O -DNDEBUG $(INCLUDEDIR)

#NEWS C Flags
#CFLAGS	       = -O2 -DNO_LRAND48 -DNDEBUG -DBSD -DNONANSI_INCUDES $(INCLUDEDIR)

#
#NeXT C Flags
#CFLAGS	       = -O -DNO_LRAND48 -DNDEBUG $(INCLUDEDIR)

#CETIA Unigraph/X C Flags
#CFLAGS	       = -O -DNDEBUGS $(INCLUDEDIR) -DBSDCOMPAT -DBSD_LARGE -DCETIA -DX_NOT_STDC_ENV

#
# Step 3:
#	Set DEST to pathname of final destination of library...
#
DEST	      = .

#
# That's it!  The rest of this shouldn't need any modifications...
#
HDRS	      = util.h video.h decoders.h dither.h fs2.h fs4.h \
                proto.h globals.h mpeg.h

INSTALL	      = /etc/install
SHELL	      = /bin/sh
MAKEFILE      = Makefile

SRC           = util.c video.c parseblock.c motionvector.c decoders.c \
                gdith.c fs2.c fs2fast.c fs4.c hybrid.c hybriderr.c 2x2.c \
		gray.c mono.c jrevdct.c 24bit.c \
                ordered.c ordered2.c mb_ordered.c \
                wrapper.c globals.c

OBJ	      = $(SRC:.c=.o)

LIBRARY       = libmpeg.a

# Targets...

all:		$(LIBRARY)

$(LIBRARY):     $(OBJ)
		$(AR) $(ARFLAGS) $(LIBRARY) $(OBJ)
		$(RANLIB) $(LIBRARY)

clean:;		rm -f *.o $(LIBRARY) core
 
install:	$(LIBRARY)
		@echo Installing $(LIBRARY) in $(DEST)
		@if [ $(DEST) != . ]; then \
		(rm -f $(DEST)/$(LIBRARY); $(INSTALL) -f $(DEST) $(LIBRARY)); fi

# easympeg is a short 'n simple MPEG player that requires the SGI Graphics
# LIbrary; this won't work on non-SGI platforms

easympeg:       easympeg.c mpeg.h $(LIBRARY)
		cc -O2 easympeg.c -L. -lmpeg -lgl_s -o easympeg

# Dependencies between source and header files

24bit.o: video.h dither.h proto.h 
2x2.o: video.h dither.h proto.h 
decoders.o: decoders.h util.h video.h proto.h 
decoders.h: util.h 
fs2.o: video.h dither.h fs2.h proto.h 
fs2fast.o: video.h proto.h dither.h 
fs4.o: fs4.h video.h proto.h dither.h 
gdith.o: dither.h globals.h 
globals.o: video.h globals.h 
globals.h: mpeg.h 
gray.o: video.h proto.h dither.h 
hybrid.o: video.h proto.h dither.h 
hybriderr.o: video.h proto.h dither.h 
jrevdct.o: video.h proto.h 
mb_ordered.o: video.h proto.h dither.h 
mono.o: video.h proto.h dither.h 
motionvector.o: video.h proto.h util.h 
ordered.o: video.h proto.h dither.h 
ordered2.o: video.h proto.h dither.h 
parseblock.o: video.h proto.h decoders.h 
proto.h: globals.h 
util.o: video.h proto.h util.h 
video.o: globals.h decoders.h video.h util.h proto.h 
video.h: mpeg.h 
wrapper.o: video.h proto.h util.h dither.h globals.h 


