17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
545916cd2Sjpk# Common Development and Distribution License (the "License").
645916cd2Sjpk# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
2226fd7700SKrishnendu Sadhukhan - Sun Microsystems# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate# Copyright (c) 1990 Mentat Inc.
267c478bd9Sstevel@tonic-gate#
275661bb76SJohn Levon# Copyright (c) 2018, Joyent, Inc.
28*78a2e113SAndy Fiddaman# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gatePROG=		netstat
317c478bd9Sstevel@tonic-gate
32*78a2e113SAndy FiddamanLOCALOBJS=	netstat.o
337c478bd9Sstevel@tonic-gateCOMMONOBJS=	compat.o
347c478bd9Sstevel@tonic-gate
357c478bd9Sstevel@tonic-gateinclude ../../../Makefile.cmd
36*78a2e113SAndy Fiddaman# netstat uses libproc to grab processes and extract information about their
37*78a2e113SAndy Fiddaman# sockets. In order to be able to grab 64-bit processes, netstat itself must
38*78a2e113SAndy Fiddaman# be built 64-bit.
39*78a2e113SAndy Fiddaman$(BUILD64) include ../../../Makefile.cmd.64
40*78a2e113SAndy Fiddaman
417c478bd9Sstevel@tonic-gateinclude ../../Makefile.cmd-inet
427c478bd9Sstevel@tonic-gate
437c478bd9Sstevel@tonic-gateLOCALSRCS=	$(LOCALOBJS:%.o=%.c)
447c478bd9Sstevel@tonic-gateCOMMONSRCS=	$(CMDINETCOMMONDIR)/$(COMMONOBJS:%.o=%.c)
457c478bd9Sstevel@tonic-gate
4626fd7700SKrishnendu Sadhukhan - Sun MicrosystemsSTATCOMMONDIR = $(SRC)/cmd/stat/common
4726fd7700SKrishnendu Sadhukhan - Sun Microsystems
4826fd7700SKrishnendu Sadhukhan - Sun MicrosystemsSTAT_COMMON_OBJS = timestamp.o
4926fd7700SKrishnendu Sadhukhan - Sun MicrosystemsSTAT_COMMON_SRCS = $(STAT_COMMON_OBJS:%.o=$(STATCOMMONDIR)/%.c)
5026fd7700SKrishnendu Sadhukhan - Sun Microsystems
5126fd7700SKrishnendu Sadhukhan - Sun MicrosystemsOBJS=		$(LOCALOBJS) $(COMMONOBJS) $(STAT_COMMON_OBJS)
5226fd7700SKrishnendu Sadhukhan - Sun MicrosystemsSRCS=		$(LOCALSRCS) $(COMMONSRCS) $(STAT_COMMON_SRCS)
5326fd7700SKrishnendu Sadhukhan - Sun Microsystems
5426fd7700SKrishnendu Sadhukhan - Sun MicrosystemsCPPFLAGS += -DNDEBUG -I$(CMDINETCOMMONDIR) -I$(STATCOMMONDIR)
55*78a2e113SAndy FiddamanLDLIBS += -ldhcpagent -lsocket -lnsl -lkstat -ltsnet -ltsol -lproc
567c478bd9Sstevel@tonic-gate
57*78a2e113SAndy FiddamanCSTD=		$(CSTD_GNU99)
585661bb76SJohn Levon
597c478bd9Sstevel@tonic-gate.KEEP_STATE:
607c478bd9Sstevel@tonic-gate
615661bb76SJohn Levonall: $(PROG) $(NPROG)
627c478bd9Sstevel@tonic-gate
637c478bd9Sstevel@tonic-gateROOTPROG=   $(PROG:%=$(ROOTBIN)/%)
647c478bd9Sstevel@tonic-gate
657c478bd9Sstevel@tonic-gate$(PROG): $(OBJS)
667c478bd9Sstevel@tonic-gate	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
677c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
687c478bd9Sstevel@tonic-gate
6926fd7700SKrishnendu Sadhukhan - Sun Microsystems%.o : $(STATCOMMONDIR)/%.c
7026fd7700SKrishnendu Sadhukhan - Sun Microsystems	$(COMPILE.c) -o $@ $<
7126fd7700SKrishnendu Sadhukhan - Sun Microsystems	$(POST_PROCESS_O)
7226fd7700SKrishnendu Sadhukhan - Sun Microsystems
73*78a2e113SAndy Fiddamaninstall: all $(ROOTPROG)
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gateclean:
767c478bd9Sstevel@tonic-gate	$(RM) $(OBJS)
777c478bd9Sstevel@tonic-gate
787c478bd9Sstevel@tonic-gateinclude ../../../Makefile.targ
797c478bd9Sstevel@tonic-gate
80