# Copyright (C) 1993, 1994 Evan Harris
#
# Permission is granted to freely redistribute and modify this code,
# providing the author(s) get credit for having written it.

# The installation directory.
BIN=	/usr/bin

# See the README for a description of these options.
#OPTIONS= -DPIX_ALIGN=8 -DNO_32K_CASCADE -DTESTMODE=G640x480x32K -DBUG_WORKAROUND
OPTIONS= -DBUG_WORKAROUND

# This should be the location of the libgr header files.
# It is only required for compiling with the libgr shared library.

GRHEADERS=	/usr/include/gr

# These may be changed, if desired.

CC=		gcc
CCOPTS=		-O2 -m486

# Editing of the rest of this Makefile shouldn't be necessary.

CFLAGS=		-Ijpeglib $(CCOPTS) $(OPTIONS)
LIBS=		-lvga jpeglib/libjpeg.a

SHCFLAGS=	-I$(GRHEADERS) $(CCOPTS) $(OPTIONS)
SHLIBS=		-lvga -ljpeg -lm
SHLDOPTS=	-s -N

SEEJPEG=	seejpeg.o jpeg.o image.o display.o cmap.o

default:
	@echo "Please see the README to find out how to set PIX_ALIGN"
	@echo
	@echo "'make shared' now produces a usable binary if libgr-1.3 is installed"
	@echo "correctly!"
	@echo
	@echo "Type  make seejpeg  to make seejpeg using the static libraries in the"
	@echo "                    directory jpeglib"
	@echo "or    make shared   to make seejpeg using shared libraries from libgr"
	@echo "                    which have already been installed (these are not"
	@echo "                    included with seejpeg)"
	@echo "then  make install  to install seejpeg in $(BIN) after it has"
	@echo "                    been made"

seejpeg:	$(SEEJPEG)
		$(CC) $(CFLAGS) $(LDOPTS) -o $@ $(SEEJPEG) $(LIBS)

shared:
		make CFLAGS="$(SHCFLAGS)" LIBS="$(SHLIBS)" LDOPTS="$(SHLDOPTS)" seejpeg

install:	seejpeg
		install -s -o root -g bin -m 4711 seejpeg $(BIN)

clean:
		rm -f *.o *~ core seejpeg

seejpeg.o:	seejpeg.h
jpeg.o:		seejpeg.h
image.o:	seejpeg.h
display.o:	seejpeg.h
cmap.o:		seejpeg.h
