#
# This is the make file for the util subdirectory of the GIF library
# In order to run it gcc is assumed to be available (gnu c compiler)
# You may try other c compilers but the must support ansi c!
#
# Usage: "make -f makefile.unx [all] [rle] [iris]
#
# This make file is for Unix BSD type of machines.
#
#				Gershon Elber, Dec 1989
#

#
# If you have the utah raster tool kit and wants conversion routines to and
# from it set the ones below properly.
#
RLE_INC = -I/u/urt/urt3.0/include
RLE_LIB = /u/urt/urt3.0/lib/librle.a
X_LIB_DIR = /server/sun4/usr/new/lib/X11R4

# Where are all the include files and libraryies for the gif utils:
INC = -I../lib
GIF_LIB = ../lib/libgif.a
GIF_LIB_DEPEND = ../lib/libgif.a ../lib/gif_lib.h ../lib/getarg.h

# Where to copy executables to:
DEST = ../bin

#
# These are the flags for gcc, in BSD4.3 or Sun O.S. 4.0.3
#
# If your system has all function prototypes for gcc, replace all
# the -Wxxx with -Wall. I can not add -Wimplicit as my system uses old cc
# h files.
#
#
# CC = gcc
#
# CFLAGS = -O -c -W -Wreturn-type -Wcomment
# CFLAGS = -g -pg -c -W -Wreturn-type -Wcomment
#
# for sun 4 (gunnars@ifi.uib.no). Tested using gcc 1.39.
#
# CFLAGS = -O -c -sun4 -W -Wreturn-type -Wcomment -DUSE_VARARGS
# CFLAGS = -g -c -sun4 -W -Wreturn-type -Wcomment -DUSE_VARARGS
#
# MORELIBS =

#
# These are the flags for cc on SGI iris4d. O.S. IRIX 3.2. Note you must
# Define MORELIBS as well.
#
CC = cc
#
CFLAGS = -O -c -DSYSV -DNO_VOID_PTR -Olimit 1000 -Wf,-XNh5000 -Wf,-XNd5000 -G 4
# CFLAGS = -g -p -c -DSYSV -DNO_VOID_PTR -Olimit 1000 -Wf,-XNh5000 -Wf,-XNd5000 -G 4
# MORELIBS = -lbsd

#
# These are the flags for xlc, ansi compiler for IBM R6000
#
# CC = xlc
#
# CFLAGS = -O -c -qnoro -D_POSIX_SOURCE -D_ALL_SOURCE -DR6000
# CFLAGS = -g -pg -c -qnoro -D_POSIX_SOURCE -D_ALL_SOURCE -DR6000
# MORELIBS =


ALL =	$(DEST)/gif2epsn $(DEST)/gif2ps $(DEST)/gif2rgb \
	$(DEST)/gif2x11 $(DEST)/gifasm $(DEST)/gifbg \
	$(DEST)/gifclip $(DEST)/gifclrmp $(DEST)/gifcomb \
	$(DEST)/giffix $(DEST)/gifflip $(DEST)/gifhisto \
	$(DEST)/gifinter $(DEST)/gifinto $(DEST)/gifpos \
	$(DEST)/gifrotat $(DEST)/gifrsize $(DEST)/giftext \
	$(DEST)/gifwedge $(DEST)/raw2gif $(DEST)/rgb2gif \
	$(DEST)/text2gif

RLE =   $(DEST)/gif2rle $(DEST)/rle2gif

IRIS =  $(DEST)/gif2iris

.c.o:
	$(CC) $(CFLAGS) $(INC) $(RLE_INC) $<

all:	$(ALL)
rle:	$(RLE)
iris:	$(IRIS)

$(DEST)/gif2epsn: gif2epsn.o $(GIF_LIB_DEPEND)
	$(CC) gif2epsn.o -o gif2epsn $(GIF_LIB)
	mv -f gif2epsn $(DEST)

$(DEST)/gif2iris: gif2iris.o $(GIF_LIB_DEPEND)
	$(CC) gif2iris.o -o gif2iris $(GIF_LIB) -lgl_s
	mv -f gif2iris $(DEST)

$(DEST)/gif2ps: gif2ps.o $(GIF_LIB_DEPEND)
	$(CC) gif2ps.o -o gif2ps $(GIF_LIB)
	mv -f gif2ps $(DEST)

$(DEST)/gif2rgb: gif2rgb.o $(GIF_LIB_DEPEND)
	$(CC) gif2rgb.o -o gif2rgb $(GIF_LIB)
	mv -f gif2rgb $(DEST)

