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 PROG = jdtrace
  29 SRCS = jdtrace.c
  30 
  31 include $(SRC)/cmd/Makefile.cmd
  32 
  33 ROOTOPTPKG = $(ROOT)/opt/SUNWdtrt
  34 ROOTBIN = $(ROOTOPTPKG)/bin
  35 ROOTLIB = $(ROOTOPTPKG)/lib
  36 ROOTLIBJAVA = $(ROOTLIB)/java
  37 
  38 # Use the proto dtrace.jar if it exists, otherwise use whatever is
  39 # installed on the system. It should be possible to build
  40 # usr/src/cmd/dtrace/test independently, even if only on systems that
  41 # have a compatible dtrace.jar installed.
  42 DTRACE_JAR=usr/share/lib/java/dtrace.jar
  43 PROTO_DTRACE_JAR=$(ROOT)/$(DTRACE_JAR)
  44 INSTALLED_DTRACE_JAR=/$(DTRACE_JAR)
  45 CLASSPATH=$(PROTO_DTRACE_JAR):$(INSTALLED_DTRACE_JAR)
  46 DTEST_DIR=$(SRC)/cmd/dtrace/test
  47 CLASSDIR=classes
  48 LIBDIR=lib
  49 MANIFESTDIR=manifest
  50 MANIFEST=$(MANIFESTDIR)/jdtrace.jar-manifest
  51 JDTRACE_JAR=$(LIBDIR)/jdtrace.jar
  52 
  53 PROTO_JDTRACE_JAR=$(ROOTLIBJAVA)/jdtrace.jar
  54 CMD = $(ROOTBIN)/jdtrace
  55 XLIST = $(ROOTBIN)/exception.lst
  56 
  57 $(PROTO_JDTRACE_JAR) := FILEMODE = 0644
  58 $(CMD) := FILEMODE = 0555
  59 $(XLIST) := FILEMODE = 0444
  60 
  61 all: $(JDTRACE_JAR) $(PROG)
  62 
  63 clean:
  64         -$(RM) $(CLASSDIR)/*.class
  65 
  66 clobber: clean
  67         -$(RM) $(JDTRACE_JAR)
  68         -$(RM) $(PROG)
  69 
  70 lint:
  71 
  72 install: all $(PROTO_JDTRACE_JAR) $(CMD) $(XLIST)
  73 
  74 $(PROG): $(SRCS)
  75         $(LINK.c) -o $@ $(SRCS) $(LDLIBS)
  76         $(POST_PROCESS) ; $(STRIP_STABS)
  77 
  78 JFLAGS= -g -cp $(CLASSPATH) -d $(CLASSDIR)
  79 JFLAGS += -source 1.5 -target 1.6 -Xlint:all,-options
  80 COMPILE.java=$(JAVAC) $(JFLAGS)
  81 JAVASRC= JDTrace.java Getopt.java
  82 
  83 $(JDTRACE_JAR): $(JAVASRC)
  84         @mkdir -p $(CLASSDIR)
  85         @mkdir -p $(LIBDIR)
  86         $(COMPILE.java) $(JAVASRC)
  87         $(JAR) -cmf $(MANIFEST) $(JDTRACE_JAR) -C $(CLASSDIR) .
  88 
  89 $(PROTO_JDTRACE_JAR): $(ROOTLIBJAVA)
  90 
  91 $(CMD): $(ROOTBIN)
  92 
  93 $(XLIST): $(ROOTBIN)
  94 
  95 $(ROOTBIN):
  96         $(INS.dir)
  97 
  98 $(ROOTLIB):
  99         $(INS.dir)
 100 
 101 $(ROOTLIBJAVA): $(ROOTLIB)
 102         $(INS.dir)
 103 
 104 $(ROOTLIBJAVA)/%.jar: $(LIBDIR)/%.jar
 105         $(INS.file)
 106 
 107 $(ROOTBIN)/%: %
 108         $(INS.file)