xref: /freebsd/usr.bin/netstat/Makefile (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1.include <src.opts.mk>
2
3PROG=	netstat
4SRCS=	if.c inet.c main.c mbuf.c mroute.c netisr.c nl_symbols.c route.c \
5	unix.c mroute6.c ipsec.c bpf.c pfkey.c sctp.c common.c nhops.c nhgrp.c \
6	nl_defs.h
7
8nl_symbols.c: nlist_symbols
9	awk '\
10	    BEGIN { \
11		print "#include <sys/param.h>"; \
12		print "#include <nlist.h>"; \
13		print "struct nlist nl[] = {"; \
14	    } \
15	    !/^\#/ { printf("\t{ .n_name = \"%s\" },\n", $$2); } \
16	    END { print "\t{ .n_name = NULL },\n};" } \
17	    ' < ${.ALLSRC} > ${.TARGET} || rm -f ${.TARGET}
18nl_defs.h: nlist_symbols
19	awk '\
20	    BEGIN { \
21		print "#include <nlist.h>"; \
22		print "extern struct nlist nl[];"; \
23		i = 0; \
24	    } \
25	    !/^\#/ { printf("\#define\tN%s\t%s\n", toupper($$2), i++); }' \
26	    < ${.ALLSRC} > ${.TARGET} || rm -f ${.TARGET}
27CLEANFILES+=	nl_symbols.c nl_defs.h
28CFLAGS+=	-I${.OBJDIR}
29
30WARNS?=	3
31CFLAGS+=-fno-strict-aliasing
32
33CFLAGS+=-DIPSEC
34CFLAGS+=-DSCTP
35
36.if ${MK_INET_SUPPORT} != "no"
37CFLAGS+=-DINET
38.endif
39
40.if ${MK_INET6_SUPPORT} != "no"
41SRCS+=	inet6.c
42CFLAGS+=-DINET6
43.endif
44
45.if ${MK_OFED} != "no"
46CFLAGS+=-DSDP
47.endif
48
49.if ${MK_PF} != "no"
50CFLAGS+=-DPF
51.endif
52
53BINGRP=	kmem
54BINMODE=2555
55LIBADD=	kvm memstat xo util
56
57.if ${MK_NETGRAPH_SUPPORT} != "no"
58SRCS+=	netgraph.c
59LIBADD+=	netgraph
60CFLAGS+=-DNETGRAPH
61.endif
62
63.if ${MK_NETLINK_SUPPORT} != "no"
64SRCS+=	route_netlink.c
65.else
66CFLAGS+=-DWITHOUT_NETLINK
67.endif
68
69.if ${MK_JAIL} != "no" && !defined(RESCUE)
70CFLAGS+= -DJAIL
71LIBADD+= jail
72.endif
73
74.include <bsd.prog.mk>
75