# Copyright (C) 1993-1996 Evan Harris
#
# Permission is granted to freely redistribute and modify this code,
# providing the author(s) get credit for having written it.
#
# $Id: Makefile,v 1.5 1996/11/01 19:18:40 evan Exp $	

# The installation directories.
BIN=	/usr/local/bin
MAN=	/usr/local/man/man1

# See the README for a description of these options.
#OPTIONS= -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 (or libjpeg) 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 -lm

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

SEEJPEG=	seejpeg.o jpeg.o image.o display.o cmap.o	\
		jpeglib/rdgif.o jpeglib/rdppm.o jpeglib/rdbmp.o	\
		jpeglib/rdtarga.o

default:
	@echo "To build a statically linked version of seejpeg on an a.out system, type"
	@echo "      make seejpeg"
	@echo "As I no longer have an a.out system, this has not been tested recently."
	@echo
	@echo "To build a statically linked version of seejpeg on an ELF system, you must"
	@echo "first obtain a static ELF version of jpeglib/libjpeg.a.   You CANNOT build"
	@echo "an ELF binary using the version of libjpeg.a distributed with seejpeg."
	@echo
	@echo "To build a dynamically linked version of seejpeg, first obtain the shared"
	@echo "library for v6 of libjpeg.  For ELF, this ought to be available from the"
	@echo "same place you got seejpeg.  Having installed this first, type"
	@echo "      make shared"
	@echo
	@echo "After building the binary, to install it, type"
	@echo "      make install"
	@echo "to install seejpeg in $(BIN) and the manual in $(MAN)"

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)
		install -o root -g root -m 644 seejpeg.1 $(MAN)

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

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