xref: /titanic_51/usr/src/cmd/ptools/Makefile.bld (revision 9acbbeaf2a1ffe5c14b244867d427714fab43c5c)
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
5c6402783Sakolb# Common Development and Distribution License (the "License").
6c6402783Sakolb# 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#
21c6402783Sakolb
227c478bd9Sstevel@tonic-gate#
23c6402783Sakolb# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gatePROG:sh = basename `cd ..; pwd`
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gateOBJS = $(PROG).o
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gateSRCS = ../$(PROG).c
337c478bd9Sstevel@tonic-gate
347c478bd9Sstevel@tonic-gateFILEMODE = 0555
357c478bd9Sstevel@tonic-gateGROUP = bin
367c478bd9Sstevel@tonic-gate
377c478bd9Sstevel@tonic-gate# libproc is added individually as pwait doesn't need it.
387c478bd9Sstevel@tonic-gate# These are defined this way so lint can use them
397c478bd9Sstevel@tonic-gateLDLIBS_pargs	= -lproc
407c478bd9Sstevel@tonic-gateLDLIBS_pcred	= -lproc
417c478bd9Sstevel@tonic-gateLDLIBS_pfiles	= -lproc -lnsl
427c478bd9Sstevel@tonic-gateLDLIBS_pflags	= -lproc
437c478bd9Sstevel@tonic-gateLDLIBS_pldd	= -lproc
44c6402783SakolbLDLIBS_plgrp	= -lproc -llgrp
45*9acbbeafSnn35248LDLIBS_pmap	= -lproc -lzonecfg
46c6402783SakolbLDLIBS_pmadvise	= -lproc
477c478bd9Sstevel@tonic-gateLDLIBS_ppriv	= -lproc
487c478bd9Sstevel@tonic-gateLDLIBS_preap	= -lproc
497c478bd9Sstevel@tonic-gateLDLIBS_prun	= -lproc
507c478bd9Sstevel@tonic-gateLDLIBS_psig	= -lproc
517c478bd9Sstevel@tonic-gateLDLIBS_pstack	= -lproc -lc_db
527c478bd9Sstevel@tonic-gateLDLIBS_pstop	= -lproc
537c478bd9Sstevel@tonic-gateLDLIBS_ptime	= -lproc
547c478bd9Sstevel@tonic-gateLDLIBS_ptree	= -lproc -lcontract
557c478bd9Sstevel@tonic-gateLDLIBS_pwdx	= -lproc
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gateLDLIBS += $(LDLIBS_$(PROG))
587c478bd9Sstevel@tonic-gate
597c478bd9Sstevel@tonic-gate# pargs requires to link with ../../common/elfcap components
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gateELFCAP =	$(SRC)/common/elfcap
627c478bd9Sstevel@tonic-gate
637c478bd9Sstevel@tonic-gateCPPFLAGS_pargs =-DCAP_UPPERCASE -I$(ELFCAP)
647c478bd9Sstevel@tonic-gateOBJS_pargs =	elfcap.o
657c478bd9Sstevel@tonic-gateSRCS_pargs =	$(ELFCAP)/elfcap.c
667c478bd9Sstevel@tonic-gate
677c478bd9Sstevel@tonic-gateCPPFLAGS +=	$(CPPFLAGS_$(PROG))
687c478bd9Sstevel@tonic-gateOBJS +=		$(OBJS_$(PROG))
697c478bd9Sstevel@tonic-gateSRCS +=		$(SRCS_$(PROG))
707c478bd9Sstevel@tonic-gate
717c478bd9Sstevel@tonic-gateelfcap.o:	$(ELFCAP)/elfcap.c
727c478bd9Sstevel@tonic-gate		$(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
737c478bd9Sstevel@tonic-gate
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gateINSTALL_NEW=
767c478bd9Sstevel@tonic-gateINSTALL_LEGACY=$(RM) $(ROOTPROCBINSYMLINK) ; \
777c478bd9Sstevel@tonic-gate	$(LN) -s ../../bin/$(PROG) $(ROOTPROCBINSYMLINK)
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gate.KEEP_STATE:
807c478bd9Sstevel@tonic-gate
817c478bd9Sstevel@tonic-gate%.o:	../%.c
827c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
837c478bd9Sstevel@tonic-gate
847c478bd9Sstevel@tonic-gateall:	$(PROG)
857c478bd9Sstevel@tonic-gate
867c478bd9Sstevel@tonic-gateROOTBINPROG=$(ROOTBIN)/$(PROG)
877c478bd9Sstevel@tonic-gateROOTPROCBINSYMLINK=$(ROOT)/usr/proc/bin/$(PROG)
887c478bd9Sstevel@tonic-gate
897c478bd9Sstevel@tonic-gate$(PROG): $$(OBJS)
907c478bd9Sstevel@tonic-gate	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
917c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gate#
947c478bd9Sstevel@tonic-gate# Install the ptool, symlinking it into /usr/proc/bin if PTOOL_TYPE is set
957c478bd9Sstevel@tonic-gate# to LEGACY.
967c478bd9Sstevel@tonic-gate#
977c478bd9Sstevel@tonic-gateinstall: all $(ROOTISAPROG)
987c478bd9Sstevel@tonic-gate	-$(RM) $(ROOTBINPROG)
997c478bd9Sstevel@tonic-gate	-$(LN) $(ISAEXEC) $(ROOTBINPROG)
1007c478bd9Sstevel@tonic-gate	-$(INSTALL_$(PTOOL_TYPE))
1017c478bd9Sstevel@tonic-gate
1027c478bd9Sstevel@tonic-gateclean:
1037c478bd9Sstevel@tonic-gate	$(RM) $(OBJS)
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gatelint:
1067c478bd9Sstevel@tonic-gate	$(LINT.c) $(SRCS) $(LDLIBS)
107