# 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/local/bin

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

# 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=		-lvgagl -lvga jpeglib/libjpeg.a -lncurses

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

VIEWJPEG=	viewjpeg.o newfunct.o jpeg.o image.o display.o cmap.o pixmap.o bmp.o xbitmap.o frontend.o

default:       
		make CFLAGS="$(SHCFLAGS)" LIBS="$(SHLIBS)" LDOPTS="$(SHLDOPTS)" viewjpeg

viewjpeg:	$(VIEWJPEG)
		$(CC) $(CFLAGS) $(LDOPTS) -o $@ $(VIEWJPEG) $(LIBS)

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

clean:
		rm -f *.o *~ *.bak *.ASV debug core viewjpeg

clear:
		rm -f frontend.* Makefile

frontend.o:	viewjpeg.h
viewjpeg.o:	viewjpeg.h
newfunct.o:	viewjpeg.h
jpeg.o:		viewjpeg.h
image.o:	viewjpeg.h
display.o:	viewjpeg.h
cmap.o:		viewjpeg.h
bmp.o:		viewjpeg.h
pixmap.o:	viewjpeg.h
xbitmap.o:	viewjpeg.h
