# PD version of scandir/ftw/alphasort 
# 
SHELL=/bin/sh
CFLAGS	      = -DUSG -g  -I.
DEST	      = ../bin
AR = ar 
ARFLAGS = r

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

HDRS	      = pdftw.h

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) 

$(LIBRARY):	$(OBJS)
		rm -f $@
		$(AR) $(ARFLAGS) $@ $(OBJS)
		ranlib $(LIBRARY)

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 -f $(OBJS) $(TESTOBJS) $(LIBRARY)

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