PROG=	lsof

I=/usr/include
S=/usr/include/sys
L=/usr/include/local
P=

DEBUG=	-O

CDEF=	-Dsun
CDEFS=  ${CDEF} ${CFGF}
INCL=	${DINC}
CFLAGS= ${DEBUG} ${CDEFS} ${INCL}

HDR=    lsof.h lsof_fields.h dlsof.h machine.h proto.h dproto.h

SRC=    ddev.c dfile.c dmnt.c dnode.c dproc.c dsock.c dstore.c \
	arg.c main.c misc.c node.c print.c proc.c store.c

OBJ=	ddev.o dfile.o dmnt.o dnode.o dproc.o dsock.o dstore.o \
	arg.o main.o misc.o node.o print.o proc.o store.o

MAN=	lsof.8

OTHER=	

SOURCE=	Makefile ${OTHER} ${MAN} ${HDR} ${SRC}

all: ${PROG}

${PROG}:$P ${OBJ}
	${CC} -o $@ ${CFLAGS} ${OBJ} ${CFGL}

clean: FRC
	rm -f Makefile.bak ${PROG} a.out core errs lint.out tags *.o version.h

install: all FRC
	@echo ''
	@echo 'Please write your own install rule.  Lsof should be installed'
	@echo 'setgid to the group that can can read /dev/kmem.  Normally'
	@echo 'that is the kmem group.  Your install rule actions might look'
	@echo 'something like this:'
	@echo ''
	@echo '  install <options> -m 2755 -g kmem ${PROG} <binary_destination>'
	@echo '  install <options> -m 444 ${MAN} <man_destination>'
	@echo ''
	@echo 'You may have to put additional values in <options>, as required'
	@echo 'by the install application in your version of SunOS or Solaris.'
	@echo 'You will have to set the appropriate destination for the lsof'
	@echo 'executable in <binary_destination>; the appropriate destination'
	@echo 'for the man page in <man_destination>.'
	@echo ''

version.h:	version
	sed '/VN/s/.ds VN \(.*\)/#define VERSION "\1"/' < version > version.h

FRC:

# DO NOT DELETE THIS LINE - make depend DEPENDS ON IT

ddev.o:		${HDR} ddev.c

dfile.o:	${HDR} dfile.c

dmnt.o:		${HDR} dmnt.c

dnode.o:	${HDR} dnode.c

dproc.o:	${HDR} kernelbase.h dproc.c

dsock.o:	${HDR} dsock.c

dstore.o:	${HDR} dstore.c

arg.o:		${HDR} version.h arg.c

main.o:		${HDR} main.c

misc.o:		${HDR} misc.c

node.o:		${HDR} node.c

print.o:	${HDR} print.c

proc.o:		${HDR} proc.c

store.o:	${HDR} store.c

# *** Do not add anything here - It will go away. ***
