#	$Id: Makefile,v 1.1 91/11/22 09:21:07 abe Exp $
#
#	Makefile for lsof(8L)
#
#	Victor A. Abell <abe@mace.cc.purdue.edu>
#	Purdue University Computing Center (PUCC)

# Note: the following cpp (or equivalent) definitions are assumed.
#
#       AIX 3.1.[357]           -D_IBMR2
#       HP-UX 7.x               -Dhpux
#       HP-UX 8.x               -Dhpux
#       Purdue DYNIX 3.0.12     -DDYNIX
#       Sequent DYNIX 3.0.12    -DDYNIX
#       NeXTStep 2.1            -DNeXT
#       SunOS 4.1.1             -Dsun
#
# See SYSDEFS for other, specific definitions that may be required.
#
# Hint: see if there is a specific Makefile.<system> rule that is
#       suitable for your installation -- e. g., Makefile.hpux7 or
#       Makefile.sun.

# Some make(1)'s need to be told explicitly what shell to use.

SHELL= /bin/sh

# Define system-specific values in SYSDEFS.
#
#	System			Needs
#       HP-UX 7.x               SYSDEFS= -DHPUX7
#       HP-UX 8.x               SYSDEFS= -DHPUX8
#       Sequent DYNIX 3.0.12    SYSDEFS= -DSEQUENT

SYSDEFS=

BIN= ${DESTDIR}/usr/local/etc
DOC= ${DESTDIR}/usr/man
GRP= kmem

DEBUG= -O

# If your HP-UX hp9000s800 system does not have the <sys/fss.h> header
# file, add ``-I.'' to CDEFS -- e. g.,
#
# CDEFS= -I.

CDEFS=

CFLAGS= ${DEBUG} ${CDEFS} ${SYSDEFS}

# Define a special loader library.
#
# 	System			Needs
#	HPUX7			LDLIB= -lBSD
#	SunOS			LDLIB= -lkvm

LDLIB=

HDR=
SRC= lsof.c
DEP= ${SRC}
MAN= lsof.8
OBJ= lsof.o
SOURCE= Makefile ${HDR} ${SRC}

all: lsof

clean: FRC
	rm -f Makefile.* lsof *.o a.out core errs tags

# The depend rule assumes the availability of PUCC's dependency generator.

depend: ${SRC} ${HDR} FRC
	maketd ${CDEFS} ${DEP}

install: lsof FRC
	install -c -s -m 2755 -g ${GRP} lsof ${BIN}

lint: ${SRC} ${HDR} FRC
	lint ${CDEFS} ${DEP}

lsof: ${OBJ}
	${CC} -o $@ ${CFLAGS} ${OBJ} ${LDLIB}

# Generate Makefile for IBM RISC/System 6000.

Makefile.ibmr2: Makefile
	sed -e 's@^GRP= kmem@GRP= system@' <Makefile >$@

# Generate Makefile for HP-UX 7.x.

Makefile.hpux7: Makefile
	sed -e 's@^LDLIB=@LDLIB= -lBSD@' -e 's@^SYSDEFS=@SYSDEFS= -DHPUX7@' <Makefile >$@

# Generate Makefile for HP-UX 8.x.

Makefile.hpux8: Makefile
	sed -e 's@^SYSDEFS=@SYSDEFS= -DHPUX8@' <Makefile >$@

# Generate Makefile for NeXTStep 2.[01].

Makefile.next2: Makefile
	sed -e 's@^GRP= kmem@GRP= operator@' <Makefile >$@

# Generate Makefile for Sequent's version of DYNIX.

Makefile.sequent: Makefile
	sed -e 's@^SYSDEFS=@SYSDEFS= -DSEQUENT@' <Makefile >$@

# Generate Makefile for SunOS 4.1.1.

Makefile.sun: Makefile
	sed -e 's@^LDLIB=@LDLIB= -lkvm@' <Makefile >$@

# The mkcat rule assumes the availability of PUCC's manual page handler.

mkcat: ${MAN} ${DOC} FRC
	mkcat -r${DOC} ${MAN}

print: source FRC
	lpr -J'lsof source' ${SOURCE}

source: ${SOURCE} FRC

# The following rule assumes the use of RCS.

spotless: clean
	rcsclean ${SOURCE}

tags: ${SRC} ${HDR} FRC
	ctags -t ${SRC} ${HDR}

# The following rule assumes the use of RCS.

${SOURCE}:
	co -q $@

FRC:

# DO NOT DELETE THIS LINE - maketd DEPENDS ON IT

lsof.o: lsof.c

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