never@3156: # mikael@4153: # Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. never@3156: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. never@3156: # never@3156: # This code is free software; you can redistribute it and/or modify it never@3156: # under the terms of the GNU General Public License version 2 only, as never@3156: # published by the Free Software Foundation. never@3156: # never@3156: # This code is distributed in the hope that it will be useful, but WITHOUT never@3156: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or never@3156: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License never@3156: # version 2 for more details (a copy is included in the LICENSE file that never@3156: # accompanied this code). never@3156: # never@3156: # You should have received a copy of the GNU General Public License version never@3156: # 2 along with this work; if not, write to the Free Software Foundation, never@3156: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. never@3156: # never@3156: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA never@3156: # or visit www.oracle.com if you need additional information or have any never@3156: # questions. sla@4076: # never@3156: # never@3156: never@3156: # Rules to build gamma launcher, used by vm.make never@3156: never@3156: never@3156: LAUNCHER_SCRIPT = hotspot never@3156: LAUNCHER = gamma never@3156: never@3156: LAUNCHERDIR := $(GAMMADIR)/src/os/posix/launcher never@3156: LAUNCHERDIR_SHARE := $(GAMMADIR)/src/share/tools/launcher never@3156: LAUNCHERFLAGS := $(ARCHFLAG) \ never@3156: -I$(LAUNCHERDIR) -I$(GAMMADIR)/src/share/vm/prims \ never@3156: -I$(LAUNCHERDIR_SHARE) \ never@3156: -DFULL_VERSION=\"$(HOTSPOT_RELEASE_VERSION)\" \ never@3156: -DJDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\" \ never@3156: -DJDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\" \ never@3156: -DARCH=\"$(LIBARCH)\" \ never@3156: -DGAMMA \ never@3156: -DLAUNCHER_TYPE=\"gamma\" \ never@3156: -DLINK_INTO_$(LINK_INTO) \ never@3156: $(TARGET_DEFINES) sla@4076: # Give the launcher task_for_pid() privileges so that it can be used to run JStack, JInfo, et al. sla@4076: LFLAGS_LAUNCHER += -sectcreate __TEXT __info_plist $(GAMMADIR)/src/os/bsd/launcher/Info-privileged.plist never@3156: never@3156: ifeq ($(LINK_INTO),AOUT) never@3156: LAUNCHER.o = launcher.o $(JVM_OBJ_FILES) never@3156: LAUNCHER_MAPFILE = mapfile_reorder never@3156: LFLAGS_LAUNCHER$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LAUNCHER_MAPFILE)) never@3156: LFLAGS_LAUNCHER += $(SONAMEFLAG:SONAME=$(LIBJVM)) $(STATIC_LIBGCC) never@3156: LIBS_LAUNCHER += $(STATIC_STDCXX) $(LIBS) never@3156: else never@3156: LAUNCHER.o = launcher.o sla@4076: LFLAGS_LAUNCHER += -L`pwd` phh@3473: phh@3473: # The gamma launcher runs the JDK from $JAVA_HOME, overriding the JVM with a sla@4076: # freshly built JVM at ./libjvm.{so|dylib}. This is accomplished by setting sla@4076: # the library searchpath using ({DY}LD_LIBRARY_PATH) to find the local JVM phh@3473: # first. Gamma dlopen()s libjava from $JAVA_HOME/jre/lib{/$arch}, which is phh@3473: # statically linked with CoreFoundation framework libs. Unfortunately, gamma's sla@4076: # unique searchpath results in some unresolved symbols in the framework phh@3473: # libraries, because JDK libraries are inadvertently discovered first on the phh@3473: # searchpath, e.g. libjpeg. On Mac OS X, filenames are case *insensitive*. phh@3473: # So, the actual filename collision is libjpeg.dylib and libJPEG.dylib. sla@4076: # To resolve this, gamma needs to also statically link with the CoreFoundation phh@3473: # framework libraries. phh@3473: phh@3473: ifeq ($(OS_VENDOR),Darwin) sla@4076: LFLAGS_LAUNCHER += -framework CoreFoundation phh@3473: endif phh@3473: never@3156: LIBS_LAUNCHER += -l$(JVM) $(LIBS) never@3156: endif never@3156: erikj@3518: LINK_LAUNCHER = $(LINK.CC) never@3156: erikj@3518: LINK_LAUNCHER/PRE_HOOK = $(LINK_LIB.CXX/PRE_HOOK) erikj@3518: LINK_LAUNCHER/POST_HOOK = $(LINK_LIB.CXX/POST_HOOK) never@3156: never@3156: LAUNCHER_OUT = launcher never@3156: never@3156: SUFFIXES += .d never@3156: never@3156: SOURCES := $(shell find $(LAUNCHERDIR) -name "*.c") never@3156: SOURCES_SHARE := $(shell find $(LAUNCHERDIR_SHARE) -name "*.c") never@3156: never@3156: OBJS := $(patsubst $(LAUNCHERDIR)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES)) $(patsubst $(LAUNCHERDIR_SHARE)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES_SHARE)) never@3156: never@3156: DEPFILES := $(patsubst %.o,%.d,$(OBJS)) never@3156: -include $(DEPFILES) never@3156: never@3156: $(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR_SHARE)/%.c never@3156: $(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); } erikj@3518: $(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CXXFLAGS) never@3156: never@3156: $(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR)/%.c never@3156: $(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); } erikj@3518: $(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CXXFLAGS) never@3156: never@3156: $(LAUNCHER): $(OBJS) $(LIBJVM) $(LAUNCHER_MAPFILE) never@3156: $(QUIETLY) echo Linking launcher... never@3156: $(QUIETLY) $(LINK_LAUNCHER/PRE_HOOK) ohair@4087: $(QUIETLY) $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(sort $(OBJS)) $(LIBS_LAUNCHER) never@3156: $(QUIETLY) $(LINK_LAUNCHER/POST_HOOK) sla@4076: # Sign the launcher with the development certificate (if present) so that it can be used sla@4076: # to run JStack, JInfo, et al. sla@4076: $(QUIETLY) -codesign -s openjdk_codesign $@ never@3156: never@3156: $(LAUNCHER): $(LAUNCHER_SCRIPT) never@3156: never@3156: $(LAUNCHER_SCRIPT): $(LAUNCHERDIR)/launcher.script never@3156: $(QUIETLY) sed -e 's/@@LIBARCH@@/$(LIBARCH)/g' $< > $@ never@3156: $(QUIETLY) chmod +x $@ never@3156: