172952Srwatson# $FreeBSD$
224143Sjoerg
324143SjoergTOPDIR=	${.CURDIR}/../../contrib/top
4164784Skeramida.PATH: ${TOPDIR}
524143Sjoerg
6164784SkeramidaPROG=	top
7164784SkeramidaSRCS=	commands.c display.c machine.c screen.c top.c \
8164784Skeramida	username.c utils.c version.c
9164784SkeramidaSRCS+=	sigdesc.h top.local.h
10164784SkeramidaCFLAGS+= -DHAVE_GETOPT -DHAVE_STRERROR -DORDER
11164784SkeramidaCFLAGS+= -I${.CURDIR} -I${TOPDIR} -I.
1224143Sjoerg
13201386SedWARNS?=	0
14201386Sed
1524143Sjoerg#
1624143Sjoerg# The table size should be a prime number approximately twice as
1724143Sjoerg# large as the number of lines in /etc/passwd.  The default number
18164784Skeramida# is 20011; use /etc/make.conf to override this.
1924143Sjoerg#
2024143Sjoerg.if defined(TOP_TABLE_SIZE)
2124143SjoergCFLAGS+= -D"Table_size=${TOP_TABLE_SIZE}"
2224143Sjoerg.endif
2324143Sjoerg
24266280SbdreweryDPADD=	${LIBTERMCAP} ${LIBM} ${LIBKVM} ${LIBJAIL}
25266280SbdreweryLDADD=	-ltermcap -lm -lkvm -ljail
2624143Sjoerg
27164784SkeramidaCLEANFILES= sigdesc.h
28164784SkeramidaSIGCONV_AWK= ${.CURDIR}/../../contrib/top/sigconv.awk
29164784SkeramidaSIGNAL_H= ${DESTDIR}/usr/include/sys/signal.h
30164784Skeramidasigdesc.h: ${SIGCONV_AWK} ${SIGNAL_H}
31164784Skeramida	awk -f ${SIGCONV_AWK} < ${SIGNAL_H} > ${.TARGET}
3224143Sjoerg
33164784SkeramidaCLEANFILES+= top.local.h top.x
34284484Smarcel.SUFFIXES: .xs .x .hs .h
35284484Smarcel.xs.x .hs.h:
3679636Sru	@${ECHO} Making ${.TARGET} from ${.IMPSRC}
3779636Sru	@sed -e's,%LoadMax%,5.0,g' \
3879636Sru	-e's,%TableSize%,20011,g' \
3979636Sru	-e's,%NominalTopn%,18,g' \
4079636Sru	-e's,%topn%,-1,g' \
4179636Sru	-e's,%delay%,2,g' \
4279636Sru	-e's,%random%,1,g' \
4379636Sru	${.IMPSRC} > ${.TARGET}
4479636Sru
45164784SkeramidaCLEANFILES+= top.1
46164784Skeramidatop.1: top.x top.local.1
47164784Skeramida	cat ${.ALLSRC} > ${.TARGET}
48164784Skeramida
4924143Sjoerg.include <bsd.prog.mk>
50