xref: /titanic_44/usr/src/cmd/dtrace/test/cmd/jdtrace/Makefile (revision 48a4016cae8aa2b8b3d8b258eb22e0c781912bed)
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
69lint:
70
71install: all $(PROTO_JDTRACE_JAR) $(CMD) $(XLIST)
72
73$(PROG): $(SRCS)
74	$(LINK.c) -o $@ $(SRCS) $(LDLIBS)
75	$(POST_PROCESS) ; $(STRIP_STABS)
76
77JFLAGS= -g -cp $(CLASSPATH) -d $(CLASSDIR)
78JFLAGS += -source 1.5 -target 1.6 -Xlint:all,-options
79COMPILE.java=$(JAVAC) $(JFLAGS)
80JAVASRC= JDTrace.java Getopt.java
81
82$(JDTRACE_JAR): $(JAVASRC)
83	@mkdir -p $(CLASSDIR)
84	@mkdir -p $(LIBDIR)
85	$(COMPILE.java) $(JAVASRC)
86	$(JAR) -cmf $(MANIFEST) $(JDTRACE_JAR) -C $(CLASSDIR) .
87
88$(PROTO_JDTRACE_JAR): $(ROOTLIBJAVA)
89
90$(CMD): $(ROOTBIN)
91
92$(XLIST): $(ROOTBIN)
93
94$(ROOTBIN):
95	$(INS.dir)
96
97$(ROOTLIB):
98	$(INS.dir)
99
100$(ROOTLIBJAVA): $(ROOTLIB)
101	$(INS.dir)
102
103$(ROOTLIBJAVA)/%.jar: $(LIBDIR)/%.jar
104	$(INS.file)
105
106$(ROOTBIN)/%: %
107	$(INS.file)
108