summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat/Makefile
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2015-09-02 18:51:36 +0000
committerhrs <hrs@FreeBSD.org>2015-09-02 18:51:36 +0000
commit07e5aa0065f06f476317da8415d66994ec2d47e2 (patch)
tree80d11a12601882e893628fa58ab4a9d052ad4751 /usr.bin/netstat/Makefile
parent2d45fb7584109113be7fd7da0121791625264acc (diff)
downloadFreeBSD-src-07e5aa0065f06f476317da8415d66994ec2d47e2.zip
FreeBSD-src-07e5aa0065f06f476317da8415d66994ec2d47e2.tar.gz
Simplify kvm symbol resolution and error handling. The symbol table
nl_symbols will eventually be organized into several modules depending on MK_* variables.
Diffstat (limited to 'usr.bin/netstat/Makefile')
-rw-r--r--usr.bin/netstat/Makefile25
1 files changed, 24 insertions, 1 deletions
diff --git a/usr.bin/netstat/Makefile b/usr.bin/netstat/Makefile
index 0572a03..abfebf4 100644
--- a/usr.bin/netstat/Makefile
+++ b/usr.bin/netstat/Makefile
@@ -4,9 +4,32 @@
.include <src.opts.mk>
PROG= netstat
-SRCS= if.c inet.c main.c mbuf.c mroute.c netisr.c route.c \
+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 \
flowtable.c
+DPSRCS= 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
OpenPOWER on IntegriCloud