xref: /illumos-gate/usr/src/lib/libdtrace_jni/java/Makefile (revision 6a817834d81cc75ce12d0d393320837b1fec1e85)
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 2020 Peter Tribble
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
40JARS=$(APIDIR)/lib
41DOCS=$(APIDIR)/docs
42DOCAPI=$(DOCS)/api
43DOCEXAMPLES=$(DOCS)/examples
44DOCHTML=$(DOCS)/html
45DOCIMAGES=$(DOCS)/images
46MANIFEST=$(APIDIR)/manifest
47APIJAVASRC=$(APIDIR)/src
48
49# Java DTrace API jar file, its ultimate destination, and packaging details
50APIJAR=dtrace.jar
51JARDESTDIR=$(ROOT)/usr/share/lib/java
52INSJARS=$(JARDESTDIR)/$(APIJAR)
53# javadoc
54DOCDESTDIR=$(ROOT)/usr/share/lib/java/javadoc/dtrace
55DOCAPIDESTDIR=$(DOCDESTDIR)/api
56DOCEXAMPLESDESTDIR=$(DOCDESTDIR)/examples
57DOCHTMLDESTDIR=$(DOCDESTDIR)/html
58DOCIMAGESDESTDIR=$(DOCDESTDIR)/images
59XDOCLINT_OPTION=-Xdoclint:none
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)
82JFLAGS += -source 7 -target 7
83JFLAGS += -Xlint:all,-deprecation,-rawtypes,-options
84
85# The default make rule for Java files
86COMPILE.java=$(JAVAC) $(JFLAGS)
87
88$(CLASSES)/$(PKGPATH)/%.class:	$(APIJAVASRC)/$(PKGPATH)/%.java
89				$(COMPILE.java) $<
90
91# All API classes
92API_CLASSNAMES=\
93	AbstractAggregationValue \
94	Aggregate \
95	AggregateSpec \
96	Aggregation \
97	AggregationRecord \
98	AggregationValue \
99	AvgValue \
100	Consumer \
101	ConsumerAdapter \
102	ConsumerEvent \
103	ConsumerException \
104	ConsumerListener \
105	CountValue \
106	DTraceException \
107	DataEvent \
108	Distribution \
109	Drop \
110	DropEvent \
111	Error \
112	ErrorEvent \
113	ExceptionHandler \
114	ExitRecord \
115	Flow \
116	InterfaceAttributes \
117	KernelStackRecord \
118	KernelSymbolRecord \
119	LinearDistribution \
120	LocalConsumer \
121	LogDistribution \
122	LogLinearDistribution \
123	MaxValue \
124	MinValue \
125	NativeException \
126	Option \
127	PrintaRecord \
128	PrintfRecord \
129	Probe \
130	ProbeData \
131	ProbeDescription \
132	ProbeInfo \
133	ProcessEvent \
134	ProcessState \
135	Program \
136	ProgramInfo \
137	Record \
138	ResourceLimitException \
139	ScalarRecord \
140	StackFrame \
141	StackValueRecord \
142	StddevValue \
143	SumValue \
144	SymbolValueRecord \
145	Tuple \
146	UserStackRecord \
147	UserSymbolRecord \
148	Utility \
149	ValueRecord
150
151API_CLASSES=${API_CLASSNAMES:%=%.class}
152DTRACE_API_CLASSES=${API_CLASSES:%=$(CLASSES)/$(PKGPATH)/%}
153
154
155all:            $(CLASSES) $(DTRACE_API_CLASSES)
156
157clean:
158		-$(RM) $(CLASSES)/$(PKGPATH)/*.class
159		-$(RM) -r $(DOCAPI)
160
161clobber:	clean
162		-$(RM) $(JARS)/*.jar
163
164# Make the class dir, if it doesn't exist
165$(CLASSES):
166		-@mkdir -p $@
167
168# Rule for installing API javadoc.
169$(DOCAPIDESTDIR)/index.html: $(DTRACE_API_CLASSES)
170		-@mkdir -p $(DOCAPIDESTDIR)
171		-$(RM) -r $(DOCAPIDESTDIR)/*
172		cd $(APIJAVASRC); umask 022; \
173		$(JAVADOC) -protected -use -notimestamp $(XDOCLINT_OPTION) \
174		-classpath $(APICLASSPATH) -d $(DOCAPIDESTDIR) \
175		$(PKGNAME)
176
177$(CLASSES)/$(PKGPATH):
178		$(INS.dir)
179
180$(JARS)/$(APIJAR): $(DTRACE_API_CLASSES) $(APIMANI)
181		-@mkdir -p $(JARS)
182		$(JAR) cfm $@ $(APIMANI) -C $(CLASSES) .
183
184$(JARDESTDIR):
185		$(INS.dir)
186
187$(DOCDESTDIR):
188		$(INS.dir)
189
190$(DOCAPIDESTDIR):
191		$(INS.dir)
192
193$(DOCEXAMPLESDESTDIR):
194		$(INS.dir)
195
196$(DOCHTMLDESTDIR):
197		$(INS.dir)
198
199$(DOCIMAGESDESTDIR):
200		$(INS.dir)
201
202install:	all $(JARDESTDIR) $(INSJARS) $(DOCDESTDIR) \
203	$(DOCAPIDESTDIR) \
204	$(DOCAPIDESTDIR)/index.html \
205	$(DOCEXAMPLESDESTDIR) \
206	$(DOCEXAMPLESDESTDIR)/TestAPI.java \
207	$(DOCEXAMPLESDESTDIR)/TestAPI2.java \
208	$(DOCEXAMPLESDESTDIR)/TestTarget.java \
209	$(DOCEXAMPLESDESTDIR)/hello.d \
210	$(DOCEXAMPLESDESTDIR)/intrstat.d \
211	$(DOCEXAMPLESDESTDIR)/syscall.d \
212	$(DOCEXAMPLESDESTDIR)/target.d \
213	$(DOCHTMLDESTDIR) \
214	$(DOCHTMLDESTDIR)/JavaDTraceAPI.html \
215	$(DOCHTMLDESTDIR)/fast.html \
216	$(DOCIMAGESDESTDIR) \
217	$(DOCIMAGESDESTDIR)/JavaDTraceAPI.gif
218
219# empty targets for top-level building compatability
220install_h:
221
222# create API javadoc
223doc:
224		-@mkdir -p $(DOCAPI)
225		cd $(APIJAVASRC); umask 022; \
226		$(JAVADOC) -protected -use -notimestamp \
227		-classpath $(APICLASSPATH) -d $(DOCAPI) \
228		$(PKGNAME)
229