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 2007 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27
28PROG = jdtrace
29SRCS = jdtrace.c
30
31include $(SRC)/cmd/Makefile.cmd
32
33ROOTOPTPKG = $(ROOT)/opt/SUNWdtrt
34ROOTBIN = $(ROOTOPTPKG)/bin
35ROOTLIB = $(ROOTOPTPKG)/lib
36ROOTLIBJAVA = $(ROOTLIB)/java
37
38# Use the proto dtrace.jar if it exists, otherwise use whatever is
39# installed on the system. It should be possible to build
40# usr/src/cmd/dtrace/test independently, even if only on systems that
41# have a compatible dtrace.jar installed.
42DTRACE_JAR=usr/share/lib/java/dtrace.jar
43PROTO_DTRACE_JAR=$(ROOT)/$(DTRACE_JAR)
44INSTALLED_DTRACE_JAR=/$(DTRACE_JAR)
45CLASSPATH=$(PROTO_DTRACE_JAR):$(INSTALLED_DTRACE_JAR)
46DTEST_DIR=$(SRC)/cmd/dtrace/test
47CLASSDIR=classes
48LIBDIR=lib
49MANIFESTDIR=manifest
50MANIFEST=$(MANIFESTDIR)/jdtrace.jar-manifest
51JDTRACE_JAR=$(LIBDIR)/jdtrace.jar
52
53PROTO_JDTRACE_JAR=$(ROOTLIBJAVA)/jdtrace.jar
54CMD = $(ROOTBIN)/jdtrace
55XLIST = $(ROOTBIN)/exception.lst
56
57$(PROTO_JDTRACE_JAR) := FILEMODE = 0644
58$(CMD) := FILEMODE = 0555
59$(XLIST) := FILEMODE = 0444
60
61all: $(JDTRACE_JAR) $(PROG)
62
63clean:
64	-$(RM) $(CLASSDIR)/*.class
65
66clobber: clean
67	-$(RM) $(JDTRACE_JAR)
68	-$(RM) $(PROG)
69
70lint:
71
72install: all $(PROTO_JDTRACE_JAR) $(CMD) $(XLIST)
73
74$(PROG): $(SRCS)
75	$(LINK.c) -o $@ $(SRCS) $(LDLIBS)
76	$(POST_PROCESS) ; $(STRIP_STABS)
77
78$(JDTRACE_JAR): JDTrace.java Getopt.java
79	@mkdir -p $(CLASSDIR)
80	@mkdir -p $(LIBDIR)
81	$(JAVAC) -cp $(CLASSPATH) -d $(CLASSDIR) *.java
82	$(JAR) -cmf $(MANIFEST) $(JDTRACE_JAR) -C $(CLASSDIR) .
83
84$(PROTO_JDTRACE_JAR): $(ROOTLIBJAVA)
85
86$(CMD): $(ROOTBIN)
87
88$(XLIST): $(ROOTBIN)
89
90$(ROOTBIN):
91	$(INS.dir)
92
93$(ROOTLIB):
94	$(INS.dir)
95
96$(ROOTLIBJAVA): $(ROOTLIB)
97	$(INS.dir)
98
99$(ROOTLIBJAVA)/%.jar: $(LIBDIR)/%.jar
100	$(INS.file)
101
102$(ROOTBIN)/%: %
103	$(INS.file)
104