xref: /f-stack/tools/netstat/Makefile (revision d4a07e70)
1#	@(#)Makefile	8.1 (Berkeley) 6/12/93
2# $FreeBSD$
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
9TOPDIR?=${CURDIR}/../..
10include ${TOPDIR}/tools/opts.mk
11
12CLEANFILES+=	nl_symbols.c nl_defs.h
13
14LIBADD=util memstat xo
15
16WARNS?=	3
17CFLAGS+=-fno-strict-aliasing
18
19ifneq (${MK_IPSEC_SUPPORT},"no")
20CFLAGS+=-DIPSEC
21endif
22CFLAGS+=-DSCTP
23
24ifneq (${MK_INET_SUPPORT},"no")
25CFLAGS+=-DINET
26endif
27
28ifneq (${MK_INET6_SUPPORT},"no")
29SRCS+=	inet6.c
30CFLAGS+=-DINET6
31endif
32
33ifneq (${MK_OFED},"no")
34CFLAGS+=-DSDP
35endif
36
37ifneq (${MK_PF},"no")
38CFLAGS+=-DPF
39endif
40
41BINGRP=	kmem
42BINMODE=2555
43
44ifneq (${MK_NETGRAPH_SUPPORT},"no")
45SRCS+=	netgraph.c
46LIBADD+=	netgraph
47CFLAGS+=-DNETGRAPH
48endif
49
50include ${TOPDIR}/tools/prog.mk
51
52nl_symbols.c: nlist_symbols
53	awk '\
54	    BEGIN { \
55		print "#include <sys/param.h>"; \
56		print "#include <nlist.h>"; \
57		print "struct nlist nl[] = {"; \
58	    } \
59	    !/^\#/ { printf("\t{ .n_name = \"%s\" },\n", $$2); } \
60	    END { print "\t{ .n_name = NULL },\n};" } \
61	    ' < $^ > $@
62
63nl_defs.h: nlist_symbols
64	awk '\
65	    BEGIN { \
66		print "#include <nlist.h>"; \
67		print "extern struct nlist nl[];"; \
68		i = 0; \
69	    } \
70	    !/^\#/ { printf("\#define\tN%s\t%s\n", toupper($$2), i++); }' \
71            < $^ > $@
72
73