$(DEST)/gif2x11: gif2x11.o $(GIF_LIB_DEPEND)
	$(CC) gif2x11.o -o gif2x11 $(GIF_LIB) -L$(X_LIB_DIR) -lX11 $(MORELIBS)
	mv -f gif2x11 $(DEST)

$(DEST)/gifasm: gifasm.o $(GIF_LIB_DEPEND)
	$(CC) gifasm.o -o gifasm $(GIF_LIB)
	mv -f gifasm $(DEST)

$(DEST)/gifbg: gifbg.o $(GIF_LIB_DEPEND)
	$(CC) gifbg.o -o gifbg $(GIF_LIB)
	mv -f gifbg $(DEST)

$(DEST)/gifclip: gifclip.o $(GIF_LIB_DEPEND)
	$(CC) gifclip.o -o gifclip $(GIF_LIB)
	mv -f gifclip $(DEST)

$(DEST)/gifclrmp: gifclrmp.o $(GIF_LIB_DEPEND)
	$(CC) gifclrmp.o -o gifclrmp $(GIF_LIB) -lm
	mv -f gifclrmp $(DEST)

$(DEST)/gifcomb: gifcomb.o $(GIF_LIB_DEPEND)
	$(CC) gifcomb.o -o gifcomb $(GIF_LIB)
	mv -f gifcomb $(DEST)

$(DEST)/giffix: giffix.o $(GIF_LIB_DEPEND)
	$(CC) giffix.o -o giffix $(GIF_LIB)
	mv -f giffix $(DEST)

$(DEST)/gifflip: gifflip.o $(GIF_LIB_DEPEND)
	$(CC) gifflip.o -o gifflip $(GIF_LIB)
	mv -f gifflip $(DEST)

$(DEST)/gifhisto: gifhisto.o $(GIF_LIB_DEPEND)
	$(CC) gifhisto.o -o gifhisto $(GIF_LIB)
	mv -f gifhisto $(DEST)

$(DEST)/gifinter: gifinter.o $(GIF_LIB_DEPEND)
	$(CC) gifinter.o -o gifinter $(GIF_LIB)
	mv -f gifinter $(DEST)

$(DEST)/gifinto: gifinto.o $(GIF_LIB_DEPEND)
	$(CC) gifinto.o -o gifinto $(GIF_LIB)
	mv -f gifinto $(DEST)

$(DEST)/gifpos: gifpos.o $(GIF_LIB_DEPEND)
	$(CC) gifpos.o -o gifpos $(GIF_LIB)
	mv -f gifpos $(DEST)

$(DEST)/gifrotat: gifrotat.o $(GIF_LIB_DEPEND)
	$(CC) gifrotat.o -o gifrotat $(GIF_LIB) -lm
	mv -f gifrotat $(DEST)

$(DEST)/gifrsize: gifrsize.o $(GIF_LIB_DEPEND)
	$(CC) gifrsize.o -o gifrsize $(GIF_LIB)
	mv -f gifrsize $(DEST)

$(DEST)/giftext: giftext.o $(GIF_LIB_DEPEND)
	$(CC) giftext.o -o giftext $(GIF_LIB)
	mv -f giftext $(DEST)

$(DEST)/gifwedge: gifwedge.o $(GIF_LIB_DEPEND)
	$(CC) gifwedge.o -o gifwedge $(GIF_LIB)
	mv -f gifwedge $(DEST)

$(DEST)/raw2gif: raw2gif.o $(GIF_LIB_DEPEND)
	$(CC) raw2gif.o -o raw2gif $(GIF_LIB)
	mv -f raw2gif $(DEST)

$(DEST)/text2gif: text2gif.o $(GIF_LIB_DEPEND)
	$(CC) text2gif.o -o text2gif $(GIF_LIB)
	mv -f text2gif $(DEST)

$(DEST)/rgb2gif: rgb2gif.o $(GIF_LIB_DEPEND)
	$(CC) rgb2gif.o -o rgb2gif $(GIF_LIB)
	mv -f rgb2gif $(DEST)

#
# The utah raster toolkit conversion routines:
#
$(DEST)/gif2rle: gif2rle.o $(GIF_LIB_DEPEND)
	$(CC) gif2rle.o -o gif2rle $(GIF_LIB) $(RLE_LIB)
	mv -f gif2rle $(DEST)
$(DEST)/rle2gif: rle2gif.o $(GIF_LIB_DEPEND)
	$(CC) rle2gif.o -o rle2gif $(GIF_LIB) $(RLE_LIB)
	mv -f rle2gif $(DEST)
