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); $(JAVADOC) -protected -use \ 187 -classpath $(APICLASSPATH) -d $(DOCAPIDESTDIR) \ 188 $(PKGNAME) 189 190$(CLASSES)/$(PKGPATH): 191 $(INS.dir) 192 193$(JARS)/$(APIJAR): $(DTRACE_API_CLASSES) $(APIMANI) 194 -@mkdir -p $(JARS) 195 $(JAR) cfm $@ $(APIMANI) -C $(CLASSES) . 196 197$(JARDESTDIR): 198 $(INS.dir) 199 200$(DOCDESTDIR): 201 $(INS.dir) 202 203$(DOCAPIDESTDIR): 204 $(INS.dir) 205 206$(DOCEXAMPLESDESTDIR): 207 $(INS.dir) 208 209$(DOCHTMLDESTDIR): 210 $(INS.dir) 211 212$(DOCIMAGESDESTDIR): 213 $(INS.dir) 214 215install: all $(JARDESTDIR) $(INSJARS) $(DOCDESTDIR) \ 216 $(DOCAPIDESTDIR) \ 217 $(DOCAPIDESTDIR)/index.html \ 218 $(DOCEXAMPLESDESTDIR) \ 219 $(DOCEXAMPLESDESTDIR)/TestAPI.java \ 220 $(DOCEXAMPLESDESTDIR)/TestAPI2.java \ 221 $(DOCEXAMPLESDESTDIR)/TestTarget.java \ 222 $(DOCEXAMPLESDESTDIR)/hello.d \ 223 $(DOCEXAMPLESDESTDIR)/intrstat.d \ 224 $(DOCEXAMPLESDESTDIR)/syscall.d \ 225 $(DOCEXAMPLESDESTDIR)/target.d \ 226 $(DOCHTMLDESTDIR) \ 227 $(DOCHTMLDESTDIR)/JavaDTraceAPI.html \ 228 $(DOCHTMLDESTDIR)/fast.html \ 229 $(DOCIMAGESDESTDIR) \ 230 $(DOCIMAGESDESTDIR)/JavaDTraceAPI.gif 231 232# empty targets for top-level building compatability 233 234install_h lint: 235 236# create API javadoc 237 238doc: 239 -@mkdir -p $(DOCAPI) 240 cd $(APIJAVASRC); $(JAVADOC) -protected -use \ 241 -classpath $(APICLASSPATH) -d $(DOCAPI) \ 242 $(PKGNAME) 243