1 # 2 # Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 # 5 # This code is free software; you can redistribute it and/or modify it 6 # under the terms of the GNU General Public License version 2 only, as 7 # published by the Free Software Foundation. Oracle designates this 8 # particular file as subject to the "Classpath" exception as provided 9 # by Oracle in the LICENSE file that accompanied this code. 10 # 11 # This code is distributed in the hope that it will be useful, but WITHOUT 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 # version 2 for more details (a copy is included in the LICENSE file that 15 # accompanied this code). 16 # 17 # You should have received a copy of the GNU General Public License version 18 # 2 along with this work; if not, write to the Free Software Foundation, 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 # 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 # or visit www.oracle.com if you need additional information or have any 23 # questions. 24 # 25 26 # Makefile for building the Java Programming Language Instrumentation Services 27 # agent, supporting java.lang.instrument 28 29 BUILDDIR = ../.. 30 MODULE = instrument 31 PACKAGE = sun.instrument 32 LIBRARY = instrument 33 PRODUCT = sun 34 35 # Configure the CFLAGS for this library. Use static binding so that there 36 # are not dependencies on modules not on the search patch when invoked from 37 # the Windows system directory (or elsewhere). 38 MS_RUNTIME_STATIC=true 39 40 FILES_m = mapfile-vers 41 42 include $(BUILDDIR)/common/Defs.gmk 43 44 # Use the mapfile-vers (See the mapfile located with this Makefile) 45 ifdef FILES_m 46 include $(BUILDDIR)/common/Mapfile-vers.gmk 47 endif 48 49 # 50 # Files to compile. 51 # 52 FILES_c = \ 53 EncodingSupport.c \ 54 EncodingSupport_md.c \ 55 FileSystemSupport_md.c \ 56 InstrumentationImplNativeMethods.c \ 57 InvocationAdapter.c \ 58 JarFacade.c \ 59 JPLISAgent.c \ 60 JPLISAssert.c \ 61 JavaExceptions.c \ 62 PathCharsValidator.c \ 63 Reentrancy.c \ 64 Utilities.c 65 66 # 67 # -jaragent support requires zip and jar manfiest parser to be compiled 68 # into the instrument library. 69 # 70 IO_PLATFORM_SRC = $(PLATFORM_SRC)/native/java/io 71 LAUNCHER_SHARE_SRC = $(SHARE_SRC)/bin 72 LAUNCHER_PLATFORM_SRC = $(PLATFORM_SRC)/bin 73 74 FILES_c += \ 75 canonicalize_md.c 76 77 FILES_export = \ 78 sun/instrument/InstrumentationImpl.java 79 80 # 81 # This controls the ability to do logging in the library. 82 # 83 CPPFLAGS_DBG += -DJPLIS_LOGGING 84 CPPFLAGS_OPT += -DNO_JPLIS_LOGGING 85 86 OTHER_INCLUDES = -I$(SHARE_SRC)/instrument 87 OTHER_INCLUDES += -I$(PLATFORM_SRC)/instrument 88 OTHER_INCLUDES += -I$(IO_PLATFORM_SRC) 89 OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC) -I$(LAUNCHER_PLATFORM_SRC) 90 91 # 92 # Create a dependency on libjli (Java Launcher Infrastructure) 93 # 94 # On UNIX, this is a relative dependency using $ORIGIN. Unfortunately, to 95 # do this reliably on Linux takes a different syntax than Solaris. 96 # 97 # On Windows, this is done by using the same directory as the executable 98 # itself, as with all the Windows libraries. 99 # 100 ifeq ($(PLATFORM), windows) 101 OTHER_LDLIBS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/jli.lib 102 OTHER_LCF += -export:Agent_OnAttach 103 # equivalent of strcasecmp is stricmp on Windows 104 CPPFLAGS_COMMON += -Dstrcasecmp=stricmp 105 else 106 LDFLAGS += -L $(LIBDIR)/$(LIBARCH)/jli 107 OTHER_LDLIBS += -ljli 108 OTHER_LDLIBS += -ldl 109 ifeq ($(PLATFORM), solaris) 110 LDFLAGS += -R \$$ORIGIN/jli 111 endif 112 ifeq ($(PLATFORM), linux) 113 LDFLAGS += -Wl,-z -Wl,origin 114 LDFLAGS += -Wl,--allow-shlib-undefined 115 LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/jli 116 endif 117 endif 118 119 # 120 # Library to compile. 121 # 122 include $(BUILDDIR)/common/Library.gmk 123 124 # We don't want to link against -ljava 125 JAVALIB= 126 127 # 128 # Add to ambient vpath so we pick up the library files 129 # 130 vpath %.c $(SHARE_SRC)/instrument $(PLATFORM_SRC)/instrument 131 vpath %.c $(IO_PLATFORM_SRC) 132