xref: /illumos-gate/usr/src/lib/libdtrace_jni/java/Makefile (revision 45ede40b2394db7967e59f19288fae9b62efd4aa)
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
41# the files in the docs directory go with the api javadoc
42# which can be generated using the doc target
43# the documentation is not built or packaged by default
44DOCS=$(APIDIR)/docs
45DOCAPI=$(DOCS)/api
46DOCEXAMPLES=$(DOCS)/examples
47DOCHTML=$(DOCS)/html
48DOCIMAGES=$(DOCS)/images
49MANIFEST=$(APIDIR)/manifest
50APIJAVASRC=$(APIDIR)/src
51
52# Java DTrace API jar file, its ultimate destination, and packaging details
53APIJAR=dtrace.jar
54JARDESTDIR=$(ROOT)/usr/share/lib/java
55INSJARS=$(JARDESTDIR)/$(APIJAR)
56
57$(JARDESTDIR)/%: $(JARS)/%
58	$(INS.file)
59
60# Manifest files
61APIMANI= $(MANIFEST)/dtrace.mf
62MANIFESTS= $(APIMANI)
63
64# Controlled CLASSPATH for making
65APICLASSPATH=$(CLASSES):$(APIJAVASRC)
66
67# javac flags
68JFLAGS= -g -d $(CLASSES) -sourcepath $(APICLASSPATH)
69JFLAGS += -source 7 -target 7
70JFLAGS += -Xlint:all,-deprecation,-rawtypes,-options
71
72# The default make rule for Java files
73COMPILE.java=$(JAVAC) $(JFLAGS)
74
75$(CLASSES)/$(PKGPATH)/%.class:	$(APIJAVASRC)/$(PKGPATH)/%.java
76				$(COMPILE.java) $<
77
78# All API classes
79API_CLASSNAMES=\
80	AbstractAggregationValue \
81	Aggregate \
82	AggregateSpec \
83	Aggregation \
84	AggregationRecord \
85	AggregationValue \
86	AvgValue \
87	Consumer \
88	ConsumerAdapter \
89	ConsumerEvent \
90	ConsumerException \
91	ConsumerListener \
92	CountValue \
93	DTraceException \
94	DataEvent \
95	Distribution \
96	Drop \
97	DropEvent \
98	Error \
99	ErrorEvent \
100	ExceptionHandler \
101	ExitRecord \
102	Flow \
103	InterfaceAttributes \
104	KernelStackRecord \
105	KernelSymbolRecord \
106	LinearDistribution \
107	LocalConsumer \
108	LogDistribution \
109	LogLinearDistribution \
110	MaxValue \
111	MinValue \
112	NativeException \
113	Option \
114	PrintaRecord \
115	PrintfRecord \
116	Probe \
117	ProbeData \
118	ProbeDescription \
119	ProbeInfo \
120	ProcessEvent \
121	ProcessState \
122	Program \
123	ProgramInfo \
124	Record \
125	ResourceLimitException \
126	ScalarRecord \
127	StackFrame \
128	StackValueRecord \
129	StddevValue \
130	SumValue \
131	SymbolValueRecord \
132	Tuple \
133	UserStackRecord \
134	UserSymbolRecord \
135	Utility \
136	ValueRecord
137
138API_CLASSES=${API_CLASSNAMES:%=%.class}
139DTRACE_API_CLASSES=${API_CLASSES:%=$(CLASSES)/$(PKGPATH)/%}
140
141
142all:            $(CLASSES) $(DTRACE_API_CLASSES)
143
144clean:
145		-$(RM) $(CLASSES)/$(PKGPATH)/*.class
146		-$(RM) -r $(DOCAPI)
147
148clobber:	clean
149		-$(RM) $(JARS)/*.jar
150
151# Make the class dir, if it doesn't exist
152$(CLASSES):
153		-@mkdir -p $@
154
155$(CLASSES)/$(PKGPATH):
156		$(INS.dir)
157
158$(JARS)/$(APIJAR): $(DTRACE_API_CLASSES) $(APIMANI)
159		-@mkdir -p $(JARS)
160		$(JAR) cfm $@ $(APIMANI) -C $(CLASSES) .
161
162$(JARDESTDIR):
163		$(INS.dir)
164
165install:	all $(JARDESTDIR) $(INSJARS)
166
167# empty targets for top-level building compatability
168install_h:
169
170# create API javadoc
171doc:
172		-@mkdir -p $(DOCAPI)
173		cd $(APIJAVASRC); umask 022; \
174		$(JAVADOC) -protected -use -notimestamp \
175		-classpath $(APICLASSPATH) -d $(DOCAPI) \
176		$(PKGNAME)
177