# Copyright (C) 1993-1999 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.8 1999/11/07 05:55:19 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 -DONLY_1_8_MODES
OPTIONS= -DBUG_WORKAROUND

# This should be the location of the JPEG v6 header files.
JPEG_HEADERS=	-I /usr/local/include
#JPEG_HEADERS=	-I /usr/X11R6/include

# This should be the location of the JPEG v6 libraries.
JPEG_LIBS=	-L /usr/local/lib
#JPEG_LIBS=	-L /usr/X11R6/lib

# These may be changed, if desired.

CC=		gcc
CCOPTS=		-O3

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

CFLAGS=		$(JPEG_HEADERS) -I jpeglib $(CCOPTS) $(OPTIONS)
LIBS=		-lvga $(JPEG_LIBS) -ljpeg -lm
LDOPTS=		-s

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

default:
	@echo "To build seejpeg, first obtain the library for v6 of libjpeg.  This ought"
	@echo "to be available from the same place that you obtained seejpeg.  Having"
	@echo "installed this first, type"
	@echo "      make seejpeg"
	@echo
	@echo "If compilation or linking fails and you did not compile libjpeg v6"
	@echo "yourself, I recommend doing that before filing a bug report."
	@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 $(SEEJPEG) $(LIBS)

install:
		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
