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