# Description file for librle library. ($rlib)

# DEST is where to install the library for programs outside the Raster Toolkit.
DEST = ../../lib
# RI is the include directory for RLE files.
RI = ../include

# DFLAGS is for necessary "defines"
# -DLITTLE_ENDIAN if you are on a machine with a vax-like byte order.  It
# is automatically defined on vax and pdp11 machines
DFLAGS =

CFLAGS = -O $(DFLAGS) $(IFLAGS)
IFLAGS = -I. -I$(RI)
# System V make pays attention to the SHELL environment variable. Override it.
SHELL = /bin/sh

# If nothing else is specified, default is to build the library.
default: buildlib

### Add bstring.o if your Unix does not have bcopy and bzero.
OBJS = Runsv.o rle_getrow.o sv_putrow.o svfb_global.o rle_getraw.o \
	sv_putraw.o rle_raw_alc.o rle_row_alc.o scanargs.o buildmap.o \
	rle_getcom.o rle_putcom.o dither.o float_to_exp.o getopt.o
### bstring.o

LIBNAME = librle.a

makefile:
depend:

# Just rebuild the object files.
objs: $(OBJS)

# Copy the library to the destination directory.
# (Install a second copy on the debug subdirectory, on the theory that it
#  is more useful to have a non-debug version than nothing at all.)
install: buildlib
	cp $(LIBNAME) $(DEST)/$(LIBNAME)
	ranlib $(DEST)/$(LIBNAME)
	cp $(LIBNAME) $(DEST)/debug/$(LIBNAME)
	ranlib $(DEST)/debug/$(LIBNAME)
	touch install

# Rebuild the library from all the .o files.
buildlib: $(OBJS)
	-rm $(LIBNAME)
	ar rc $(LIBNAME)
	ar q $(LIBNAME) $(OBJS)
	ranlib $(LIBNAME)
	touch buildlib

# Clean up installed stuff and binaries
pristine: clean
	-rm -f $(DEST)/$(LIBNAME) $(DEST)/debug/$(LIBNAME)

# Get rid of everything which must be recompiled on a different computer.
clean:
	-rm -f *.o
	-rm -f $(LIBNAME)
	-rm -f *.ln
	-rm -f buildlib install lintlib

# Lint actions:
#
# lintall - run lint on all the source files
# lint1 - run line on one source file
# llib-lrle - build human-readable form of lint library
# llib-lrle.ln - build machine readable form of lint library for
# use in linting programs that use the library
# linstall - install the lint library
#
lintall:
	lint $(DFLAGS) $(IFLAGS) $(CFILES)

lint1:
	lint $(DFLAGS) $(IFLAGS) -u $(LINTF) llib-lrle.ln

llib-lrle: $(CFILES)
	-gemacs -tnull -q -l${AEM}/mk-llib.ml -emk-llib llib-lrle ${CFILES}

lintlib llib-lrle.ln: llib-lrle
	/lib/cpp $(IFLAGS) -C -Dlint llib-lrle | > /usr/lib/lint/lint1 -uv > \
		llib-lrle.ln
	touch lintlib

# Install the lint library.
linstall: llib-lrle.ln
	cp llib-lrle.ln llib-lrle /usr/lib/lint

# Dependencies on .h files:
# DO NOT DELETE THIS LINE
Runsv.o: $(RI)/XtndRunsv.h $(RI)/svfb.h $(RI)/svfb_global.h
rle_getraw.o: $(RI)/rle_getraw.h $(RI)/svfb_global.h
rle_getrow.o: $(RI)/XtndRunsv.h $(RI)/svfb_global.h
rle_raw_alc.o: $(RI)/rle_getraw.h $(RI)/svfb_global.h
rle_row_alc.o: $(RI)/svfb_global.h
sv_putraw.o: $(RI)/rle_getraw.h $(RI)/svfb.h $(RI)/svfb_global.h
sv_putrow.o: $(RI)/svfb.h $(RI)/svfb_global.h
svfb_global.o: $(RI)/svfb.h $(RI)/svfb_global.h
buildmap.o: $(RI)/svfb_global.h
rle_getcom.o: $(RI)/svfb_global.h
rle_putcom.o: $(RI)/svfb_global.h
float_to_exp.o: $(RI)/svfb_global.h
