xref: /titanic_41/usr/src/cmd/ptools/Makefile.bld (revision cde2885fdf538266ee2a3b08dee2d5075ce8fa2b)
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 (the "License").
6# You may not use this file except in compliance with the License.
7#
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.
12#
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]
18#
19# CDDL HEADER END
20#
21
22#
23# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27PROG:sh = basename `cd ..; pwd`
28
29OBJS = $(PROG).o
30
31SRCS = ../$(PROG).c
32
33FILEMODE = 0555
34GROUP = bin
35
36# libproc is added individually as pwait doesn't need it.
37# These are defined this way so lint can use them
38LDLIBS_pargs	= -lproc
39LDLIBS_pcred	= -lproc
40LDLIBS_pfiles	= -lproc -lnsl
41LDLIBS_pflags	= -lproc
42LDLIBS_pldd	= -lproc
43LDLIBS_plgrp	= -lproc -llgrp
44LDLIBS_pmap	= -lproc
45LDLIBS_pmadvise	= -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 depends on ../../common/elfcap components
59# pmadvise depends on pmap components
60
61ELFCAP =	$(SRC)/common/elfcap
62PMAP =		$(SRC)/cmd/ptools/pmap
63
64CPPFLAGS_pargs =	-I$(ELFCAP)
65OBJS_pargs =		elfcap.o
66SRCS_pargs =		$(ELFCAP)/elfcap.c
67
68CPPFLAGS_pmap =		-I$(PMAP)
69OBJS_pmap =		pmap_common.o
70SRCS_pmap =		$(PMAP)/pmap_common.c
71
72CPPFLAGS_pmadvise =	-I$(PMAP)
73OBJS_pmadvise =		pmap_common.o
74SRCS_pmadvise =		$(PMAP)/pmap_common.c
75
76CPPFLAGS +=	$(CPPFLAGS_$(PROG))
77OBJS +=		$(OBJS_$(PROG))
78SRCS +=		$(SRCS_$(PROG))
79
80INSTALL_NEW=
81INSTALL_LEGACY=$(RM) $(ROOTPROCBINSYMLINK) ; \
82	$(LN) -s ../../bin/$(PROG) $(ROOTPROCBINSYMLINK)
83
84.KEEP_STATE:
85
86elfcap.o:	$(ELFCAP)/elfcap.c
87		$(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
88
89pmap_common.o:	$(PMAP)/pmap_common.c
90		$(COMPILE.c) -o $@ $(PMAP)/pmap_common.c
91
92%.o:	../%.c
93	$(COMPILE.c) $<
94
95all:	$(PROG)
96
97ROOTBINPROG=$(ROOTBIN)/$(PROG)
98ROOTPROCBINSYMLINK=$(ROOT)/usr/proc/bin/$(PROG)
99
100$(PROG): $$(OBJS)
101	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
102	$(POST_PROCESS)
103
104#
105# Install the ptool, symlinking it into /usr/proc/bin if PTOOL_TYPE is set
106# to LEGACY.
107#
108install: all $(ROOTISAPROG)
109	-$(RM) $(ROOTBINPROG)
110	-$(LN) $(ISAEXEC) $(ROOTBINPROG)
111	-$(INSTALL_$(PTOOL_TYPE))
112
113clean:
114	$(RM) $(OBJS)
115
116lint:
117	$(LINT.c) $(SRCS) $(LDLIBS)
118