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