4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
25 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
26 # Use is subject to license terms.
28 # Copyright (c) 2018, Joyent, Inc.
30 PROG:sh = basename `cd ..; pwd`
38 # libproc is added individually as pwait doesn't need it.
41 LDLIBS_pfiles = -lproc
42 LDLIBS_pflags = -lproc
44 LDLIBS_plgrp = -lproc -llgrp
46 LDLIBS_pmadvise = -lproc
50 LDLIBS_psecflags = -lproc -lproject
52 LDLIBS_pstack = -lproc -lc_db
55 LDLIBS_ptree = -lproc -lcontract
58 LDLIBS += $(LDLIBS_$(PROG))
60 CERRWARN_plgrp += -Wno-parentheses
62 CERRWARN_ppriv += -Wno-parentheses
63 CERRWARN_ppriv += -Wno-uninitialized
65 CERRWARN_ptree += -Wno-parentheses
67 CERRWARN_pstack += -Wno-uninitialized
68 CERRWARN_pstack += -Wno-clobbered
70 CERRWARN_pargs += -Wno-clobbered
71 CERRWARN_pargs += -Wno-type-limits
73 CERRWARN_pwait += -_smatch=off
75 CERRWARN += $(CERRWARN_$(PROG))
77 # pargs depends on ../../common/elfcap components
78 # pmadvise depends on pmap components
80 ELFCAP = $(SRC)/common/elfcap
81 PMAP = $(SRC)/cmd/ptools/pmap
83 CPPFLAGS_pargs = -I$(ELFCAP)
85 SRCS_pargs = $(ELFCAP)/elfcap.c
87 CPPFLAGS_pmap = -I$(PMAP)
88 OBJS_pmap = pmap_common.o
89 SRCS_pmap = $(PMAP)/pmap_common.c
91 CPPFLAGS_pmadvise = -I$(PMAP)
92 OBJS_pmadvise = pmap_common.o
93 SRCS_pmadvise = $(PMAP)/pmap_common.c
95 CPPFLAGS += $(CPPFLAGS_$(PROG))
96 OBJS += $(OBJS_$(PROG))
97 SRCS += $(SRCS_$(PROG))
100 INSTALL_LEGACY=$(RM) $(ROOTPROCBINSYMLINK) ; \
101 $(LN) -s ../../bin/$(PROG) $(ROOTPROCBINSYMLINK)
105 elfcap.o: $(ELFCAP)/elfcap.c
106 $(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
108 pmap_common.o: $(PMAP)/pmap_common.c
109 $(COMPILE.c) -o $@ $(PMAP)/pmap_common.c
116 ROOTBINPROG=$(ROOTBIN)/$(PROG)
117 ROOTPROCBINSYMLINK=$(ROOT)/usr/proc/bin/$(PROG)
120 $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
124 # Install the ptool, symlinking it into /usr/proc/bin if PTOOL_TYPE is set
127 install: all $(ROOTISAPROG)
128 -$(RM) $(ROOTBINPROG)
129 -$(LN) $(ISAEXEC) $(ROOTBINPROG)
130 -$(INSTALL_$(PTOOL_TYPE))