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