agent/src/os/bsd/Makefile

Fri, 13 Jun 2014 18:04:49 -0700

author
ddehaven
date
Fri, 13 Jun 2014 18:04:49 -0700
changeset 7562
0e1aa319e805
parent 4750
39432a1cefdd
child 7994
04ff2f6cd0eb
permissions
-rw-r--r--

8043340: [macosx] Fix hard-wired paths to JavaVM.framework
Summary: Build system tweaks to allow building on OS X 10.9 and later
Reviewed-by: erikj, dholmes

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

mercurial