hotspot/agent/src/os/bsd/Makefile
author amurillo
Fri, 30 Jan 2015 16:56:03 -0800
changeset 28714 b1e6d710b1ec
parent 25065 fbb17c582d13
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     1
#
25065
fbb17c582d13 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 16351
diff changeset
     2
# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     4
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     7
# published by the Free Software Foundation.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     8
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     9
# This code is distributed in the hope that it will be useful, but WITHOUT
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    12
# version 2 for more details (a copy is included in the LICENSE file that
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    13
# accompanied this code).
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    14
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    15
# You should have received a copy of the GNU General Public License version
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    16
# 2 along with this work; if not, write to the Free Software Foundation,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    18
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    20
# or visit www.oracle.com if you need additional information or have any
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    21
# questions.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    22
#  
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    23
#
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    24
16351
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    25
ARCH := $(shell if ([ `uname -m` = "ia64" ])  ; then echo ia64 ; elif ([ `uname -m` = "amd64" ]) ; then echo amd64; elif ([ `uname -m` = "x86_64" ]) ; then echo amd64; elif ([ `uname -m` = "sparc64" ]) ; then echo sparc; else echo i386 ; fi )
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    26
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    27
OS       := $(shell uname -s)
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    28
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    29
GCC      = gcc
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    30
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    31
JAVAH    = ${JAVA_HOME}/bin/javah
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    32
16351
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    33
ifneq ($(OS), Darwin)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    34
SOURCES  = salibelf.c   \
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    35
        symtab.c        \
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    36
	libproc_impl.c  \
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    37
	ps_proc.c       \
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    38
	ps_core.c       \
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    39
	BsdDebuggerLocal.c
16351
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    40
OBJS    = $(SOURCES:.c=.o)
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    41
OBJSPLUS = $(OBJS) sadis.o
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    42
LIBSA = $(ARCH)/libsaproc.so
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    43
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    44
LIBS     = -lutil -lthread_db
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    45
16351
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    46
else
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    47
16351
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    48
SOURCES  = symtab.c     \
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    49
	libproc_impl.c  \
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    50
	ps_core.c
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    51
OBJS    = $(SOURCES:.c=.o)
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    52
OBJSPLUS = MacosxDebuggerLocal.o sadis.o $(OBJS)
25065
fbb17c582d13 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 16351
diff changeset
    53
EXTINCLUDE = -I.
16351
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    54
EXTCFLAGS = -m64 -D__APPLE__ -framework JavaNativeFoundation
25065
fbb17c582d13 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 16351
diff changeset
    55
FOUNDATIONFLAGS = -framework Foundation -framework JavaNativeFoundation -framework Security -framework CoreFoundation
16351
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    56
LIBSA = $(ARCH)/libsaproc.dylib
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    57
endif   # Darwin
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    58
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    59
INCLUDES = -I${JAVA_HOME}/include -I${JAVA_HOME}/include/$(shell uname -s | tr "[:upper:]" "[:lower:]") $(EXTINCLUDE)
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    60
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    61
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    62
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    63
CFLAGS   = -c -fPIC -g -Wall -D_ALLBSD_SOURCE -D_GNU_SOURCE -D$(ARCH) $(INCLUDES) $(EXTCFLAGS)
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    64
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    65
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    66
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    67
all: $(LIBSA)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    68
16351
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    69
MacosxDebuggerLocal.o: MacosxDebuggerLocal.m
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    70
	echo "OS="$(OS)
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    71
	$(JAVAH) -jni -classpath ../../../build/classes  \
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    72
		sun.jvm.hotspot.debugger.x86.X86ThreadContext \
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    73
		sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext
16351
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    74
	$(GCC) $(CFLAGS) $(FOUNDATIONFLAGS) $<
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    75
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    76
sadis.o: ../../share/native/sadis.c
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    77
	$(JAVAH) -jni -classpath ../../../build/classes \
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    78
		sun.jvm.hotspot.asm.Disassembler
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    79
	$(GCC) $(CFLAGS) $<
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    80
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    81
.c.obj:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    82
	$(GCC) $(CFLAGS)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    83
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    84
ifndef LDNOMAP
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    85
  LFLAGS_LIBSA = -Xlinker --version-script=mapfile
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    86
endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    87
16351
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    88
$(LIBSA): $(OBJSPLUS) mapfile 
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    89
	if [ ! -d $(ARCH) ] ; then mkdir $(ARCH) ; fi
16351
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
    90
	$(GCC) -shared $(LFLAGS_LIBSA) -o $(LIBSA) $(FOUNDATIONFLAGS) $(OBJSPLUS) $(LIBS) $(SALIBS)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    91
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    92
test.o: $(LIBSA) test.c
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    93
	$(GCC) -c -o test.o -g -D_GNU_SOURCE -D$(ARCH) $(INCLUDES) test.c
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    94
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    95
test: test.o
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    96
	$(GCC) -o test test.o -L$(ARCH) -lsaproc $(LIBS)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    97
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    98
clean:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    99
	rm -f $(LIBSA)
16351
032b310a3e2f 8003348: SA can not read core file on OS
minqi
parents: 10739
diff changeset
   100
	rm -f *.o
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   101
	rm -f test.o
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   102
	-rmdir $(ARCH)