xref: /titanic_51/usr/src/cmd/ptools/Makefile.bld (revision 7014882c6a3672fd0e5d60200af8643ae53c5928)
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#
2324fe0b3bSjmcp# 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
57*7014882cSRichard LoweCERRWARN_plgrp	+= -_gcc=-Wno-parentheses
58*7014882cSRichard Lowe
59*7014882cSRichard LoweCERRWARN_ppriv	+= -_gcc=-Wno-parentheses
60*7014882cSRichard LoweCERRWARN_ppriv	+= -_gcc=-Wno-uninitialized
61*7014882cSRichard Lowe
62*7014882cSRichard LoweCERRWARN_ptree	+= -_gcc=-Wno-parentheses
63*7014882cSRichard Lowe
64*7014882cSRichard LoweCERRWARN_pstack	+= -_gcc=-Wno-uninitialized
65*7014882cSRichard LoweCERRWARN_pstack	+= -_gcc=-Wno-clobbered
66*7014882cSRichard Lowe
67*7014882cSRichard LoweCERRWARN_pargs	+= -_gcc=-Wno-clobbered
68*7014882cSRichard LoweCERRWARN_pargs	+= -_gcc=-Wno-type-limits
69*7014882cSRichard Lowe
70*7014882cSRichard LoweCERRWARN += $(CERRWARN_$(PROG))
71*7014882cSRichard Lowe
72186f7fbfSEdward Pilatowicz# pargs depends on ../../common/elfcap components
73186f7fbfSEdward Pilatowicz# pmadvise depends on pmap components
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gateELFCAP =	$(SRC)/common/elfcap
76186f7fbfSEdward PilatowiczPMAP =		$(SRC)/cmd/ptools/pmap
777c478bd9Sstevel@tonic-gate
7899f63845Sab196087CPPFLAGS_pargs =	-I$(ELFCAP)
797c478bd9Sstevel@tonic-gateOBJS_pargs =		elfcap.o
807c478bd9Sstevel@tonic-gateSRCS_pargs =		$(ELFCAP)/elfcap.c
817c478bd9Sstevel@tonic-gate
82186f7fbfSEdward PilatowiczCPPFLAGS_pmap =		-I$(PMAP)
83186f7fbfSEdward PilatowiczOBJS_pmap =		pmap_common.o
84186f7fbfSEdward PilatowiczSRCS_pmap =		$(PMAP)/pmap_common.c
85186f7fbfSEdward Pilatowicz
86186f7fbfSEdward PilatowiczCPPFLAGS_pmadvise =	-I$(PMAP)
87186f7fbfSEdward PilatowiczOBJS_pmadvise =		pmap_common.o
88186f7fbfSEdward PilatowiczSRCS_pmadvise =		$(PMAP)/pmap_common.c
89186f7fbfSEdward Pilatowicz
907c478bd9Sstevel@tonic-gateCPPFLAGS +=	$(CPPFLAGS_$(PROG))
917c478bd9Sstevel@tonic-gateOBJS +=		$(OBJS_$(PROG))
927c478bd9Sstevel@tonic-gateSRCS +=		$(SRCS_$(PROG))
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gateINSTALL_NEW=
957c478bd9Sstevel@tonic-gateINSTALL_LEGACY=$(RM) $(ROOTPROCBINSYMLINK) ; \
967c478bd9Sstevel@tonic-gate	$(LN) -s ../../bin/$(PROG) $(ROOTPROCBINSYMLINK)
977c478bd9Sstevel@tonic-gate
987c478bd9Sstevel@tonic-gate.KEEP_STATE:
997c478bd9Sstevel@tonic-gate
100186f7fbfSEdward Pilatowiczelfcap.o:	$(ELFCAP)/elfcap.c
101186f7fbfSEdward Pilatowicz		$(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
102186f7fbfSEdward Pilatowicz
103186f7fbfSEdward Pilatowiczpmap_common.o:	$(PMAP)/pmap_common.c
104186f7fbfSEdward Pilatowicz		$(COMPILE.c) -o $@ $(PMAP)/pmap_common.c
105186f7fbfSEdward Pilatowicz
1067c478bd9Sstevel@tonic-gate%.o:	../%.c
1077c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
1087c478bd9Sstevel@tonic-gate
1097c478bd9Sstevel@tonic-gateall:	$(PROG)
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gateROOTBINPROG=$(ROOTBIN)/$(PROG)
1127c478bd9Sstevel@tonic-gateROOTPROCBINSYMLINK=$(ROOT)/usr/proc/bin/$(PROG)
1137c478bd9Sstevel@tonic-gate
1147c478bd9Sstevel@tonic-gate$(PROG): $$(OBJS)
1157c478bd9Sstevel@tonic-gate	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
1167c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1177c478bd9Sstevel@tonic-gate
1187c478bd9Sstevel@tonic-gate#
1197c478bd9Sstevel@tonic-gate# Install the ptool, symlinking it into /usr/proc/bin if PTOOL_TYPE is set
1207c478bd9Sstevel@tonic-gate# to LEGACY.
1217c478bd9Sstevel@tonic-gate#
1227c478bd9Sstevel@tonic-gateinstall: all $(ROOTISAPROG)
1237c478bd9Sstevel@tonic-gate	-$(RM) $(ROOTBINPROG)
1247c478bd9Sstevel@tonic-gate	-$(LN) $(ISAEXEC) $(ROOTBINPROG)
1257c478bd9Sstevel@tonic-gate	-$(INSTALL_$(PTOOL_TYPE))
1267c478bd9Sstevel@tonic-gate
1277c478bd9Sstevel@tonic-gateclean:
1287c478bd9Sstevel@tonic-gate	$(RM) $(OBJS)
1297c478bd9Sstevel@tonic-gate
1307c478bd9Sstevel@tonic-gatelint:
1317c478bd9Sstevel@tonic-gate	$(LINT.c) $(SRCS) $(LDLIBS)
132