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