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 # Copyright 2014 PALO, Richard. All rights reserved.
27 #
28
29 include $(SRC)/Makefile.master
30
31 # The Java DTrace API package
32
33 PKGPATH=org/opensolaris/os/dtrace
34 PKGNAME=org.opensolaris.os.dtrace
35
36 # The Java DTrace API directories
37
38 APIDIR=$(SRC)/lib/libdtrace_jni/java
39 CLASSES=$(APIDIR)/classes
40 JNI=$(APIDIR)/native
41 JARS=$(APIDIR)/lib
42 DOCS=$(APIDIR)/docs
43 DOCAPI=$(DOCS)/api
44 DOCEXAMPLES=$(DOCS)/examples
45 DOCHTML=$(DOCS)/html
46 DOCIMAGES=$(DOCS)/images
47 MANIFEST=$(APIDIR)/manifest
48 APIJAVASRC=$(APIDIR)/src
49
50 # Java DTrace API jar file, its ultimate destination, and packaging details
51 APIJAR=dtrace.jar
52 JARDESTDIR=$(ROOT)/usr/share/lib/java
53 INSJARS=$(JARDESTDIR)/$(APIJAR)
54 # javadoc
55 DOCDESTDIR=$(ROOT)/usr/share/lib/java/javadoc/dtrace
56 DOCAPIDESTDIR=$(DOCDESTDIR)/api
57 DOCEXAMPLESDESTDIR=$(DOCDESTDIR)/examples
58 DOCHTMLDESTDIR=$(DOCDESTDIR)/html
59 DOCIMAGESDESTDIR=$(DOCDESTDIR)/images
60 $(BLD_JAVA_8)XDOCLINT_OPTION=-Xdoclint:none
61
62 $(JARDESTDIR)/%: $(JARS)/%
63 $(INS.file)
64
65 $(DOCEXAMPLESDESTDIR)/%: $(DOCEXAMPLES)/%
66 $(INS.file)
67
68 $(DOCHTMLDESTDIR)/%: $(DOCHTML)/%
69 $(INS.file)
70
71 $(DOCIMAGESDESTDIR)/%: $(DOCIMAGES)/%
72 $(INS.file)
73
74 # Manifest files
75 APIMANI= $(MANIFEST)/dtrace.mf
76 MANIFESTS= $(APIMANI)
77
78 # Controlled CLASSPATH for making
79 APICLASSPATH=$(CLASSES):$(APIJAVASRC)
80
81 # javac flags
82 JFLAGS= -g -d $(CLASSES) -sourcepath $(APICLASSPATH)
83 JFLAGS += -source 1.5 -target 1.6
84 JFLAGS += -Xlint:all,-rawtypes,-options
85
86 # The default make rule for Java files
87 COMPILE.java=$(JAVAC) $(JFLAGS)
88
89 $(CLASSES)/$(PKGPATH)/%.class: $(APIJAVASRC)/$(PKGPATH)/%.java
90 $(COMPILE.java) $<
91
92 # javah generated headers
93 APIHDR= LocalConsumer.h
94 JNIHDRS=$(JNI)/$(APIHDR)
95
96 # API classes with native methods
97 JNI_CLASSNAMES=\
98 LocalConsumer
99
100 JNI_CLASSES=${JNI_CLASSNAMES:%=%.class}
101 DTRACE_JNI_CLASSES=${JNI_CLASSES:%=$(CLASSES)/$(PKGPATH)/%}
102 JNI_FULL_CLASSNAMES=${JNI_CLASSNAMES:%=$(PKGNAME).%}
103
104 # All API classes
105 API_CLASSNAMES=\
106 AbstractAggregationValue \
107 Aggregate \
108 AggregateSpec \
109 Aggregation \
110 AggregationRecord \
111 AggregationValue \
112 AvgValue \
113 Consumer \
114 ConsumerAdapter \
115 ConsumerEvent \
116 ConsumerException \
117 ConsumerListener \
118 CountValue \
119 DTraceException \
120 DataEvent \
121 Distribution \
122 Drop \
123 DropEvent \
124 Error \
125 ErrorEvent \
126 ExceptionHandler \
127 ExitRecord \
128 Flow \
129 InterfaceAttributes \
130 KernelStackRecord \
131 KernelSymbolRecord \
132 LinearDistribution \
133 LocalConsumer \
134 LogDistribution \
135 LogLinearDistribution \
136 MaxValue \
137 MinValue \
138 NativeException \
139 Option \
140 PrintaRecord \
141 PrintfRecord \
142 Probe \
143 ProbeData \
144 ProbeDescription \
145 ProbeInfo \
146 ProcessEvent \
147 ProcessState \
148 Program \
149 ProgramInfo \
150 Record \
151 ResourceLimitException \
152 ScalarRecord \
153 StackFrame \
154 StackValueRecord \
155 StddevValue \
156 SumValue \
157 SymbolValueRecord \
158 Tuple \
159 UserStackRecord \
160 UserSymbolRecord \
161 Utility \
162 ValueRecord
163
164 API_CLASSES=${API_CLASSNAMES:%=%.class}
165 DTRACE_API_CLASSES=${API_CLASSES:%=$(CLASSES)/$(PKGPATH)/%}
166
167
168 all: $(CLASSES) $(DTRACE_API_CLASSES) $(JNI)/$(APIHDR)
169
170 clean:
171 -$(RM) $(CLASSES)/$(PKGPATH)/*.class
172 -$(RM) $(JNI)/*.h
173 -$(RM) -r $(DOCAPI)
174
175 clobber: clean
176 -$(RM) $(JARS)/*.jar
177
178 # Make the class dir, if it doesn't exist
179 $(CLASSES):
180 -@mkdir -p $@
181
182 # Make the directory for javah-generated headers, if it doesn't exist
183 $(JNI):
184 -@mkdir -p $@
185
186 $(JNI)/$(APIHDR): $(JNI) $(DTRACE_JNI_CLASSES)
187 $(JAVAH) -o $@ -classpath $(CLASSES) $(JNI_FULL_CLASSNAMES)
188 -@touch $@
189
190 # Rule for installing API javadoc.
191 $(DOCAPIDESTDIR)/index.html: $(DTRACE_API_CLASSES)
192 -@mkdir -p $(DOCAPIDESTDIR)
193 -$(RM) -r $(DOCAPIDESTDIR)/*
194 cd $(APIJAVASRC); umask 022; \
195 $(JAVADOC) -protected -use -notimestamp $(XDOCLINT_OPTION) \
196 -classpath $(APICLASSPATH) -d $(DOCAPIDESTDIR) \
197 $(PKGNAME)
198
199 $(CLASSES)/$(PKGPATH):
200 $(INS.dir)
201
202 $(JARS)/$(APIJAR): $(DTRACE_API_CLASSES) $(APIMANI)
203 -@mkdir -p $(JARS)
204 $(JAR) cfm $@ $(APIMANI) -C $(CLASSES) .
205
206 $(JARDESTDIR):
207 $(INS.dir)
208
209 $(DOCDESTDIR):
210 $(INS.dir)
211
212 $(DOCAPIDESTDIR):
213 $(INS.dir)
214
215 $(DOCEXAMPLESDESTDIR):
216 $(INS.dir)
217
218 $(DOCHTMLDESTDIR):
219 $(INS.dir)
220
221 $(DOCIMAGESDESTDIR):
222 $(INS.dir)
223
224 install: all $(JARDESTDIR) $(INSJARS) $(DOCDESTDIR) \
225 $(DOCAPIDESTDIR) \
226 $(DOCAPIDESTDIR)/index.html \
227 $(DOCEXAMPLESDESTDIR) \
228 $(DOCEXAMPLESDESTDIR)/TestAPI.java \
229 $(DOCEXAMPLESDESTDIR)/TestAPI2.java \
230 $(DOCEXAMPLESDESTDIR)/TestTarget.java \
231 $(DOCEXAMPLESDESTDIR)/hello.d \
232 $(DOCEXAMPLESDESTDIR)/intrstat.d \
233 $(DOCEXAMPLESDESTDIR)/syscall.d \
234 $(DOCEXAMPLESDESTDIR)/target.d \
235 $(DOCHTMLDESTDIR) \
236 $(DOCHTMLDESTDIR)/JavaDTraceAPI.html \
237 $(DOCHTMLDESTDIR)/fast.html \
238 $(DOCIMAGESDESTDIR) \
239 $(DOCIMAGESDESTDIR)/JavaDTraceAPI.gif
240
241 # empty targets for top-level building compatability
242
243 install_h lint:
244
245 # create API javadoc
246
247 doc:
248 -@mkdir -p $(DOCAPI)
249 cd $(APIJAVASRC); umask 022; \
250 $(JAVADOC) -protected -use -notimestamp \
251 -classpath $(APICLASSPATH) -d $(DOCAPI) \
252 $(PKGNAME)