xref: /titanic_41/usr/src/cmd/ptools/Makefile.bld (revision ead9bb4b1be81d7bbf8ed86ee41d6c1e58b069a3)
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 2009 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
34
35# libproc is added individually as pwait doesn't need it.
36# These are defined this way so lint can use them
37LDLIBS_pargs	= -lproc
38LDLIBS_pcred	= -lproc
39LDLIBS_pfiles	= -lproc -lnsl
40LDLIBS_pflags	= -lproc
41LDLIBS_pldd	= -lproc
42LDLIBS_plgrp	= -lproc -llgrp
43LDLIBS_pmap	= -lproc
44LDLIBS_pmadvise	= -lproc
45LDLIBS_ppriv	= -lproc
46LDLIBS_preap	= -lproc
47LDLIBS_prun	= -lproc
48LDLIBS_psig	= -lproc
49LDLIBS_pstack	= -lproc -lc_db
50LDLIBS_pstop	= -lproc
51LDLIBS_ptime	= -lproc
52LDLIBS_ptree	= -lproc -lcontract
53LDLIBS_pwdx	= -lproc
54
55LDLIBS += $(LDLIBS_$(PROG))
56
57# pargs depends on ../../common/elfcap components
58# pmadvise depends on pmap components
59
60ELFCAP =	$(SRC)/common/elfcap
61PMAP =		$(SRC)/cmd/ptools/pmap
62
63CPPFLAGS_pargs =	-I$(ELFCAP)
64OBJS_pargs =		elfcap.o
65SRCS_pargs =		$(ELFCAP)/elfcap.c
66
67CPPFLAGS_pmap =		-I$(PMAP)
68OBJS_pmap =		pmap_common.o
69SRCS_pmap =		$(PMAP)/pmap_common.c
70
71CPPFLAGS_pmadvise =	-I$(PMAP)
72OBJS_pmadvise =		pmap_common.o
73SRCS_pmadvise =		$(PMAP)/pmap_common.c
74
75CPPFLAGS +=	$(CPPFLAGS_$(PROG))
76OBJS +=		$(OBJS_$(PROG))
77SRCS +=		$(SRCS_$(PROG))
78
79INSTALL_NEW=
80INSTALL_LEGACY=$(RM) $(ROOTPROCBINSYMLINK) ; \
81	$(LN) -s ../../bin/$(PROG) $(ROOTPROCBINSYMLINK)
82
83.KEEP_STATE:
84
85elfcap.o:	$(ELFCAP)/elfcap.c
86		$(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
87
88pmap_common.o:	$(PMAP)/pmap_common.c
89		$(COMPILE.c) -o $@ $(PMAP)/pmap_common.c
90
91%.o:	../%.c
92	$(COMPILE.c) $<
93
94all:	$(PROG)
95
96ROOTBINPROG=$(ROOTBIN)/$(PROG)
97ROOTPROCBINSYMLINK=$(ROOT)/usr/proc/bin/$(PROG)
98
99$(PROG): $$(OBJS)
100	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
101	$(POST_PROCESS)
102
103#
104# Install the ptool, symlinking it into /usr/proc/bin if PTOOL_TYPE is set
105# to LEGACY.
106#
107install: all $(ROOTISAPROG)
108	-$(RM) $(ROOTBINPROG)
109	-$(LN) $(ISAEXEC) $(ROOTBINPROG)
110	-$(INSTALL_$(PTOOL_TYPE))
111
112clean:
113	$(RM) $(OBJS)
114
115lint:
116	$(LINT.c) $(SRCS) $(LDLIBS)
117