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# ident "%Z%%M% %I% %E% SMI" 27 28PROG:sh = basename `cd ..; pwd` 29 30OBJS = $(PROG).o 31 32SRCS = ../$(PROG).c 33 34FILEMODE = 0555 35GROUP = bin 36 37# libproc is added individually as pwait doesn't need it. 38# These are defined this way so lint can use them 39LDLIBS_pargs = -lproc 40LDLIBS_pcred = -lproc 41LDLIBS_pfiles = -lproc -lnsl 42LDLIBS_pflags = -lproc 43LDLIBS_pldd = -lproc 44LDLIBS_plgrp = -lproc -llgrp 45LDLIBS_pmap = -lproc 46LDLIBS_pmadvise = -lproc 47LDLIBS_ppriv = -lproc 48LDLIBS_preap = -lproc 49LDLIBS_prun = -lproc 50LDLIBS_psig = -lproc 51LDLIBS_pstack = -lproc -lc_db 52LDLIBS_pstop = -lproc 53LDLIBS_ptime = -lproc 54LDLIBS_ptree = -lproc -lcontract 55LDLIBS_pwdx = -lproc 56 57LDLIBS += $(LDLIBS_$(PROG)) 58 59# pargs requires to link with ../../common/elfcap components 60 61ELFCAP = $(SRC)/common/elfcap 62 63CPPFLAGS_pargs =-I$(ELFCAP) 64OBJS_pargs = elfcap.o 65SRCS_pargs = $(ELFCAP)/elfcap.c 66 67CPPFLAGS += $(CPPFLAGS_$(PROG)) 68OBJS += $(OBJS_$(PROG)) 69SRCS += $(SRCS_$(PROG)) 70 71elfcap.o: $(ELFCAP)/elfcap.c 72 $(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c 73 74 75INSTALL_NEW= 76INSTALL_LEGACY=$(RM) $(ROOTPROCBINSYMLINK) ; \ 77 $(LN) -s ../../bin/$(PROG) $(ROOTPROCBINSYMLINK) 78 79.KEEP_STATE: 80 81%.o: ../%.c 82 $(COMPILE.c) $< 83 84all: $(PROG) 85 86ROOTBINPROG=$(ROOTBIN)/$(PROG) 87ROOTPROCBINSYMLINK=$(ROOT)/usr/proc/bin/$(PROG) 88 89$(PROG): $$(OBJS) 90 $(LINK.c) $(OBJS) -o $@ $(LDLIBS) 91 $(POST_PROCESS) 92 93# 94# Install the ptool, symlinking it into /usr/proc/bin if PTOOL_TYPE is set 95# to LEGACY. 96# 97install: all $(ROOTISAPROG) 98 -$(RM) $(ROOTBINPROG) 99 -$(LN) $(ISAEXEC) $(ROOTBINPROG) 100 -$(INSTALL_$(PTOOL_TYPE)) 101 102clean: 103 $(RM) $(OBJS) 104 105lint: 106 $(LINT.c) $(SRCS) $(LDLIBS) 107