xref: /freebsd/usr.bin/netstat/Makefile (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
1c6063d0dSWarner Losh.include <src.opts.mk>
2e1fe3dbaSRuslan Ermilov
39b50d902SRodney W. GrimesPROG=	netstat
481dacd8bSHiroki SatoSRCS=	if.c inet.c main.c mbuf.c mroute.c netisr.c nl_symbols.c route.c \
5fedeb08bSAlexander V. Chernikov	unix.c mroute6.c ipsec.c bpf.c pfkey.c sctp.c common.c nhops.c nhgrp.c \
6ae69ad88SBjoern A. Zeeb	nl_defs.h
781dacd8bSHiroki Sato
881dacd8bSHiroki Satonl_symbols.c: nlist_symbols
981dacd8bSHiroki Sato	awk '\
1081dacd8bSHiroki Sato	    BEGIN { \
1181dacd8bSHiroki Sato		print "#include <sys/param.h>"; \
1281dacd8bSHiroki Sato		print "#include <nlist.h>"; \
1381dacd8bSHiroki Sato		print "struct nlist nl[] = {"; \
1481dacd8bSHiroki Sato	    } \
1581dacd8bSHiroki Sato	    !/^\#/ { printf("\t{ .n_name = \"%s\" },\n", $$2); } \
1681dacd8bSHiroki Sato	    END { print "\t{ .n_name = NULL },\n};" } \
1781dacd8bSHiroki Sato	    ' < ${.ALLSRC} > ${.TARGET} || rm -f ${.TARGET}
1881dacd8bSHiroki Satonl_defs.h: nlist_symbols
1981dacd8bSHiroki Sato	awk '\
2081dacd8bSHiroki Sato	    BEGIN { \
2181dacd8bSHiroki Sato		print "#include <nlist.h>"; \
2281dacd8bSHiroki Sato		print "extern struct nlist nl[];"; \
2381dacd8bSHiroki Sato		i = 0; \
2481dacd8bSHiroki Sato	    } \
2581dacd8bSHiroki Sato	    !/^\#/ { printf("\#define\tN%s\t%s\n", toupper($$2), i++); }' \
2681dacd8bSHiroki Sato	    < ${.ALLSRC} > ${.TARGET} || rm -f ${.TARGET}
2781dacd8bSHiroki SatoCLEANFILES+=	nl_symbols.c nl_defs.h
2881dacd8bSHiroki SatoCFLAGS+=	-I${.OBJDIR}
297f1a7653SXin LI
30096146f8SYaroslav TykhiyWARNS?=	3
310aad0f22SJohn BirrellCFLAGS+=-fno-strict-aliasing
327f1a7653SXin LI
3332cd1d96SJun-ichiro itojun HaginoCFLAGS+=-DIPSEC
3474fd40c9SRandall StewartCFLAGS+=-DSCTP
35b7dd94d5SYaroslav Tykhiy
363dcc856bSMichael Tuexen.if ${MK_INET_SUPPORT} != "no"
373dcc856bSMichael TuexenCFLAGS+=-DINET
383dcc856bSMichael Tuexen.endif
393dcc856bSMichael Tuexen
40f18f2fc7SCeri Davies.if ${MK_INET6_SUPPORT} != "no"
41f18f2fc7SCeri DaviesSRCS+=	inet6.c
42f18f2fc7SCeri DaviesCFLAGS+=-DINET6
43f18f2fc7SCeri Davies.endif
4463bf4575SJulian Elischer
45aa0a1e58SJeff Roberson.if ${MK_OFED} != "no"
46aa0a1e58SJeff RobersonCFLAGS+=-DSDP
47aa0a1e58SJeff Roberson.endif
48aa0a1e58SJeff Roberson
493e4d5cd3SGleb Smirnoff.if ${MK_PF} != "no"
503e4d5cd3SGleb SmirnoffCFLAGS+=-DPF
513e4d5cd3SGleb Smirnoff.endif
523e4d5cd3SGleb Smirnoff
539b50d902SRodney W. GrimesBINGRP=	kmem
549b50d902SRodney W. GrimesBINMODE=2555
55d1a0d267SMarcel MoolenaarLIBADD=	kvm memstat xo util
56690f477dSSam Leffler
57690f477dSSam Leffler.if ${MK_NETGRAPH_SUPPORT} != "no"
58690f477dSSam LefflerSRCS+=	netgraph.c
593e11bd9eSBaptiste DaroussinLIBADD+=	netgraph
60690f477dSSam LefflerCFLAGS+=-DNETGRAPH
61690f477dSSam Leffler.endif
629b50d902SRodney W. Grimes
6364dfea86SAlexander V. Chernikov.if ${MK_NETLINK_SUPPORT} != "no"
6464dfea86SAlexander V. ChernikovSRCS+=	route_netlink.c
6564dfea86SAlexander V. Chernikov.else
6664dfea86SAlexander V. ChernikovCFLAGS+=-DWITHOUT_NETLINK
6764dfea86SAlexander V. Chernikov.endif
6864dfea86SAlexander V. Chernikov
69*182e8ae2SDoug Rabson.if ${MK_JAIL} != "no" && !defined(RESCUE)
70*182e8ae2SDoug RabsonCFLAGS+= -DJAIL
71*182e8ae2SDoug RabsonLIBADD+= jail
72*182e8ae2SDoug Rabson.endif
73*182e8ae2SDoug Rabson
749b50d902SRodney W. Grimes.include <bsd.prog.mk>
75