xref: /titanic_41/usr/src/lib/libdtrace_jni/java/Makefile (revision a18dc42fc967d11feba9b8be61c6727dc6c56b48)
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#
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
82JFLAGS += -target 1.5
83JFLAGS += -Xlint
84
85# The default make rule for Java files
86COMPILE.java=$(JAVAC) $(JFLAGS)
87
88$(CLASSES)/$(PKGPATH)/%.class:	$(APIJAVASRC)/$(PKGPATH)/%.java
89				$(COMPILE.java) $<
90
91# javah generated headers
92APIHDR= LocalConsumer.h
93JNIHDRS=$(JNI)/$(APIHDRS)
94
95# API classes with native methods
96JNI_CLASSNAMES=\
97    LocalConsumer
98
99JNI_CLASSES=${JNI_CLASSNAMES:%=%.class}
100DTRACE_JNI_CLASSES=${JNI_CLASSES:%=$(CLASSES)/$(PKGPATH)/%}
101JNI_FULL_CLASSNAMES=${JNI_CLASSNAMES:%=$(PKGNAME).%}
102
103# All API classes
104API_CLASSNAMES=\
105	AbstractAggregationValue \
106	Aggregate \
107	AggregateSpec \
108	Aggregation \
109	AggregationRecord \
110	AggregationValue \
111	AvgValue \
112	Consumer \
113	ConsumerAdapter \
114	ConsumerEvent \
115	ConsumerException \
116	ConsumerListener \
117	CountValue \
118	DTraceException \
119	DataEvent \
120	Distribution \
121	Drop \
122	DropEvent \
123	Error \
124	ErrorEvent \
125	ExceptionHandler \
126	ExitRecord \
127	Flow \
128	InterfaceAttributes \
129	KernelStackRecord \
130	KernelSymbolRecord \
131	LinearDistribution \
132	LocalConsumer \
133	LogDistribution \
134	MaxValue \
135	MinValue \
136	NativeException \
137	Option \
138	PrintaRecord \
139	PrintfRecord \
140	Probe \
141	ProbeData \
142	ProbeDescription \
143	ProbeInfo \
144	ProcessEvent \
145	ProcessState \
146	Program \
147	ProgramInfo \
148	Record \
149	ResourceLimitException \
150	ScalarRecord \
151	StackFrame \
152	StackValueRecord \
153	StddevValue \
154	SumValue \
155	SymbolValueRecord \
156	Tuple \
157	UserStackRecord \
158	UserSymbolRecord \
159	Utility \
160	ValueRecord
161
162API_CLASSES=${API_CLASSNAMES:%=%.class}
163DTRACE_API_CLASSES=${API_CLASSES:%=$(CLASSES)/$(PKGPATH)/%}
164
165
166all:            $(CLASSES) $(DTRACE_API_CLASSES) $(JNI)/$(APIHDR)
167
168clean:
169		-$(RM) $(CLASSES)/$(PKGPATH)/*.class
170		-$(RM) $(JNI)/*.h
171		-$(RM) -r $(DOCAPI)
172
173clobber:	clean
174		-$(RM) $(JARS)/*.jar
175
176# Make the class dir, if it doesn't exist
177$(CLASSES):
178		-@mkdir -p $@
179
180# Make the directory for javah-generated headers, if it doesn't exist
181$(JNI):
182		-@mkdir -p $@
183
184$(JNI)/$(APIHDR): $(JNI) $(DTRACE_JNI_CLASSES)
185		$(JAVAH) -o $@ -classpath $(CLASSES) $(JNI_FULL_CLASSNAMES)
186		-@touch $@
187
188# Rule for installing API javadoc.
189$(DOCAPIDESTDIR)/index.html: $(DTRACE_API_CLASSES)
190		-@mkdir -p $(DOCAPIDESTDIR)
191		-$(RM) -r $(DOCAPIDESTDIR)/*
192		cd $(APIJAVASRC); umask 022; \
193		$(JAVADOC) -protected -use -notimestamp \
194		-classpath $(APICLASSPATH) -d $(DOCAPIDESTDIR) \
195		$(PKGNAME)
196
197$(CLASSES)/$(PKGPATH):
198		$(INS.dir)
199
200$(JARS)/$(APIJAR): $(DTRACE_API_CLASSES) $(APIMANI)
201		-@mkdir -p $(JARS)
202		$(JAR) cfm $@ $(APIMANI) -C $(CLASSES) .
203
204$(JARDESTDIR):
205		$(INS.dir)
206
207$(DOCDESTDIR):
208		$(INS.dir)
209
210$(DOCAPIDESTDIR):
211		$(INS.dir)
212
213$(DOCEXAMPLESDESTDIR):
214		$(INS.dir)
215
216$(DOCHTMLDESTDIR):
217		$(INS.dir)
218
219$(DOCIMAGESDESTDIR):
220		$(INS.dir)
221
222install:	all $(JARDESTDIR) $(INSJARS) $(DOCDESTDIR) \
223	$(DOCAPIDESTDIR) \
224	$(DOCAPIDESTDIR)/index.html \
225	$(DOCEXAMPLESDESTDIR) \
226	$(DOCEXAMPLESDESTDIR)/TestAPI.java \
227	$(DOCEXAMPLESDESTDIR)/TestAPI2.java \
228	$(DOCEXAMPLESDESTDIR)/TestTarget.java \
229	$(DOCEXAMPLESDESTDIR)/hello.d \
230	$(DOCEXAMPLESDESTDIR)/intrstat.d \
231	$(DOCEXAMPLESDESTDIR)/syscall.d \
232	$(DOCEXAMPLESDESTDIR)/target.d \
233	$(DOCHTMLDESTDIR) \
234	$(DOCHTMLDESTDIR)/JavaDTraceAPI.html \
235	$(DOCHTMLDESTDIR)/fast.html \
236	$(DOCIMAGESDESTDIR) \
237	$(DOCIMAGESDESTDIR)/JavaDTraceAPI.gif
238
239# empty targets for top-level building compatability
240
241install_h lint:
242
243# create API javadoc
244
245doc:
246		-@mkdir -p $(DOCAPI)
247		cd $(APIJAVASRC); umask 022; \
248		$(JAVADOC) -protected -use -notimestamp \
249		-classpath $(APICLASSPATH) -d $(DOCAPI) \
250		$(PKGNAME)
251