include ../../Make.Rules

DEPTH	= ..

SRCDIR	= ../tools
LIBDIR	= ../libtiff

#
# VERSION:	v3.4033
# DATE:		Tue Oct 29 23:07:23 EST 1996
# TARGET:	i586-unknown-linux
# CCOMPILER:	/usr/bin/gcc
#

IPATH	= -I. -I${SRCDIR} -I${LIBDIR}
CFLAGS	+=  ${IPATH}
#
LIBTIFF	= -L../libtiff -ltiff
DEPLIBTIFF = ../libtiff/libtiff.${SHLIB_EXT}

LIBJPEG	= -L../../jpeg -ljpeg
LIBGZ	= -L../../zlib -lz
LIBS	= ${LIBTIFF} ${LIBJPEG} ${LIBGZ}  -lm -Wl,-rpath-link -Wl,../../zlib
#
OBJS=	\
	fax2tiff.o \
	fax2ps.o \
	gif2tiff.o \
	pal2rgb.o \
	ppm2tiff.o \
	rgb2ycbcr.o \
	ras2tiff.o \
	thumbnail.o \
	tiff2bw.o \
	tiff2ps.o \
	tiffcmp.o \
	tiffcp.o \
	tiffdither.o \
	tiffdump.o \
	tiffinfo.o \
	tiffmedian.o \
	tiffsplit.o \
	${NULL}

TARGETS	=\
	fax2tiff \
	fax2ps \
	gif2tiff \
	pal2rgb \
	ppm2tiff \
	rgb2ycbcr \
	thumbnail \
	ras2tiff \
	tiff2bw \
	tiff2ps \
	tiffcmp \
	tiffcp \
	tiffdither \
	tiffdump \
	tiffinfo \
	tiffmedian \
	tiffsplit \
	${NULL}

include ../../Make.Targets

#all:	${APPS}

#clean:
#	rm -f ${APPS} ${OBJS} sgigt.o tiffgt sgisv.o tiffsv \
#	    sgi2tiff.o sgi2tiff core a.out ycbcr 

#
# System-independent tools
#

tiffinfo: tiffinfo.o ${DEPLIBTIFF}
	${CC} -o tiffinfo ${CFLAGS} tiffinfo.o ${LIBS}
tiffinfo.o: ${SRCDIR}/tiffinfo.c
	${CC} -c ${CFLAGS} ${SRCDIR}/tiffinfo.c

tiffcmp:tiffcmp.o ${DEPLIBTIFF}
	${CC} -o tiffcmp ${CFLAGS} tiffcmp.o ${LIBS}
tiffcmp.o: ${SRCDIR}/tiffcmp.c
	${CC} -c ${CFLAGS} ${SRCDIR}/tiffcmp.c

tiffcp:	tiffcp.o ${DEPLIBTIFF}
	${CC} -o tiffcp ${CFLAGS} tiffcp.o ${LIBS}
tiffcp.o: ${SRCDIR}/tiffcp.c
	${CC} -c ${CFLAGS} ${SRCDIR}/tiffcp.c

tiffdump: tiffdump.o
	${CC} -o tiffdump ${CFLAGS} tiffdump.o ${LIBS}
tiffdump.o: ${SRCDIR}/tiffdump.c
	${CC} -c ${CFLAGS} ${SRCDIR}/tiffdump.c

tiffmedian: tiffmedian.o ${DEPLIBTIFF}
	${CC} -o tiffmedian ${CFLAGS} tiffmedian.o ${LIBS}
tiffmedian.o: ${SRCDIR}/tiffmedian.c
	${CC} -c ${CFLAGS} ${SRCDIR}/tiffmedian.c

tiffsplit: tiffsplit.o ${DEPLIBTIFF}
	${CC} -o tiffsplit ${CFLAGS} tiffsplit.o ${LIBS}
tiffsplit.o: ${SRCDIR}/tiffsplit.c
	${CC} -c ${CFLAGS} ${SRCDIR}/tiffsplit.c

tiff2ps: tiff2ps.o ${DEPLIBTIFF}
	${CC} -o tiff2ps ${CFLAGS} tiff2ps.o ${LIBS}
tiff2ps.o: ${SRCDIR}/tiff2ps.c
	${CC} -c ${CFLAGS} ${SRCDIR}/tiff2ps.c

#
# Junky stuff... programs that are more examples of how
# to use the library than full-blown useful tools.
#

# convert RGB image to B&W
tiff2bw: tiff2bw.o ${DEPLIBTIFF}
	${CC} -o tiff2bw ${CFLAGS} tiff2bw.o ${LIBS}
