1#	$Header: /cvsroot/osrs/libtiff/tools/Makefile.in,v 1.14 2003/11/26 07:41:42 dron Exp $
2#
3# @WARNING@
4#
5# TIFF Library Tools
6#
7# Copyright (c) 1988-1997 Sam Leffler
8# Copyright (c) 1991-1997 Silicon Graphics, Inc.
9#
10# Permission to use, copy, modify, distribute, and sell this software and
11# its documentation for any purpose is hereby granted without fee, provided
12# that (i) the above copyright notices and this permission notice appear in
13# all copies of the software and related documentation, and (ii) the names of
14# Sam Leffler and Silicon Graphics may not be used in any advertising or
15# publicity relating to the software without the specific, prior written
16# permission of Stanford and Silicon Graphics.
17#
18# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
19# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
20# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
21#
22# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
23# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
24# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
25# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
26# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
27# OF THIS SOFTWARE.
28#
29DEPTH	= ..
30
31SRCDIR	= @RELSRCDIR@/tools
32LIBDIR	= @RELSRCDIR@/libtiff
33
34#
35# VERSION:	@VERSION@
36# DATE:		@DATE@
37# TARGET:	@TARGET@
38# CCOMPILER:	@CCOMPILER@
39#
40SHELL	= @SCRIPT_SH@
41SCRIPT_SH = @SCRIPT_SH@
42NULL	=
43CC	= @CCOMPILER@
44INSTALL	= @INSTALL@
45#
46COPTS	= @GCOPTS@
47OPTIMIZER=@OPTIMIZER@
48IPATH	= -I. -I${SRCDIR} -I${LIBDIR}
49CFLAGS	= @ENVOPTS@ ${COPTS} ${OPTIMIZER} ${IPATH}
50#
51TIFFLIB	= ${DEPTH}/libtiff/libtiff.@DSOSUF@
52LIBJPEG	= @LIBJPEG@
53LIBGZ	= @LIBGZ@
54LIBTIFF	= @TIFFLIBREF@
55LIBPORT	= @LIBPORT@
56MACHLIBS= @MACHDEPLIBS@
57LIBS	= ${LIBTIFF} ${LIBJPEG} ${LIBGZ} ${LIBPORT} ${MACHLIBS}
58#
59OBJS=	\
60	fax2tiff.o \
61	fax2ps.o \
62	gif2tiff.o \
63	pal2rgb.o \
64	ppm2tiff.o \
65	rgb2ycbcr.o \
66	ras2tiff.o \
67	raw2tiff.o \
68	thumbnail.o \
69	tiff2bw.o \
70	tiff2rgba.o \
71	tiff2pdf.o \
72	tiff2ps.o \
73	tiffcmp.o \
74	tiffcp.o \
75	tiffdither.o \
76	tiffdump.o \
77	tiffinfo.o \
78	tiffmedian.o \
79	tiffsplit.o \
80	tiffset.o \
81	${NULL}
82TARGETS	=\
83	fax2tiff \
84	fax2ps \
85	gif2tiff \
86	pal2rgb \
87	ppm2tiff \
88	rgb2ycbcr \
89	thumbnail \
90	ras2tiff \
91	raw2tiff \
92	tiff2bw \
93	tiff2rgba \
94	tiff2pdf \
95	tiff2ps \
96	tiffcmp \
97	tiffcp \
98	tiffdither \
99	tiffdump \
100	tiffinfo \
101	tiffmedian \
102	tiffsplit \
103	tiffset \
104	${NULL}
105
106all:	${TARGETS}
107	@if [ "@LIBIMAGE@" = yes ]; then \
108	    ${MAKE} -${MAKEFLAGS} sgi2tiff; \
109	else \
110	    true; \
111	fi
112	@if [ "@LIBGL@" = yes ]; then \
113	    ${MAKE} -${MAKEFLAGS} tiffgt tiffsv; \
114	else \
115	    true; \
116	fi
117install: all
118	${INSTALL} -idb tiff.sw.tools -m 755 				\
119		-dir ${DESTDIR}@DIR_BIN@
120	${INSTALL} -idb tiff.sw.tools -m 755 				\
121		-F ${DESTDIR}@DIR_BIN@ -O ${TARGETS}
122	@if [ "@LIBIMAGE@" = yes ]; then 				\
123	    ${INSTALL} -idb tiff.sw.tools -m 755 			\
124		-F ${DESTDIR}@DIR_BIN@ -O sgi2tiff; 			\
125	else 								\
126	    true;							\
127	fi
128	@if [ "@LIBGL@" = yes ]; then 					\
129	    ${INSTALL} -idb tiff.sw.tools -m 755 -F ${DESTDIR}@DIR_BIN@ \
130		-O tiffgt tiffsv;					\
131	else 								\
132	    true; 							\
133	fi
134clean:
135	rm -f ${TARGETS} ${OBJS} tiffgt.o tiffgt sgisv.o tiffsv 	\
136	    sgi2tiff.o sgi2tiff core a.out ycbcr
137
138#
139# System-independent tools
140#
141
142tiffinfo: tiffinfo.o ${TIFFLIB}
143	${CC} -o tiffinfo ${CFLAGS} tiffinfo.o ${LIBS}
144tiffinfo.o: ${SRCDIR}/tiffinfo.c
145	${CC} -c ${CFLAGS} ${SRCDIR}/tiffinfo.c
146
147tiffcmp:tiffcmp.o ${TIFFLIB}
148	${CC} -o tiffcmp ${CFLAGS} tiffcmp.o ${LIBS}
149tiffcmp.o: ${SRCDIR}/tiffcmp.c
150	${CC} -c ${CFLAGS} ${SRCDIR}/tiffcmp.c
151
152tiffcp:	tiffcp.o ${TIFFLIB}
153	${CC} -o tiffcp ${CFLAGS} tiffcp.o ${LIBS}
154tiffcp.o: ${SRCDIR}/tiffcp.c
155	${CC} -c ${CFLAGS} ${SRCDIR}/tiffcp.c
156
157tiffdump: tiffdump.o
158	${CC} -o tiffdump ${CFLAGS} tiffdump.o ${LIBS}
159tiffdump.o: ${SRCDIR}/tiffdump.c
160	${CC} -c ${CFLAGS} ${SRCDIR}/tiffdump.c
161
162tiffmedian: tiffmedian.o ${TIFFLIB}
163	${CC} -o tiffmedian ${CFLAGS} tiffmedian.o ${LIBS}
164tiffmedian.o: ${SRCDIR}/tiffmedian.c
165	${CC} -c ${CFLAGS} ${SRCDIR}/tiffmedian.c
166
167tiffsplit: tiffsplit.o ${TIFFLIB}
168	${CC} -o tiffsplit ${CFLAGS} tiffsplit.o ${LIBS}
169tiffsplit.o: ${SRCDIR}/tiffsplit.c
170	${CC} -c ${CFLAGS} ${SRCDIR}/tiffsplit.c
171
172tiff2pdf: tiff2pdf.o ${TIFFLIB}
173	${CC} -o tiff2pdf ${CFLAGS} tiff2pdf.o ${LIBS}
174tiff2pdf.o: ${SRCDIR}/tiff2pdf.c
175	${CC} -c ${CFLAGS} ${SRCDIR}/tiff2pdf.c
176
177tiff2ps: tiff2ps.o ${TIFFLIB}
178	${CC} -o tiff2ps ${CFLAGS} tiff2ps.o ${LIBS}
179tiff2ps.o: ${SRCDIR}/tiff2ps.c
180	${CC} -c ${CFLAGS} ${SRCDIR}/tiff2ps.c
181
182tiffset: tiffset.o ${TIFFLIB}
183	${CC} -o tiffset ${CFLAGS} tiffset.o ${LIBS}
184tiffset.o: ${SRCDIR}/tiffset.c
185	${CC} -c ${CFLAGS} -I../libtiff ${SRCDIR}/tiffset.c
186
187#
188# Junky stuff... programs that are more examples of how
189# to use the library than full-blown useful tools.
190#
191
192# convert RGB image to B&W
193tiff2bw: tiff2bw.o ${TIFFLIB}
194	${CC} -o tiff2bw ${CFLAGS} tiff2bw.o ${LIBS}
195tiff2bw.o: ${SRCDIR}/tiff2bw.c
196	${CC} -c ${CFLAGS} ${SRCDIR}/tiff2bw.c
197
198# convert anything to RGBA.
199tiff2rgba: tiff2rgba.o ${TIFFLIB}
200	${CC} -o tiff2rgba ${CFLAGS} tiff2rgba.o ${LIBS}
201tiff2rgba.o: ${SRCDIR}/tiff2rgba.c
202	${CC} -c ${CFLAGS} ${SRCDIR}/tiff2rgba.c
203
204# convert B&W image to bilevel w/ FS dithering
205tiffdither: tiffdither.o ${TIFFLIB}
206	${CC} -o tiffdither ${CFLAGS} tiffdither.o ${LIBS}
207tiffdither.o: ${SRCDIR}/tiffdither.c
208	${CC} -c ${CFLAGS} ${SRCDIR}/tiffdither.c
209
210# simple Sun rasterfile converter
211ras2tiff: ras2tiff.o ${TIFFLIB}
212	${CC} -o ras2tiff ${CFLAGS} ras2tiff.o ${LIBS}
213ras2tiff.o: ${SRCDIR}/ras2tiff.c
214	${CC} -c ${CFLAGS} ${SRCDIR}/ras2tiff.c
215
216# convert raw images to TIFFs
217raw2tiff: raw2tiff.o ${TIFFLIB}
218	${CC} -o raw2tiff ${CFLAGS} raw2tiff.o ${LIBS}
219raw2tiff.o: ${SRCDIR}/raw2tiff.c
220	${CC} -c ${CFLAGS} ${SRCDIR}/raw2tiff.c
221
222# simple GIF converter
223gif2tiff: gif2tiff.o ${TIFFLIB}
224	${CC} -o gif2tiff ${CFLAGS} gif2tiff.o ${LIBS}
225gif2tiff.o: ${SRCDIR}/gif2tiff.c
226	${CC} -c ${CFLAGS} ${SRCDIR}/gif2tiff.c
227
228# very limited PBM converter
229ppm2tiff: ppm2tiff.o ${TIFFLIB}
230	${CC} -o ppm2tiff ${CFLAGS} ppm2tiff.o ${LIBS}
231ppm2tiff.o: ${SRCDIR}/ppm2tiff.c
232	${CC} -c ${CFLAGS} ${SRCDIR}/ppm2tiff.c
233
234# Group 3/4 FAX file converter
235fax2tiff: fax2tiff.o ${TIFFLIB}
236	${CC} -o fax2tiff ${CFLAGS} fax2tiff.o ${LIBS}
237fax2tiff.o: ${SRCDIR}/fax2tiff.c
238	${CC} -c -I${LIBDIR} -I${DEPTH}/libtiff ${CFLAGS} ${SRCDIR}/fax2tiff.c
239
240# Group 3/4 FAX to encoded PS converter
241fax2ps: fax2ps.o ${TIFFLIB}
242	${CC} -o fax2ps ${CFLAGS} fax2ps.o ${LIBS}
243fax2ps.o: ${SRCDIR}/fax2ps.c
244	${CC} -c ${CFLAGS} ${SRCDIR}/fax2ps.c
245
246# convert Palette image to RGB
247pal2rgb: pal2rgb.o ${TIFFLIB}
248	${CC} -o pal2rgb ${CFLAGS} pal2rgb.o ${LIBS}
249pal2rgb.o: ${SRCDIR}/pal2rgb.c
250	${CC} -c ${CFLAGS} ${SRCDIR}/pal2rgb.c
251
252# convert RGB image to YCbCr
253rgb2ycbcr: rgb2ycbcr.o ${TIFFLIB}
254	${CC} -o rgb2ycbcr ${CFLAGS} rgb2ycbcr.o ${LIBS}
255rgb2ycbcr.o: ${SRCDIR}/rgb2ycbcr.c
256	${CC} -c ${CFLAGS} ${SRCDIR}/rgb2ycbcr.c
257
258# generate thumbnail images from fax (example of SubIFD usage)
259thumbnail: thumbnail.o ${TIFFLIB}
260	${CC} -o thumbnail ${CFLAGS} thumbnail.o ${LIBS}
261thumbnail.o: ${SRCDIR}/thumbnail.c
262	${CC} -c ${CFLAGS} ${SRCDIR}/thumbnail.c
263
264#
265# System-specific tools.
266#
267
268#
269# sgi2tiff converts SGI RGB images to TIFF; it requires
270# the SGI image library -limage.
271#
272sgi2tiff: sgi2tiff.o ${TIFFLIB}
273	${CC} -o sgi2tiff ${CFLAGS} sgi2tiff.o -limage ${LIBS}
274sgi2tiff.o: ${SRCDIR}/sgi2tiff.c
275	${CC} -c ${CFLAGS} ${SRCDIR}/sgi2tiff.c
276
277# SGI versions of tiffgt & tiffsv that require -lgl
278tiffgt:	tiffgt.o ${TIFFLIB}
279	${CC} -o tiffgt ${CFLAGS} tiffgt.o -lGL -lglut ${LIBS}
280tiffgt.o: ${SRCDIR}/tiffgt.c
281	${CC} -c ${CFLAGS} ${SRCDIR}/tiffgt.c
282
283tiffsv:	sgisv.o ${TIFFLIB}
284	${CC} -o tiffsv ${CFLAGS} sgisv.o -lgutil -lgl ${LIBS}
285sgisv.o: ${SRCDIR}/sgisv.c
286	${CC} -c ${CFLAGS} ${SRCDIR}/sgisv.c
287
288