Home | History | Annotate | Download | only in java
      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 # ident	"%Z%%M%	%I%	%E% SMI"
     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 
     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
     74 APIMANI= $(MANIFEST)/dtrace.mf
     75 MANIFESTS= $(APIMANI)
     76 
     77 # Controlled CLASSPATH for making
     78 APICLASSPATH=$(CLASSES):$(APIJAVASRC)
     79 
     80 # javac flags
     81 JFLAGS= -g -d $(CLASSES) -sourcepath $(APICLASSPATH) -deprecation
     82 JFLAGS += -target 1.5
     83 JFLAGS += -Xlint
     84 
     85 # The default make rule for Java files
     86 COMPILE.java=$(JAVAC) $(JFLAGS)
     87 
     88 $(CLASSES)/$(PKGPATH)/%.class:	$(APIJAVASRC)/$(PKGPATH)/%.java
     89 				$(COMPILE.java) $<
     90 
     91 # javah generated headers
     92 APIHDR= LocalConsumer.h
     93 JNIHDRS=$(JNI)/$(APIHDRS)
     94 
     95 # API classes with native methods
     96 JNI_CLASSNAMES=\
     97     LocalConsumer
     98 
     99 JNI_CLASSES=${JNI_CLASSNAMES:%=%.class}
    100 DTRACE_JNI_CLASSES=${JNI_CLASSES:%=$(CLASSES)/$(PKGPATH)/%}
    101 JNI_FULL_CLASSNAMES=${JNI_CLASSNAMES:%=$(PKGNAME).%}
    102 
    103 # All API classes
    104 API_CLASSNAMES=\
    105 	AbstractAggregationValue \
    106 	Aggregate \
    107 	AggregateSpec \
    108 	Aggregation \
    109 	AggregationRecord \
    110 	AggregationValue \
    111 	AvgValue \
    112 	Consumer \
    113 	ConsumerAdapter \
    114 	ConsumerEvent \
    115 	ConsumerException \
    116 	ConsumerListener \
    117 	CountValue \
    118 	DTraceException \
    119 	DataEvent \
    120 	Distribution \
    121 	Drop \
    122 	DropEvent \
    123 	Error \
    124 	ErrorEvent \
    125 	ExceptionHandler \
    126 	ExitRecord \
    127 	Flow \
    128 	InterfaceAttributes \
    129 	KernelStackRecord \
    130 	KernelSymbolRecord \
    131 	LinearDistribution \
    132 	LocalConsumer \
    133 	LogDistribution \
    134 	MaxValue \
    135 	MinValue \
    136 	NativeException \
    137 	Option \
    138 	PrintaRecord \
    139 	PrintfRecord \
    140 	Probe \
    141 	ProbeData \
    142 	ProbeDescription \
    143 	ProbeInfo \
    144 	ProcessEvent \
    145 	ProcessState \
    146 	Program \
    147 	ProgramInfo \
    148 	Record \
    149 	ResourceLimitException \
    150 	ScalarRecord \
    151 	StackFrame \
    152 	StackValueRecord \
    153 	StddevValue \
    154 	SumValue \
    155 	SymbolValueRecord \
    156 	Tuple \
    157 	UserStackRecord \
    158 	UserSymbolRecord \
    159 	Utility \
    160 	ValueRecord
    161 
    162 API_CLASSES=${API_CLASSNAMES:%=%.class}
    163 DTRACE_API_CLASSES=${API_CLASSES:%=$(CLASSES)/$(PKGPATH)/%}
    164 
    165 
    166 all:            $(CLASSES) $(DTRACE_API_CLASSES) $(JNI)/$(APIHDR)
    167 
    168 clean:
    169 		-$(RM) $(CLASSES)/$(PKGPATH)/*.class
    170 		-$(RM) $(JNI)/*.h
    171 		-$(RM) -r $(DOCAPI)
    172 
    173 clobber:	clean
    174 		-$(RM) $(JARS)/*.jar
    175 
    176 # Make the class dir, if it doesn't exist
    177 $(CLASSES):
    178 		-@mkdir -p $@
    179 
    180 # Make the directory for javah-generated headers, if it doesn't exist
    181 $(JNI):
    182 		-@mkdir -p $@
    183 
    184 $(JNI)/$(APIHDR): $(JNI) $(DTRACE_JNI_CLASSES)
    185 		$(JAVAH) -o $@ -classpath $(CLASSES) $(JNI_FULL_CLASSNAMES)
    186 		-@touch $@
    187 
    188 # Rule for installing API javadoc.
    189 $(DOCAPIDESTDIR)/index.html: $(DTRACE_API_CLASSES)
    190 		-@mkdir -p $(DOCAPIDESTDIR)
    191 		-$(RM) -r $(DOCAPIDESTDIR)/*
    192 		cd $(APIJAVASRC); umask 022; \
    193 		$(JAVADOC) -protected -use -notimestamp \
    194 		-classpath $(APICLASSPATH) -d $(DOCAPIDESTDIR) \
    195 		$(PKGNAME)
    196 
    197 $(CLASSES)/$(PKGPATH):
    198 		$(INS.dir)
    199 
    200 $(JARS)/$(APIJAR): $(DTRACE_API_CLASSES) $(APIMANI)
    201 		-@mkdir -p $(JARS)
    202 		$(JAR) cfm $@ $(APIMANI) -C $(CLASSES) .
    203 
    204 $(JARDESTDIR):
    205 		$(INS.dir)
    206 
    207 $(DOCDESTDIR):
    208 		$(INS.dir)
    209 
    210 $(DOCAPIDESTDIR):
    211 		$(INS.dir)
    212 
    213 $(DOCEXAMPLESDESTDIR):
    214 		$(INS.dir)
    215 
    216 $(DOCHTMLDESTDIR):
    217 		$(INS.dir)
    218 
    219 $(DOCIMAGESDESTDIR):
    220 		$(INS.dir)
    221 
    222 install:	all $(JARDESTDIR) $(INSJARS) $(DOCDESTDIR) \
    223 	$(DOCAPIDESTDIR) \
    224 	$(DOCAPIDESTDIR)/index.html \
    225 	$(DOCEXAMPLESDESTDIR) \
    226 	$(DOCEXAMPLESDESTDIR)/TestAPI.java \
    227 	$(DOCEXAMPLESDESTDIR)/TestAPI2.java \
    228 	$(DOCEXAMPLESDESTDIR)/TestTarget.java \
    229 	$(DOCEXAMPLESDESTDIR)/hello.d \
    230 	$(DOCEXAMPLESDESTDIR)/intrstat.d \
    231 	$(DOCEXAMPLESDESTDIR)/syscall.d \
    232 	$(DOCEXAMPLESDESTDIR)/target.d \
    233 	$(DOCHTMLDESTDIR) \
    234 	$(DOCHTMLDESTDIR)/JavaDTraceAPI.html \
    235 	$(DOCHTMLDESTDIR)/fast.html \
    236 	$(DOCIMAGESDESTDIR) \
    237 	$(DOCIMAGESDESTDIR)/JavaDTraceAPI.gif
    238 
    239 # empty targets for top-level building compatability
    240 
    241 install_h lint:
    242 
    243 # create API javadoc
    244 
    245 doc:
    246 		-@mkdir -p $(DOCAPI)
    247 		cd $(APIJAVASRC); umask 022; \
    248 		$(JAVADOC) -protected -use -notimestamp \
    249 		-classpath $(APICLASSPATH) -d $(DOCAPI) \
    250 		$(PKGNAME)
    251