tiff2bw.o: ${SRCDIR}/tiff2bw.c
	${CC} -c ${CFLAGS} ${SRCDIR}/tiff2bw.c

# convert B&W image to bilevel w/ FS dithering
tiffdither: tiffdither.o ${DEPLIBTIFF}
	${CC} -o tiffdither ${CFLAGS} tiffdither.o ${LIBS}
tiffdither.o: ${SRCDIR}/tiffdither.c
	${CC} -c ${CFLAGS} ${SRCDIR}/tiffdither.c

# simple Sun rasterfile converter
ras2tiff: ras2tiff.o ${DEPLIBTIFF}
	${CC} -o ras2tiff ${CFLAGS} ras2tiff.o ${LIBS}
ras2tiff.o: ${SRCDIR}/ras2tiff.c
	${CC} -c ${CFLAGS} ${SRCDIR}/ras2tiff.c

# simple GIF converter
gif2tiff: gif2tiff.o ${DEPLIBTIFF}
	${CC} -o gif2tiff ${CFLAGS} gif2tiff.o ${LIBS}
gif2tiff.o: ${SRCDIR}/gif2tiff.c
	${CC} -c ${CFLAGS} ${SRCDIR}/gif2tiff.c

# very limited PBM converter
ppm2tiff: ppm2tiff.o ${DEPLIBTIFF}
	${CC} -o ppm2tiff ${CFLAGS} ppm2tiff.o ${LIBS}
ppm2tiff.o: ${SRCDIR}/ppm2tiff.c
	${CC} -c ${CFLAGS} ${SRCDIR}/ppm2tiff.c

# Group 3/4 FAX file converter
fax2tiff: fax2tiff.o ${DEPLIBTIFF}
	${CC} -o fax2tiff ${CFLAGS} fax2tiff.o ${LIBS}
fax2tiff.o: ${SRCDIR}/fax2tiff.c
	${CC} -c -I${LIBDIR} -I${DEPTH}/libtiff ${CFLAGS} ${SRCDIR}/fax2tiff.c

# Group 3/4 FAX to encoded PS converter
fax2ps: fax2ps.o ${DEPLIBTIFF}
	${CC} -o fax2ps ${CFLAGS} fax2ps.o ${LIBS}
fax2ps.o: ${SRCDIR}/fax2ps.c
	${CC} -c ${CFLAGS} ${SRCDIR}/fax2ps.c

# convert Palette image to RGB
pal2rgb: pal2rgb.o ${DEPLIBTIFF}
	${CC} -o pal2rgb ${CFLAGS} pal2rgb.o ${LIBS}
pal2rgb.o: ${SRCDIR}/pal2rgb.c
	${CC} -c ${CFLAGS} ${SRCDIR}/pal2rgb.c

# convert RGB image to YCbCr
rgb2ycbcr: rgb2ycbcr.o ${DEPLIBTIFF}
	${CC} -o rgb2ycbcr ${CFLAGS} rgb2ycbcr.o ${LIBS}
rgb2ycbcr.o: ${SRCDIR}/rgb2ycbcr.c
	${CC} -c ${CFLAGS} ${SRCDIR}/rgb2ycbcr.c

# generate thumbnail images from fax (example of SubIFD usage)
thumbnail: thumbnail.o ${DEPLIBTIFF}
	${CC} -o thumbnail ${CFLAGS} thumbnail.o ${LIBS}
thumbnail.o: ${SRCDIR}/thumbnail.c
	${CC} -c ${CFLAGS} ${SRCDIR}/thumbnail.c

#
# System-specific tools.
#

#
# sgi2tiff converts SGI RGB images to TIFF; it requires
# the SGI image library -limage.
#
sgi2tiff: sgi2tiff.o ${DEPLIBTIFF}
	${CC} -o sgi2tiff ${CFLAGS} sgi2tiff.o -limage ${LIBS}
sgi2tiff.o: ${SRCDIR}/sgi2tiff.c
	${CC} -c ${CFLAGS} ${SRCDIR}/sgi2tiff.c

# SGI versions of tiffgt & tiffsv that require -lgl
tiffgt:	sgigt.o ${DEPLIBTIFF}
	${CC} -o tiffgt ${CFLAGS} sgigt.o ${LIBS} -lgutil -lgl_s
sgigt.o: ${SRCDIR}/sgigt.c
	${CC} -c ${CFLAGS} ${SRCDIR}/sgigt.c

tiffsv:	sgisv.o ${DEPLIBTIFF}
	${CC} -o tiffsv ${CFLAGS} sgisv.o ${LIBS} -lgutil -lgl_s
sgisv.o: ${SRCDIR}/sgisv.c
	${CC} -c ${CFLAGS} ${SRCDIR}/sgisv.c
