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) -deprecation
  79 JFLAGS += -target 1.5
  80 JFLAGS += -Xlint
  81 COMPILE.java=$(JAVAC) $(JFLAGS)
  82 JAVASRC= JDTrace.java Getopt.java
  83 
  84 $(JDTRACE_JAR): $(JAVASRC)
  85         @mkdir -p $(CLASSDIR)
  86         @mkdir -p $(LIBDIR)
  87         $(COMPILE.java) $(JAVASRC)
  88         $(JAR) -cmf $(MANIFEST) $(JDTRACE_JAR) -C $(CLASSDIR) .
  89 
  90 $(PROTO_JDTRACE_JAR): $(ROOTLIBJAVA)
  91 
  92 $(CMD): $(ROOTBIN)
  93 
  94 $(XLIST): $(ROOTBIN)
  95 
  96 $(ROOTBIN):
  97         $(INS.dir)
  98 
  99 $(ROOTLIB):
 100         $(INS.dir)
 101 
 102 $(ROOTLIBJAVA): $(ROOTLIB)
 103         $(INS.dir)
 104 
 105 $(ROOTLIBJAVA)/%.jar: $(LIBDIR)/%.jar
 106         $(INS.file)
 107 
 108 $(ROOTBIN)/%: %
 109         $(INS.file)