Merge illumos-gate
[unleashed/lotheac.git] / usr / src / cmd / ptools / Makefile.bld
blobf0a2588f1a6c318b21caa9e84aaff10991a07c24
2 # CDDL HEADER START
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]
19 # CDDL HEADER END
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`
32 OBJS = $(PROG).o
34 SRCS = ../$(PROG).c
36 FILEMODE = 0555
38 # libproc is added individually as pwait doesn't need it.
39 LDLIBS_pargs            = -lproc
40 LDLIBS_pcred            = -lproc
41 LDLIBS_pfiles           = -lproc
42 LDLIBS_pflags           = -lproc
43 LDLIBS_pldd             = -lproc
44 LDLIBS_plgrp            = -lproc -llgrp
45 LDLIBS_pmap             = -lproc
46 LDLIBS_pmadvise         = -lproc
47 LDLIBS_ppriv            = -lproc
48 LDLIBS_preap            = -lproc
49 LDLIBS_prun             = -lproc
50 LDLIBS_psecflags        = -lproc -lproject
51 LDLIBS_psig             = -lproc
52 LDLIBS_pstack           = -lproc -lc_db
53 LDLIBS_pstop            = -lproc
54 LDLIBS_ptime            = -lproc
55 LDLIBS_ptree            = -lproc -lcontract
56 LDLIBS_pwdx             = -lproc
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)
84 OBJS_pargs =            elfcap.o
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))
99 INSTALL_NEW=
100 INSTALL_LEGACY=$(RM) $(ROOTPROCBINSYMLINK) ; \
101         $(LN) -s ../../bin/$(PROG) $(ROOTPROCBINSYMLINK)
103 .KEEP_STATE:
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
111 %.o:    ../%.c
112         $(COMPILE.c) $<
114 all:    $(PROG)
116 ROOTBINPROG=$(ROOTBIN)/$(PROG)
117 ROOTPROCBINSYMLINK=$(ROOT)/usr/proc/bin/$(PROG)
119 $(PROG): $$(OBJS)
120         $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
121         $(POST_PROCESS)
124 # Install the ptool, symlinking it into /usr/proc/bin if PTOOL_TYPE is set
125 # to LEGACY.
127 install: all $(ROOTISAPROG)
128         -$(RM) $(ROOTBINPROG)
129         -$(LN) $(ISAEXEC) $(ROOTBINPROG)
130         -$(INSTALL_$(PTOOL_TYPE))
132 clean:
133         $(RM) $(OBJS)