#	Build VTREE
#
#	Define the type of system we're working with.  Three
# choices:
#
#   1.	BSD Unix 4.2 or 4.3.  Directory read support in the
# standard library, so we don't have to do much.  Select BSD.
#
#   2.	System V.  I depend on Doug Gwyn's directory reading
# routines.  They were posted to Usenet "comp.sources" early in
# May 1987.  They're worth the effort to get, if you don't have
# them already.  Select SYS_V.  Be sure to define NLIB to be the
# 'cc' option to include the directory library.
#
#   3.  System III, or machines without any directory read
# packages.  I have a minimal kludge.  Select SYS_III.
#
#   4.  SCO Xenix 386.  See the comments for System V.
#
#   5.  SCO Xenix 286.  See the comments for System V.
#

# Case 1:
#VTREE=vtree
#SYS=	-DBSD
#NLIB=	-lgetopt

# Case 2:
#VTREE=vtree
#SYS=	-DSYS_V
#NLIB=	-lndir

# Case 3:
#VTREE=vtree
#SYS=	-DSYS_III
#NLIB=

# Case 4: sco Xenix-386
VTREE=vtree
SYS=	-Ox -CSON -DSCO_XENIX 
NLIB=	-lmalloc -lx

# Case 5: sco Xenix-286
#VTREE=vtreeL
#SYS=	-Ox -CSON -DSCO_XENIX  -DMEMORY_BASED -Ml2 -F 8000
#NLIB=	-lmalloc -lx


#	Standard things you may wish to change:
#
#	INSTALL		directory to install vtree in

INSTALL	=	/usr/local/bin

#	MANDIR		manual page directoryr
#			(the .L is used on Xenix systems.  Other systems will
#			be different)

MANDIR =	/u/man/man.L

#	MANEND		end of man page file name

MANEND =	L

#	The following OPTIONS may be defined:
#
#	LSTAT		we have the lstat(2) system call (BSD only)
#	HSTATS		print hashing statistics at end of run
#	ONEPERLINE	On the first line only, if there are more than
#			one directory listed, print it on a line by itself
#			and print the last subdirectory on the first line
#			of the tree
#	MEMORY_BASED	Keep the tree structure in memory for added speed.
#
#	Compile time options:

OPTIONS	= -DMEMORY_BASED

#  END OF USER-DEFINED OPTIONS


CFLAGS=	-O $(SYS) $(OPTIONS)
SRCS=		vtree.c	hash.c	direct.c	\
		hash.h	customize.h	patchlevel.h
OBJS=		vtree.o	hash.o

$(VTREE):		$(OBJS)
		$(CC) -o $(VTREE) $(CFLAGS) $(OBJS) $(NLIB)

install:	$(VTREE)
		cp $(VTREE) $(INSTALL)
		cp vtree.1 $(MANDIR)/vtree.$(MANEND)
#		chown local $(INSTALL)/$(VTREE)
#		chgrp pd $(INSTALL)/$(VTREE)
#		chmod 755 $(INSTALL)/$(VTREE)

clean:
		rm -f $(OBJS) $(VTREE)

vtree.o:	vtree.c direct.c hash.h customize.h patchlevel.h

hash.o:		hash.c hash.h customize.h patchlevel.h

shar:		;
		rm -f *.o vtree *- vtree.shr
		shar * >/tmp/vtree.shr
		mv /tmp/vtree.shr .

