summaryrefslogtreecommitdiff
path: root/usr.bin/netstat/Makefile
blob: febab940be4acfea4a81df31d0132a1a66f93104 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#	@(#)Makefile	8.1 (Berkeley) 6/12/93
# $FreeBSD$

.include <src.opts.mk>

PROG=	netstat
SRCS=	if.c inet.c main.c mbuf.c mroute.c netisr.c nl_symbols.c route.c \
	unix.c mroute6.c ipsec.c bpf.c pfkey.c sctp.c common.c nhops.c nhgrp.c \
	nl_defs.h

nl_symbols.c: nlist_symbols
	awk '\
	    BEGIN { \
		print "#include <sys/param.h>"; \
		print "#include <nlist.h>"; \
		print "struct nlist nl[] = {"; \
	    } \
	    !/^\#/ { printf("\t{ .n_name = \"%s\" },\n", $$2); } \
	    END { print "\t{ .n_name = NULL },\n};" } \
	    ' < ${.ALLSRC} > ${.TARGET} || rm -f ${.TARGET}
nl_defs.h: nlist_symbols
	awk '\
	    BEGIN { \
		print "#include <nlist.h>"; \
		print "extern struct nlist nl[];"; \
		i = 0; \
	    } \
	    !/^\#/ { printf("\#define\tN%s\t%s\n", toupper($$2), i++); }' \
	    < ${.ALLSRC} > ${.TARGET} || rm -f ${.TARGET}
CLEANFILES+=	nl_symbols.c nl_defs.h
CFLAGS+=	-I${.OBJDIR}

WARNS?=	3
CFLAGS+=-fno-strict-aliasing

CFLAGS+=-DIPSEC
CFLAGS+=-DSCTP

.if ${MK_INET_SUPPORT} != "no"
CFLAGS+=-DINET
.endif

.if ${MK_INET6_SUPPORT} != "no"
SRCS+=	inet6.c
CFLAGS+=-DINET6
.endif

.if ${MK_OFED} != "no"
CFLAGS+=-DSDP
.endif

.if ${MK_PF} != "no"
CFLAGS+=-DPF
.endif

BINGRP=	kmem
BINMODE=2555
LIBADD=	kvm memstat xo util

.if ${MK_NETGRAPH_SUPPORT} != "no"
SRCS+=	netgraph.c
LIBADD+=	netgraph
CFLAGS+=-DNETGRAPH
.endif

.include <bsd.prog.mk>