xref: /titanic_41/usr/src/lib/libdtrace_jni/java/Makefile (revision 40cb5e5daa7b80bb70fcf8dadfb20f9281566331)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29include $(SRC)/Makefile.master
30
31# The Java DTrace API package
32
33PKGPATH=org/opensolaris/os/dtrace
34PKGNAME=org.opensolaris.os.dtrace
35
36# The Java DTrace API directories
37
38APIDIR=$(SRC)/lib/libdtrace_jni/java
39CLASSES=$(APIDIR)/classes
40JNI=$(APIDIR)/native
41JARS=$(APIDIR)/lib
42DOCS=$(APIDIR)/docs
43DOCAPI=$(DOCS)/api
44DOCEXAMPLES=$(DOCS)/examples
45DOCHTML=$(DOCS)/html
46DOCIMAGES=$(DOCS)/images
47MANIFEST=$(APIDIR)/manifest
48APIJAVASRC=$(APIDIR)/src
49
50# Java DTrace API jar file, its ultimate destination, and packaging details
51APIJAR=dtrace.jar
52JARDESTDIR=$(ROOT)/usr/share/lib/java
53INSJARS=$(JARDESTDIR)/$(APIJAR)
54# javadoc
55DOCDESTDIR=$(ROOT)/usr/share/lib/java/javadoc/dtrace
56DOCAPIDESTDIR=$(DOCDESTDIR)/api
57DOCEXAMPLESDESTDIR=$(DOCDESTDIR)/examples
58DOCHTMLDESTDIR=$(DOCDESTDIR)/html
59DOCIMAGESDESTDIR=$(DOCDESTDIR)/images
60
61$(JARDESTDIR)/%: $(JARS)/%
62	$(INS.file)
63
64$(DOCEXAMPLESDESTDIR)/%: $(DOCEXAMPLES)/%
65	$(INS.file)
66
67$(DOCHTMLDESTDIR)/%: $(DOCHTML)/%
68	$(INS.file)
69
70$(DOCIMAGESDESTDIR)/%: $(DOCIMAGES)/%
71	$(INS.file)
72
73# Manifest files
74APIMANI= $(MANIFEST)/dtrace.mf
75MANIFESTS= $(APIMANI)
76
77# Controlled CLASSPATH for making
78APICLASSPATH=$(CLASSES):$(APIJAVASRC)
79
80# javac flags
81JFLAGS= -g -d $(CLASSES) -sourcepath $(APICLASSPATH) -deprecation
82
83# The default make rule for Java files
84COMPILE.java=$(JAVAC) $(JFLAGS)
85
86$(CLASSES)/$(PKGPATH)/%.class:	$(APIJAVASRC)/$(PKGPATH)/%.java
87				$(COMPILE.java) $<
88
89# javah generated headers
90APIHDR= LocalConsumer.h
91JNIHDRS=$(JNI)/$(APIHDRS)
92
93# API classes with native methods
94JNI_CLASSNAMES=\
95    LocalConsumer
96
97JNI_CLASSES=${JNI_CLASSNAMES:%=%.class}
98DTRACE_JNI_CLASSES=${JNI_CLASSES:%=$(CLASSES)/$(PKGPATH)/%}
99JNI_FULL_CLASSNAMES=${JNI_CLASSNAMES:%=$(PKGNAME).%}
100
101# All API classes
102API_CLASSNAMES=\
103	AbstractAggregationValue \
104	Aggregate \
105	AggregateSpec \
106	Aggregation \
107	AggregationRecord \
108	AggregationValue \
109	AvgValue \
110	Consumer \
111	ConsumerAdapter \
112	ConsumerEvent \
113	ConsumerException \
114	ConsumerListener \
115	CountValue \
116	DTraceException \
117	DataEvent \
118	Distribution \
119	Drop \
120	DropEvent \
121	Error \
122	ErrorEvent \
123	ExceptionHandler \
124	ExitRecord \
125	Flow \
126	InterfaceAttributes \
127	KernelStackRecord \
128	KernelSymbolRecord \
129	LinearDistribution \
130	LocalConsumer \
131	LogDistribution \
132	MaxValue \
133	MinValue \
134	NativeException \
135	Option \
136	PrintaRecord \
137	PrintfRecord \
138	Probe \
139	ProbeData \
140	ProbeDescription \
141	ProbeInfo \
142	ProcessEvent \
143	ProcessState \
144	Program \
145	ProgramInfo \
146	Record \
147	ResourceLimitException \
148	ScalarRecord \
149	StackFrame \
150	StackValueRecord \
151	SumValue \
152	SymbolValueRecord \
153	Tuple \
154	UserStackRecord \
155	UserSymbolRecord \
156	Utility \
157	ValueRecord
158
159API_CLASSES=${API_CLASSNAMES:%=%.class}
160DTRACE_API_CLASSES=${API_CLASSES:%=$(CLASSES)/$(PKGPATH)/%}
161
162
163all:            $(CLASSES) $(DTRACE_API_CLASSES) $(JNI)/$(APIHDR)
164
165clean:
166		-$(RM) $(CLASSES)/$(PKGPATH)/*.class
167		-$(RM) $(JNI)/*.h
168		-$(RM) -r $(DOCAPI)
169
170clobber:	clean
171		-$(RM) $(JARS)/*.jar
172
173# Make the class dir, if it doesn't exist
174$(CLASSES):
175		-@mkdir -p $@
176
177# Make the directory for javah-generated headers, if it doesn't exist
178$(JNI):
179		-@mkdir -p $@
180
181$(JNI)/$(APIHDR): $(JNI) $(DTRACE_JNI_CLASSES)
182		$(JAVAH) -o $@ -classpath $(CLASSES) $(JNI_FULL_CLASSNAMES)
183		-@touch $@
184
185# Rule for installing API javadoc.
186$(DOCAPIDESTDIR)/index.html: $(DTRACE_API_CLASSES)
187		-@mkdir -p $(DOCAPIDESTDIR)
188		-$(RM) -r $(DOCAPIDESTDIR)/*
189		cd $(APIJAVASRC); umask 022; \
190		$(JAVADOC) -protected -use -notimestamp \
191		-classpath $(APICLASSPATH) -d $(DOCAPIDESTDIR) \
192		$(PKGNAME)
193
194$(CLASSES)/$(PKGPATH):
195		$(INS.dir)
196
197$(JARS)/$(APIJAR): $(DTRACE_API_CLASSES) $(APIMANI)
198		-@mkdir -p $(JARS)
199		$(JAR) cfm $@ $(APIMANI) -C $(CLASSES) .
200
201$(JARDESTDIR):
202		$(INS.dir)
203
204$(DOCDESTDIR):
205		$(INS.dir)
206
207$(DOCAPIDESTDIR):
208		$(INS.dir)
209
210$(DOCEXAMPLESDESTDIR):
211		$(INS.dir)
212
213$(DOCHTMLDESTDIR):
214		$(INS.dir)
215
216$(DOCIMAGESDESTDIR):
217		$(INS.dir)
218
219install:	all $(JARDESTDIR) $(INSJARS) $(DOCDESTDIR) \
220	$(DOCAPIDESTDIR) \
221	$(DOCAPIDESTDIR)/index.html \
222	$(DOCEXAMPLESDESTDIR) \
223	$(DOCEXAMPLESDESTDIR)/TestAPI.java \
224	$(DOCEXAMPLESDESTDIR)/TestAPI2.java \
225	$(DOCEXAMPLESDESTDIR)/TestTarget.java \
226	$(DOCEXAMPLESDESTDIR)/hello.d \
227	$(DOCEXAMPLESDESTDIR)/intrstat.d \
228	$(DOCEXAMPLESDESTDIR)/syscall.d \
229	$(DOCEXAMPLESDESTDIR)/target.d \
230	$(DOCHTMLDESTDIR) \
231	$(DOCHTMLDESTDIR)/JavaDTraceAPI.html \
232	$(DOCHTMLDESTDIR)/fast.html \
233	$(DOCIMAGESDESTDIR) \
234	$(DOCIMAGESDESTDIR)/JavaDTraceAPI.gif
235
236# empty targets for top-level building compatability
237
238install_h lint:
239
240# create API javadoc
241
242doc:
243		-@mkdir -p $(DOCAPI)
244		cd $(APIJAVASRC); umask 022; \
245		$(JAVADOC) -protected -use -notimestamp \
246		-classpath $(APICLASSPATH) -d $(DOCAPI) \
247		$(PKGNAME)
248