xref: /titanic_44/usr/src/lib/libdtrace_jni/java/Makefile (revision 4d0eb50e691de4c20b1dd9976ad6839fede8a42d)
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
27include $(SRC)/Makefile.master
28
29# The Java DTrace API package
30
31PKGPATH=org/opensolaris/os/dtrace
32PKGNAME=org.opensolaris.os.dtrace
33
34# The Java DTrace API directories
35
36APIDIR=$(SRC)/lib/libdtrace_jni/java
37CLASSES=$(APIDIR)/classes
38JNI=$(APIDIR)/native
39JARS=$(APIDIR)/lib
40DOCS=$(APIDIR)/docs
41DOCAPI=$(DOCS)/api
42DOCEXAMPLES=$(DOCS)/examples
43DOCHTML=$(DOCS)/html
44DOCIMAGES=$(DOCS)/images
45MANIFEST=$(APIDIR)/manifest
46APIJAVASRC=$(APIDIR)/src
47
48# Java DTrace API jar file, its ultimate destination, and packaging details
49APIJAR=dtrace.jar
50JARDESTDIR=$(ROOT)/usr/share/lib/java
51INSJARS=$(JARDESTDIR)/$(APIJAR)
52# javadoc
53DOCDESTDIR=$(ROOT)/usr/share/lib/java/javadoc/dtrace
54DOCAPIDESTDIR=$(DOCDESTDIR)/api
55DOCEXAMPLESDESTDIR=$(DOCDESTDIR)/examples
56DOCHTMLDESTDIR=$(DOCDESTDIR)/html
57DOCIMAGESDESTDIR=$(DOCDESTDIR)/images
58
59$(JARDESTDIR)/%: $(JARS)/%
60	$(INS.file)
61
62$(DOCEXAMPLESDESTDIR)/%: $(DOCEXAMPLES)/%
63	$(INS.file)
64
65$(DOCHTMLDESTDIR)/%: $(DOCHTML)/%
66	$(INS.file)
67
68$(DOCIMAGESDESTDIR)/%: $(DOCIMAGES)/%
69	$(INS.file)
70
71# Manifest files
72APIMANI= $(MANIFEST)/dtrace.mf
73MANIFESTS= $(APIMANI)
74
75# Controlled CLASSPATH for making
76APICLASSPATH=$(CLASSES):$(APIJAVASRC)
77
78# javac flags
79JFLAGS= -g -d $(CLASSES) -sourcepath $(APICLASSPATH)
80JFLAGS += -source 1.5 -target 1.6
81JFLAGS += -Xlint:all,-rawtypes,-options
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)/$(APIHDR)
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	LogLinearDistribution \
133	MaxValue \
134	MinValue \
135	NativeException \
136	Option \
137	PrintaRecord \
138	PrintfRecord \
139	Probe \
140	ProbeData \
141	ProbeDescription \
142	ProbeInfo \
143	ProcessEvent \
144	ProcessState \
145	Program \
146	ProgramInfo \
147	Record \
148	ResourceLimitException \
149	ScalarRecord \
150	StackFrame \
151	StackValueRecord \
152	StddevValue \
153	SumValue \
154	SymbolValueRecord \
155	Tuple \
156	UserStackRecord \
157	UserSymbolRecord \
158	Utility \
159	ValueRecord
160
161API_CLASSES=${API_CLASSNAMES:%=%.class}
162DTRACE_API_CLASSES=${API_CLASSES:%=$(CLASSES)/$(PKGPATH)/%}
163
164
165all:            $(CLASSES) $(DTRACE_API_CLASSES) $(JNI)/$(APIHDR)
166
167clean:
168		-$(RM) $(CLASSES)/$(PKGPATH)/*.class
169		-$(RM) $(JNI)/*.h
170		-$(RM) -r $(DOCAPI)
171
172clobber:	clean
173		-$(RM) $(JARS)/*.jar
174
175# Make the class dir, if it doesn't exist
176$(CLASSES):
177		-@mkdir -p $@
178
179# Make the directory for javah-generated headers, if it doesn't exist
180$(JNI):
181		-@mkdir -p $@
182
183$(JNI)/$(APIHDR): $(JNI) $(DTRACE_JNI_CLASSES)
184		$(JAVAH) -o $@ -classpath $(CLASSES) $(JNI_FULL_CLASSNAMES)
185		-@touch $@
186
187# Rule for installing API javadoc.
188$(DOCAPIDESTDIR)/index.html: $(DTRACE_API_CLASSES)
189		-@mkdir -p $(DOCAPIDESTDIR)
190		-$(RM) -r $(DOCAPIDESTDIR)/*
191		cd $(APIJAVASRC); umask 022; \
192		$(JAVADOC) -protected -use -notimestamp \
193		-classpath $(APICLASSPATH) -d $(DOCAPIDESTDIR) \
194		$(PKGNAME)
195
196$(CLASSES)/$(PKGPATH):
197		$(INS.dir)
198
199$(JARS)/$(APIJAR): $(DTRACE_API_CLASSES) $(APIMANI)
200		-@mkdir -p $(JARS)
201		$(JAR) cfm $@ $(APIMANI) -C $(CLASSES) .
202
203$(JARDESTDIR):
204		$(INS.dir)
205
206$(DOCDESTDIR):
207		$(INS.dir)
208
209$(DOCAPIDESTDIR):
210		$(INS.dir)
211
212$(DOCEXAMPLESDESTDIR):
213		$(INS.dir)
214
215$(DOCHTMLDESTDIR):
216		$(INS.dir)
217
218$(DOCIMAGESDESTDIR):
219		$(INS.dir)
220
221install:	all $(JARDESTDIR) $(INSJARS) $(DOCDESTDIR) \
222	$(DOCAPIDESTDIR) \
223	$(DOCAPIDESTDIR)/index.html \
224	$(DOCEXAMPLESDESTDIR) \
225	$(DOCEXAMPLESDESTDIR)/TestAPI.java \
226	$(DOCEXAMPLESDESTDIR)/TestAPI2.java \
227	$(DOCEXAMPLESDESTDIR)/TestTarget.java \
228	$(DOCEXAMPLESDESTDIR)/hello.d \
229	$(DOCEXAMPLESDESTDIR)/intrstat.d \
230	$(DOCEXAMPLESDESTDIR)/syscall.d \
231	$(DOCEXAMPLESDESTDIR)/target.d \
232	$(DOCHTMLDESTDIR) \
233	$(DOCHTMLDESTDIR)/JavaDTraceAPI.html \
234	$(DOCHTMLDESTDIR)/fast.html \
235	$(DOCIMAGESDESTDIR) \
236	$(DOCIMAGESDESTDIR)/JavaDTraceAPI.gif
237
238# empty targets for top-level building compatability
239
240install_h lint:
241
242# create API javadoc
243
244doc:
245		-@mkdir -p $(DOCAPI)
246		cd $(APIJAVASRC); umask 022; \
247		$(JAVADOC) -protected -use -notimestamp \
248		-classpath $(APICLASSPATH) -d $(DOCAPI) \
249		$(PKGNAME)
250