xref: /illumos-gate/usr/src/lib/libdtrace_jni/java/Makefile (revision 843d17d4abe05f84e05c00cec4744ac30763ca76)
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$(BLD_JAVA_8)XDOCLINT_OPTION=-Xdoclint:none
59
60$(JARDESTDIR)/%: $(JARS)/%
61	$(INS.file)
62
63$(DOCEXAMPLESDESTDIR)/%: $(DOCEXAMPLES)/%
64	$(INS.file)
65
66$(DOCHTMLDESTDIR)/%: $(DOCHTML)/%
67	$(INS.file)
68
69$(DOCIMAGESDESTDIR)/%: $(DOCIMAGES)/%
70	$(INS.file)
71
72# Manifest files
73APIMANI= $(MANIFEST)/dtrace.mf
74MANIFESTS= $(APIMANI)
75
76# Controlled CLASSPATH for making
77APICLASSPATH=$(CLASSES):$(APIJAVASRC)
78
79# javac flags
80JFLAGS= -g -d $(CLASSES) -sourcepath $(APICLASSPATH)
81JFLAGS += -source 1.5 -target 1.6
82JFLAGS += -Xlint:all,-rawtypes,-options
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)/$(APIHDR)
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	LogLinearDistribution \
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 $(XDOCLINT_OPTION) \
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