# PD version of scandir/ftw/alphasort 
# 
# $Log: Makefile,v $
# Revision 1.1  1993/02/16  15:08:58  freewais
# Initial revision
#
# Revision 1.9  92/04/03  12:58:38  morris
# made it work with gcc
# 
# Revision 1.8  92/03/02  14:34:53  jonathan
# changed an errant rm to $(RM), per balze@think.com
# 
# Revision 1.7  92/02/16  18:39:35  jonathan
# Added directives for anytostring
# 
#
#
SHELL=/bin/sh
RM = /bin/rm -f

CC            = cc
CFLAGS	      = -DUSG -g  -I.
DEST	      = ../bin
AR = ar 
ARFLAGS = r
#on SGIs set this to true
RANLIB = ranlib

EXTHDRS	      = /usr/include/stdio.h \
		/usr/include/sys/stat.h \
		/usr/include/sys/types.h

HDRS	      = pdftw.h

TRUNC 	      = $(DEST)/trunc

ANY	      = $(DEST)/stringtoany

TOBJ	      = trunc.o

AOBJ	      = stringtoany.o

LIBRARY	      = $(DEST)/libftw.a

OBJS	      = alphasort.o \
		freedir.o \
		ftw.o \
		scandir.o

SRCS	      = alphasort.c \
		freedir.c \
		ftw.c \
		scandir.c 

TESTOBJS	= ftwtest.o ftwtest scantest.o scantest

all:		$(LIBRARY) $(TRUNC) $(ANY)

$(LIBRARY):	$(OBJS)
		$(RM) -f $@
		$(AR) $(ARFLAGS) $@ $(OBJS)
		$(RANLIB) $(LIBRARY)

$(TRUNC):	$(TOBJ)
		$(CC) -o $@ $(TOBJ)

$(ANY):		$(AOBJ)
		$(CC) -o $@ $(AOBJ)

test:		ftwtest.o scantest.o
		$(CC)  $(CFLAGS) ftwtest.o $(LIBRARY)  -o ftwtest
		$(CC)  $(CFLAGS) scantest.o $(LIBRARY)  -o scantest
		ftwtest /tmp
		scantest /tmp

clean:
	$(RM) *%
	$(RM) *.o
	$(RM) *~
	$(RM) \#*\#
	$(RM) .nfs*  # NFS Lossage
	$(RM) core
	$(RM) $(OBJS) $(TOBJ) $(TESTOBJS) $(LIBRARY) $(TRUNC) $(ANY)

alphasort.o: /usr/include/sys/types.h pdftw.h 
