xref: /titanic_51/usr/src/cmd/ptools/Makefile.bld (revision 24fe0b3bf671e123467ce1df0b67cadd3614c8e4)
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#
23*24fe0b3bSjmcp# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gatePROG:sh = basename `cd ..; pwd`
287c478bd9Sstevel@tonic-gate
297c478bd9Sstevel@tonic-gateOBJS = $(PROG).o
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gateSRCS = ../$(PROG).c
327c478bd9Sstevel@tonic-gate
337c478bd9Sstevel@tonic-gateFILEMODE = 0555
347c478bd9Sstevel@tonic-gate
357c478bd9Sstevel@tonic-gate# libproc is added individually as pwait doesn't need it.
367c478bd9Sstevel@tonic-gate# These are defined this way so lint can use them
377c478bd9Sstevel@tonic-gateLDLIBS_pargs	= -lproc
387c478bd9Sstevel@tonic-gateLDLIBS_pcred	= -lproc
397c478bd9Sstevel@tonic-gateLDLIBS_pfiles	= -lproc -lnsl
407c478bd9Sstevel@tonic-gateLDLIBS_pflags	= -lproc
417c478bd9Sstevel@tonic-gateLDLIBS_pldd	= -lproc
42c6402783SakolbLDLIBS_plgrp	= -lproc -llgrp
43c2b5bce0Ssp92102LDLIBS_pmap	= -lproc
44c6402783SakolbLDLIBS_pmadvise	= -lproc
457c478bd9Sstevel@tonic-gateLDLIBS_ppriv	= -lproc
467c478bd9Sstevel@tonic-gateLDLIBS_preap	= -lproc
477c478bd9Sstevel@tonic-gateLDLIBS_prun	= -lproc
487c478bd9Sstevel@tonic-gateLDLIBS_psig	= -lproc
497c478bd9Sstevel@tonic-gateLDLIBS_pstack	= -lproc -lc_db
507c478bd9Sstevel@tonic-gateLDLIBS_pstop	= -lproc
517c478bd9Sstevel@tonic-gateLDLIBS_ptime	= -lproc
527c478bd9Sstevel@tonic-gateLDLIBS_ptree	= -lproc -lcontract
537c478bd9Sstevel@tonic-gateLDLIBS_pwdx	= -lproc
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gateLDLIBS += $(LDLIBS_$(PROG))
567c478bd9Sstevel@tonic-gate
57186f7fbfSEdward Pilatowicz# pargs depends on ../../common/elfcap components
58186f7fbfSEdward Pilatowicz# pmadvise depends on pmap components
597c478bd9Sstevel@tonic-gate
607c478bd9Sstevel@tonic-gateELFCAP =	$(SRC)/common/elfcap
61186f7fbfSEdward PilatowiczPMAP =		$(SRC)/cmd/ptools/pmap
627c478bd9Sstevel@tonic-gate
6399f63845Sab196087CPPFLAGS_pargs =	-I$(ELFCAP)
647c478bd9Sstevel@tonic-gateOBJS_pargs =		elfcap.o
657c478bd9Sstevel@tonic-gateSRCS_pargs =		$(ELFCAP)/elfcap.c
667c478bd9Sstevel@tonic-gate
67186f7fbfSEdward PilatowiczCPPFLAGS_pmap =		-I$(PMAP)
68186f7fbfSEdward PilatowiczOBJS_pmap =		pmap_common.o
69186f7fbfSEdward PilatowiczSRCS_pmap =		$(PMAP)/pmap_common.c
70186f7fbfSEdward Pilatowicz
71186f7fbfSEdward PilatowiczCPPFLAGS_pmadvise =	-I$(PMAP)
72186f7fbfSEdward PilatowiczOBJS_pmadvise =		pmap_common.o
73186f7fbfSEdward PilatowiczSRCS_pmadvise =		$(PMAP)/pmap_common.c
74186f7fbfSEdward Pilatowicz
757c478bd9Sstevel@tonic-gateCPPFLAGS +=	$(CPPFLAGS_$(PROG))
767c478bd9Sstevel@tonic-gateOBJS +=		$(OBJS_$(PROG))
777c478bd9Sstevel@tonic-gateSRCS +=		$(SRCS_$(PROG))
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gateINSTALL_NEW=
807c478bd9Sstevel@tonic-gateINSTALL_LEGACY=$(RM) $(ROOTPROCBINSYMLINK) ; \
817c478bd9Sstevel@tonic-gate	$(LN) -s ../../bin/$(PROG) $(ROOTPROCBINSYMLINK)
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gate.KEEP_STATE:
847c478bd9Sstevel@tonic-gate
85186f7fbfSEdward Pilatowiczelfcap.o:	$(ELFCAP)/elfcap.c
86186f7fbfSEdward Pilatowicz		$(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
87186f7fbfSEdward Pilatowicz
88186f7fbfSEdward Pilatowiczpmap_common.o:	$(PMAP)/pmap_common.c
89186f7fbfSEdward Pilatowicz		$(COMPILE.c) -o $@ $(PMAP)/pmap_common.c
90186f7fbfSEdward Pilatowicz
917c478bd9Sstevel@tonic-gate%.o:	../%.c
927c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gateall:	$(PROG)
957c478bd9Sstevel@tonic-gate
967c478bd9Sstevel@tonic-gateROOTBINPROG=$(ROOTBIN)/$(PROG)
977c478bd9Sstevel@tonic-gateROOTPROCBINSYMLINK=$(ROOT)/usr/proc/bin/$(PROG)
987c478bd9Sstevel@tonic-gate
997c478bd9Sstevel@tonic-gate$(PROG): $$(OBJS)
1007c478bd9Sstevel@tonic-gate	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
1017c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1027c478bd9Sstevel@tonic-gate
1037c478bd9Sstevel@tonic-gate#
1047c478bd9Sstevel@tonic-gate# Install the ptool, symlinking it into /usr/proc/bin if PTOOL_TYPE is set
1057c478bd9Sstevel@tonic-gate# to LEGACY.
1067c478bd9Sstevel@tonic-gate#
1077c478bd9Sstevel@tonic-gateinstall: all $(ROOTISAPROG)
1087c478bd9Sstevel@tonic-gate	-$(RM) $(ROOTBINPROG)
1097c478bd9Sstevel@tonic-gate	-$(LN) $(ISAEXEC) $(ROOTBINPROG)
1107c478bd9Sstevel@tonic-gate	-$(INSTALL_$(PTOOL_TYPE))
1117c478bd9Sstevel@tonic-gate
1127c478bd9Sstevel@tonic-gateclean:
1137c478bd9Sstevel@tonic-gate	$(RM) $(OBJS)
1147c478bd9Sstevel@tonic-gate
1157c478bd9Sstevel@tonic-gatelint:
1167c478bd9Sstevel@tonic-gate	$(LINT.c) $(SRCS) $(LDLIBS)
117