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