xref: /illumos-gate/usr/src/cmd/ptools/Makefile.bld (revision 88f8b78a88cbdc6d8c1af5c3e54bc49d25095c98)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29PROG:sh = basename `cd ..; pwd`
30
31OBJS = $(PROG).o
32
33SRCS = ../$(PROG).c
34
35FILEMODE = 0555
36GROUP = bin
37
38# libproc is added individually as pwait doesn't need it.
39# These are defined this way so lint can use them
40LDLIBS_pargs	= -lproc
41LDLIBS_pcred	= -lproc
42LDLIBS_pfiles	= -lproc -lnsl
43LDLIBS_pflags	= -lproc
44LDLIBS_pldd	= -lproc
45LDLIBS_pmap	= -lproc
46LDLIBS_ppriv	= -lproc
47LDLIBS_preap	= -lproc
48LDLIBS_prun	= -lproc
49LDLIBS_psig	= -lproc
50LDLIBS_pstack	= -lproc -lc_db
51LDLIBS_pstop	= -lproc
52LDLIBS_ptime	= -lproc
53LDLIBS_ptree	= -lproc -lcontract
54LDLIBS_pwdx	= -lproc
55
56LDLIBS += $(LDLIBS_$(PROG))
57
58# pargs requires to link with ../../common/elfcap components
59
60ELFCAP =	$(SRC)/common/elfcap
61
62CPPFLAGS_pargs =-DCAP_UPPERCASE -I$(ELFCAP)
63OBJS_pargs =	elfcap.o
64SRCS_pargs =	$(ELFCAP)/elfcap.c
65
66CPPFLAGS +=	$(CPPFLAGS_$(PROG))
67OBJS +=		$(OBJS_$(PROG))
68SRCS +=		$(SRCS_$(PROG))
69
70elfcap.o:	$(ELFCAP)/elfcap.c
71		$(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
72
73
74INSTALL_NEW=
75INSTALL_LEGACY=$(RM) $(ROOTPROCBINSYMLINK) ; \
76	$(LN) -s ../../bin/$(PROG) $(ROOTPROCBINSYMLINK)
77
78.KEEP_STATE:
79
80%.o:	../%.c
81	$(COMPILE.c) $<
82
83all:	$(PROG)
84
85ROOTBINPROG=$(ROOTBIN)/$(PROG)
86ROOTPROCBINSYMLINK=$(ROOT)/usr/proc/bin/$(PROG)
87
88$(PROG): $$(OBJS)
89	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
90	$(POST_PROCESS)
91
92#
93# Install the ptool, symlinking it into /usr/proc/bin if PTOOL_TYPE is set
94# to LEGACY.
95#
96install: all $(ROOTISAPROG)
97	-$(RM) $(ROOTBINPROG)
98	-$(LN) $(ISAEXEC) $(ROOTBINPROG)
99	-$(INSTALL_$(PTOOL_TYPE))
100
101clean:
102	$(RM) $(OBJS)
103
104lint:
105	$(LINT.c) $(SRCS) $(LDLIBS)
106