xref: /freebsd/usr.bin/top/Makefile (revision 63d1fd5970ec814904aa0f4580b10a0d302d08b2)
1# $FreeBSD$
2
3TOPDIR=	${.CURDIR}/../../contrib/top
4.PATH: ${TOPDIR}
5
6PROG=	top
7SRCS=	commands.c display.c machine.c screen.c top.c \
8	username.c utils.c version.c
9SRCS+=	sigdesc.h top.local.h
10CFLAGS+= -DHAVE_GETOPT -DHAVE_STRERROR -DORDER
11CFLAGS+= -I${.CURDIR} -I${TOPDIR} -I.
12
13WARNS?=	0
14
15#
16# The table size should be a prime number approximately twice as
17# large as the number of lines in /etc/passwd.  The default number
18# is 20011; use /etc/make.conf to override this.
19#
20.if defined(TOP_TABLE_SIZE)
21CFLAGS+= -D"Table_size=${TOP_TABLE_SIZE}"
22.endif
23
24LIBADD=	ncursesw m kvm jail
25
26CLEANFILES= sigdesc.h
27SIGCONV_AWK= ${.CURDIR}/../../contrib/top/sigconv.awk
28STAGED_INCLUDE_DIR?= ${DESTDIR}/usr/include
29SIGNAL_H= ${STAGED_INCLUDE_DIR}/sys/signal.h
30sigdesc.h: ${SIGCONV_AWK} ${SIGNAL_H}
31	awk -f ${SIGCONV_AWK} < ${SIGNAL_H} > ${.TARGET}
32
33CLEANFILES+= top.local.h top.x
34.SUFFIXES: .xs .x .hs .h
35.xs.x .hs.h:
36	@${ECHO} Making ${.TARGET} from ${.IMPSRC}
37	@sed -e's,%LoadMax%,5.0,g' \
38	-e's,%TableSize%,20011,g' \
39	-e's,%NominalTopn%,18,g' \
40	-e's,%topn%,-1,g' \
41	-e's,%delay%,2,g' \
42	-e's,%random%,1,g' \
43	${.IMPSRC} > ${.TARGET}
44
45CLEANFILES+= top.1
46top.1: top.x top.local.1
47	cat ${.ALLSRC} > ${.TARGET}
48
49.include <bsd.prog.mk>
50