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
27 include $(SRC)/Makefile.master
28
29 # The Java DTrace API package
30
31 PKGPATH=org/opensolaris/os/dtrace
32 PKGNAME=org.opensolaris.os.dtrace
33
34 # The Java DTrace API directories
35
36 APIDIR=$(SRC)/lib/libdtrace_jni/java
37 CLASSES=$(APIDIR)/classes
38 JNI=$(APIDIR)/native
39 JARS=$(APIDIR)/lib
40 DOCS=$(APIDIR)/docs
41 DOCAPI=$(DOCS)/api
42 DOCEXAMPLES=$(DOCS)/examples
43 DOCHTML=$(DOCS)/html
44 DOCIMAGES=$(DOCS)/images
45 MANIFEST=$(APIDIR)/manifest
46 APIJAVASRC=$(APIDIR)/src
47
48 # Java DTrace API jar file, its ultimate destination, and packaging details
49 APIJAR=dtrace.jar
50 JARDESTDIR=$(ROOT)/usr/share/lib/java
51 INSJARS=$(JARDESTDIR)/$(APIJAR)
52 # javadoc
53 DOCDESTDIR=$(ROOT)/usr/share/lib/java/javadoc/dtrace
54 DOCAPIDESTDIR=$(DOCDESTDIR)/api
55 DOCEXAMPLESDESTDIR=$(DOCDESTDIR)/examples
56 DOCHTMLDESTDIR=$(DOCDESTDIR)/html
57 DOCIMAGESDESTDIR=$(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
73 APIMANI= $(MANIFEST)/dtrace.mf
74 MANIFESTS= $(APIMANI)
75
76 # Controlled CLASSPATH for making
77 APICLASSPATH=$(CLASSES):$(APIJAVASRC)
78
79 # javac flags
80 JFLAGS= -g -d $(CLASSES) -sourcepath $(APICLASSPATH)
81 JFLAGS += -source 1.5 -target 1.6
82 JFLAGS += -Xlint:all,-rawtypes,-options
83
84 # The default make rule for Java files
85 COMPILE.java=$(JAVAC) $(JFLAGS)
86
87 $(CLASSES)/$(PKGPATH)/%.class: $(APIJAVASRC)/$(PKGPATH)/%.java
88 $(COMPILE.java) $<
89
90 # javah generated headers
91 APIHDR= LocalConsumer.h
92 JNIHDRS=$(JNI)/$(APIHDR)
93
94 # API classes with native methods
95 JNI_CLASSNAMES=\
96 LocalConsumer
97
98 JNI_CLASSES=${JNI_CLASSNAMES:%=%.class}
99 DTRACE_JNI_CLASSES=${JNI_CLASSES:%=$(CLASSES)/$(PKGPATH)/%}
100 JNI_FULL_CLASSNAMES=${JNI_CLASSNAMES:%=$(PKGNAME).%}
101
102 # All API classes
103 API_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
162 API_CLASSES=${API_CLASSNAMES:%=%.class}
163 DTRACE_API_CLASSES=${API_CLASSES:%=$(CLASSES)/$(PKGPATH)/%}
164
165
166 all: $(CLASSES) $(DTRACE_API_CLASSES) $(JNI)/$(APIHDR)
167
168 clean:
169 -$(RM) $(CLASSES)/$(PKGPATH)/*.class
170 -$(RM) $(JNI)/*.h
171 -$(RM) -r $(DOCAPI)
172
173 clobber: 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
222 install: 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
241 install_h lint:
242
243 # create API javadoc
244
245 doc:
246 -@mkdir -p $(DOCAPI)
247 cd $(APIJAVASRC); umask 022; \
248 $(JAVADOC) -protected -use -notimestamp \
249 -classpath $(APICLASSPATH) -d $(DOCAPI) \
250 $(PKGNAME)