1 # 2 # Copyright (c) 2003, 2012, 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 LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS=1 30 31 BUILDDIR = ../.. 32 PACKAGE = sun.instrument 33 LIBRARY = instrument 34 PRODUCT = sun 35 36 # Configure the CFLAGS for this library. Use static binding so that there 37 # are not dependencies on modules not on the search patch when invoked from 38 # the Windows system directory (or elsewhere). 39 MS_RUNTIME_STATIC=true 40 41 FILES_m = mapfile-vers 42 43 JAVAC_MAX_WARNINGS = true 44 JAVAC_WARNINGS_FATAL = true 45 46 include $(BUILDDIR)/common/Defs.gmk 47 48 # Use the mapfile-vers (See the mapfile located with this Makefile) 49 ifdef FILES_m 50 include $(BUILDDIR)/common/Mapfile-vers.gmk 51 endif 52 53 # 54 # Files to compile. 55 # 56 FILES_c = \ 57 EncodingSupport.c \ 58 EncodingSupport_md.c \ 59 FileSystemSupport_md.c \ 60 InstrumentationImplNativeMethods.c \ 61 InvocationAdapter.c \ 62 JarFacade.c \ 63 JPLISAgent.c \ 64 JPLISAssert.c \ 65 JavaExceptions.c \ 66 PathCharsValidator.c \ 67 Reentrancy.c \ 68 Utilities.c 69 70 # 71 # -jaragent support requires zip and jar manfiest parser to be compiled 72 # into the instrument library. 73 # 74 IO_PLATFORM_SRC = $(PLATFORM_SRC)/native/java/io 75 LAUNCHER_SHARE_SRC = $(SHARE_SRC)/bin 76 LAUNCHER_PLATFORM_SRC = $(PLATFORM_SRC)/bin 77 78 FILES_c += \ 79 canonicalize_md.c 80 81 FILES_export = \ 82 sun/instrument/InstrumentationImpl.java 83 84 # 85 # This controls the ability to do logging in the library. 86 # 87 CPPFLAGS_DBG += -DJPLIS_LOGGING 88 CPPFLAGS_OPT += -DNO_JPLIS_LOGGING 89 90 OTHER_INCLUDES = -I$(SHARE_SRC)/instrument 91 OTHER_INCLUDES += -I$(PLATFORM_SRC)/instrument 92 OTHER_INCLUDES += -I$(IO_PLATFORM_SRC) 93 OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC) -I$(LAUNCHER_PLATFORM_SRC) 94 95 # 96 # Create a dependency on libjli (Java Launcher Infrastructure) 97 # 98 # On UNIX, this is a relative dependency using $ORIGIN. Unfortunately, to 99 # do this reliably on Linux takes a different syntax than Solaris. 100 # 101 # On Windows, this is done by using the same directory as the executable 102 # itself, as with all the Windows libraries. 103 # 104 ifeq ($(PLATFORM), windows) 105 OTHER_LDLIBS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/jli.lib 106 OTHER_LCF += -export:Agent_OnAttach 107 # equivalent of strcasecmp is stricmp on Windows 108 CPPFLAGS_COMMON += -Dstrcasecmp=stricmp 109 else 110 ifneq (,$(findstring $(PLATFORM), macosx)) 111 ifneq ($(ARCH), universal) 112 LDFLAGS += -Wl,-all_load 113 endif 114 LDFLAGS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/libjli.a 115 OTHER_LDLIBS += -liconv 116 ifeq ($(SYSTEM_ZLIB), true) 117 OTHER_LDLIBS += -lz 118 endif 119 else 120 LDFLAGS += -L $(LIBDIR)/$(LIBARCH)/jli 121 OTHER_LDLIBS += -ljli 122 OTHER_LDLIBS += -ldl 123 ifeq ($(PLATFORM), solaris) 124 LDFLAGS += -R \$$ORIGIN/jli 125 endif 126 ifeq ($(PLATFORM), linux) 127 LDFLAGS += $(LDFLAG_Z_ORIGIN) 128 LDFLAGS += -Wl,--allow-shlib-undefined 129 LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/jli 130 endif 131 endif 132 endif 133 134 ifeq ($(PLATFORM), macosx) 135 LDFLAGS += -framework Cocoa -framework Security -framework ApplicationServices 136 endif 137 138 # 139 # Library to compile. 140 # 141 include $(BUILDDIR)/common/Library.gmk 142 143 # We don't want to link against -ljava 144 JAVALIB= 145 146 # 147 # Add to ambient vpath so we pick up the library files 148 # 149 vpath %.c $(SHARE_SRC)/instrument $(PLATFORM_SRC)/instrument 150 vpath %.c $(IO_PLATFORM_SRC) 151