xref: /titanic_51/usr/src/cmd/ptools/Makefile.bld (revision 186f7fbf5e07d046b50e4e15c32b21f109b76c80)
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#
23c2b5bce0Ssp92102# Copyright 2008 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-gateGROUP = bin
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gate# libproc is added individually as pwait doesn't need it.
377c478bd9Sstevel@tonic-gate# These are defined this way so lint can use them
387c478bd9Sstevel@tonic-gateLDLIBS_pargs	= -lproc
397c478bd9Sstevel@tonic-gateLDLIBS_pcred	= -lproc
407c478bd9Sstevel@tonic-gateLDLIBS_pfiles	= -lproc -lnsl
417c478bd9Sstevel@tonic-gateLDLIBS_pflags	= -lproc
427c478bd9Sstevel@tonic-gateLDLIBS_pldd	= -lproc
43c6402783SakolbLDLIBS_plgrp	= -lproc -llgrp
44c2b5bce0Ssp92102LDLIBS_pmap	= -lproc
45c6402783SakolbLDLIBS_pmadvise	= -lproc
467c478bd9Sstevel@tonic-gateLDLIBS_ppriv	= -lproc
477c478bd9Sstevel@tonic-gateLDLIBS_preap	= -lproc
487c478bd9Sstevel@tonic-gateLDLIBS_prun	= -lproc
497c478bd9Sstevel@tonic-gateLDLIBS_psig	= -lproc
507c478bd9Sstevel@tonic-gateLDLIBS_pstack	= -lproc -lc_db
517c478bd9Sstevel@tonic-gateLDLIBS_pstop	= -lproc
527c478bd9Sstevel@tonic-gateLDLIBS_ptime	= -lproc
537c478bd9Sstevel@tonic-gateLDLIBS_ptree	= -lproc -lcontract
547c478bd9Sstevel@tonic-gateLDLIBS_pwdx	= -lproc
557c478bd9Sstevel@tonic-gate
567c478bd9Sstevel@tonic-gateLDLIBS += $(LDLIBS_$(PROG))
577c478bd9Sstevel@tonic-gate
58*186f7fbfSEdward Pilatowicz# pargs depends on ../../common/elfcap components
59*186f7fbfSEdward Pilatowicz# pmadvise depends on pmap components
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gateELFCAP =	$(SRC)/common/elfcap
62*186f7fbfSEdward PilatowiczPMAP =		$(SRC)/cmd/ptools/pmap
637c478bd9Sstevel@tonic-gate
6499f63845Sab196087CPPFLAGS_pargs =	-I$(ELFCAP)
657c478bd9Sstevel@tonic-gateOBJS_pargs =		elfcap.o
667c478bd9Sstevel@tonic-gateSRCS_pargs =		$(ELFCAP)/elfcap.c
677c478bd9Sstevel@tonic-gate
68*186f7fbfSEdward PilatowiczCPPFLAGS_pmap =		-I$(PMAP)
69*186f7fbfSEdward PilatowiczOBJS_pmap =		pmap_common.o
70*186f7fbfSEdward PilatowiczSRCS_pmap =		$(PMAP)/pmap_common.c
71*186f7fbfSEdward Pilatowicz
72*186f7fbfSEdward PilatowiczCPPFLAGS_pmadvise =	-I$(PMAP)
73*186f7fbfSEdward PilatowiczOBJS_pmadvise =		pmap_common.o
74*186f7fbfSEdward PilatowiczSRCS_pmadvise =		$(PMAP)/pmap_common.c
75*186f7fbfSEdward Pilatowicz
767c478bd9Sstevel@tonic-gateCPPFLAGS +=	$(CPPFLAGS_$(PROG))
777c478bd9Sstevel@tonic-gateOBJS +=		$(OBJS_$(PROG))
787c478bd9Sstevel@tonic-gateSRCS +=		$(SRCS_$(PROG))
797c478bd9Sstevel@tonic-gate
807c478bd9Sstevel@tonic-gateINSTALL_NEW=
817c478bd9Sstevel@tonic-gateINSTALL_LEGACY=$(RM) $(ROOTPROCBINSYMLINK) ; \
827c478bd9Sstevel@tonic-gate	$(LN) -s ../../bin/$(PROG) $(ROOTPROCBINSYMLINK)
837c478bd9Sstevel@tonic-gate
847c478bd9Sstevel@tonic-gate.KEEP_STATE:
857c478bd9Sstevel@tonic-gate
86*186f7fbfSEdward Pilatowiczelfcap.o:	$(ELFCAP)/elfcap.c
87*186f7fbfSEdward Pilatowicz		$(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
88*186f7fbfSEdward Pilatowicz
89*186f7fbfSEdward Pilatowiczpmap_common.o:	$(PMAP)/pmap_common.c
90*186f7fbfSEdward Pilatowicz		$(COMPILE.c) -o $@ $(PMAP)/pmap_common.c
91*186f7fbfSEdward Pilatowicz
927c478bd9Sstevel@tonic-gate%.o:	../%.c
937c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
947c478bd9Sstevel@tonic-gate
957c478bd9Sstevel@tonic-gateall:	$(PROG)
967c478bd9Sstevel@tonic-gate
977c478bd9Sstevel@tonic-gateROOTBINPROG=$(ROOTBIN)/$(PROG)
987c478bd9Sstevel@tonic-gateROOTPROCBINSYMLINK=$(ROOT)/usr/proc/bin/$(PROG)
997c478bd9Sstevel@tonic-gate
1007c478bd9Sstevel@tonic-gate$(PROG): $$(OBJS)
1017c478bd9Sstevel@tonic-gate	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
1027c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1037c478bd9Sstevel@tonic-gate
1047c478bd9Sstevel@tonic-gate#
1057c478bd9Sstevel@tonic-gate# Install the ptool, symlinking it into /usr/proc/bin if PTOOL_TYPE is set
1067c478bd9Sstevel@tonic-gate# to LEGACY.
1077c478bd9Sstevel@tonic-gate#
1087c478bd9Sstevel@tonic-gateinstall: all $(ROOTISAPROG)
1097c478bd9Sstevel@tonic-gate	-$(RM) $(ROOTBINPROG)
1107c478bd9Sstevel@tonic-gate	-$(LN) $(ISAEXEC) $(ROOTBINPROG)
1117c478bd9Sstevel@tonic-gate	-$(INSTALL_$(PTOOL_TYPE))
1127c478bd9Sstevel@tonic-gate
1137c478bd9Sstevel@tonic-gateclean:
1147c478bd9Sstevel@tonic-gate	$(RM) $(OBJS)
1157c478bd9Sstevel@tonic-gate
1167c478bd9Sstevel@tonic-gatelint:
1177c478bd9Sstevel@tonic-gate	$(LINT.c) $(SRCS) $(LDLIBS)
118