xref: /illumos-gate/usr/src/cmd/ptools/Makefile.bld (revision fb2612809ed5f2cb9109db768e63d61f6659f71b)
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_psecflags	= -lproc -lproject
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
58CERRWARN_plgrp	+= -_gcc=-Wno-parentheses
59
60CERRWARN_ppriv	+= -_gcc=-Wno-parentheses
61CERRWARN_ppriv	+= -_gcc=-Wno-uninitialized
62
63CERRWARN_ptree	+= -_gcc=-Wno-parentheses
64
65CERRWARN_pstack	+= -_gcc=-Wno-uninitialized
66CERRWARN_pstack	+= -_gcc=-Wno-clobbered
67
68CERRWARN_pargs	+= -_gcc=-Wno-clobbered
69CERRWARN_pargs	+= -_gcc=-Wno-type-limits
70
71CERRWARN += $(CERRWARN_$(PROG))
72
73# pargs depends on ../../common/elfcap components
74# pmadvise depends on pmap components
75
76ELFCAP =	$(SRC)/common/elfcap
77PMAP =		$(SRC)/cmd/ptools/pmap
78
79CPPFLAGS_pargs =	-I$(ELFCAP)
80OBJS_pargs =		elfcap.o
81SRCS_pargs =		$(ELFCAP)/elfcap.c
82
83CPPFLAGS_pmap =		-I$(PMAP)
84OBJS_pmap =		pmap_common.o
85SRCS_pmap =		$(PMAP)/pmap_common.c
86
87CPPFLAGS_pmadvise =	-I$(PMAP)
88OBJS_pmadvise =		pmap_common.o
89SRCS_pmadvise =		$(PMAP)/pmap_common.c
90
91CPPFLAGS +=	$(CPPFLAGS_$(PROG))
92OBJS +=		$(OBJS_$(PROG))
93SRCS +=		$(SRCS_$(PROG))
94
95INSTALL_NEW=
96INSTALL_LEGACY=$(RM) $(ROOTPROCBINSYMLINK) ; \
97	$(LN) -s ../../bin/$(PROG) $(ROOTPROCBINSYMLINK)
98
99.KEEP_STATE:
100
101elfcap.o:	$(ELFCAP)/elfcap.c
102		$(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
103
104pmap_common.o:	$(PMAP)/pmap_common.c
105		$(COMPILE.c) -o $@ $(PMAP)/pmap_common.c
106
107%.o:	../%.c
108	$(COMPILE.c) $<
109
110all:	$(PROG)
111
112ROOTBINPROG=$(ROOTBIN)/$(PROG)
113ROOTPROCBINSYMLINK=$(ROOT)/usr/proc/bin/$(PROG)
114
115$(PROG): $$(OBJS)
116	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
117	$(POST_PROCESS)
118
119#
120# Install the ptool, symlinking it into /usr/proc/bin if PTOOL_TYPE is set
121# to LEGACY.
122#
123install: all $(ROOTISAPROG)
124	-$(RM) $(ROOTBINPROG)
125	-$(LN) $(ISAEXEC) $(ROOTBINPROG)
126	-$(INSTALL_$(PTOOL_TYPE))
127
128clean:
129	$(RM) $(OBJS)
130
131lint:
132	$(LINT.c) $(SRCS) $(LDLIBS)
133