make/bsd/makefiles/launcher.make

Mon, 19 Mar 2012 10:09:24 +0100

author
erikj
date
Mon, 19 Mar 2012 10:09:24 +0100
changeset 3649
3d7ea1dbe0de
parent 3518
719f7007c8e8
child 4076
15ba0e7a3ff4
permissions
-rw-r--r--

7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
Reviewed-by: dholmes, ohair

     1 #
     2 # Copyright (c) 2005, 2010, 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.
     8 #
     9 # This code is distributed in the hope that it will be useful, but WITHOUT
    10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12 # version 2 for more details (a copy is included in the LICENSE file that
    13 # accompanied this code).
    14 #
    15 # You should have received a copy of the GNU General Public License version
    16 # 2 along with this work; if not, write to the Free Software Foundation,
    17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18 #
    19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20 # or visit www.oracle.com if you need additional information or have any
    21 # questions.
    22 #  
    23 #
    25 # Rules to build gamma launcher, used by vm.make
    28 LAUNCHER_SCRIPT = hotspot
    29 LAUNCHER   = gamma
    31 LAUNCHERDIR   := $(GAMMADIR)/src/os/posix/launcher
    32 LAUNCHERDIR_SHARE := $(GAMMADIR)/src/share/tools/launcher
    33 LAUNCHERFLAGS := $(ARCHFLAG) \
    34                 -I$(LAUNCHERDIR) -I$(GAMMADIR)/src/share/vm/prims \
    35                 -I$(LAUNCHERDIR_SHARE) \
    36                 -DFULL_VERSION=\"$(HOTSPOT_RELEASE_VERSION)\" \
    37                 -DJDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\" \
    38                 -DJDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\" \
    39                 -DARCH=\"$(LIBARCH)\" \
    40                 -DGAMMA \
    41                 -DLAUNCHER_TYPE=\"gamma\" \
    42                 -DLINK_INTO_$(LINK_INTO) \
    43                 $(TARGET_DEFINES)
    45 ifeq ($(LINK_INTO),AOUT)
    46   LAUNCHER.o                 = launcher.o $(JVM_OBJ_FILES)
    47   LAUNCHER_MAPFILE           = mapfile_reorder
    48   LFLAGS_LAUNCHER$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LAUNCHER_MAPFILE))
    49   LFLAGS_LAUNCHER           += $(SONAMEFLAG:SONAME=$(LIBJVM)) $(STATIC_LIBGCC)
    50   LIBS_LAUNCHER             += $(STATIC_STDCXX) $(LIBS)
    51 else
    52   LAUNCHER.o                 = launcher.o
    53   LFLAGS_LAUNCHER           += -L`pwd` 
    55   # The gamma launcher runs the JDK from $JAVA_HOME, overriding the JVM with a
    56   # freshly built JVM at ./libjvm.{so|dylib}.  This is accomplished by setting 
    57   # the library searchpath using ({DY}LD_LIBRARY_PATH) to find the local JVM 
    58   # first.  Gamma dlopen()s libjava from $JAVA_HOME/jre/lib{/$arch}, which is
    59   # statically linked with CoreFoundation framework libs. Unfortunately, gamma's
    60   # unique searchpath results in some unresolved symbols in the framework 
    61   # libraries, because JDK libraries are inadvertently discovered first on the
    62   # searchpath, e.g. libjpeg.  On Mac OS X, filenames are case *insensitive*.
    63   # So, the actual filename collision is libjpeg.dylib and libJPEG.dylib.
    64   # To resolve this, gamma needs to also statically link with the CoreFoundation 
    65   # framework libraries.
    67   ifeq ($(OS_VENDOR),Darwin)
    68     LFLAGS_LAUNCHER         += -framework CoreFoundation 
    69   endif
    71   LIBS_LAUNCHER             += -l$(JVM) $(LIBS)
    72 endif
    74 LINK_LAUNCHER = $(LINK.CC)
    76 LINK_LAUNCHER/PRE_HOOK  = $(LINK_LIB.CXX/PRE_HOOK)
    77 LINK_LAUNCHER/POST_HOOK = $(LINK_LIB.CXX/POST_HOOK)
    79 LAUNCHER_OUT = launcher
    81 SUFFIXES += .d
    83 SOURCES := $(shell find $(LAUNCHERDIR) -name "*.c")
    84 SOURCES_SHARE := $(shell find $(LAUNCHERDIR_SHARE) -name "*.c")
    86 OBJS := $(patsubst $(LAUNCHERDIR)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES)) $(patsubst $(LAUNCHERDIR_SHARE)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES_SHARE))
    88 DEPFILES := $(patsubst %.o,%.d,$(OBJS))
    89 -include $(DEPFILES)
    91 $(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR_SHARE)/%.c
    92 	$(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
    93 	$(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CXXFLAGS)
    95 $(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR)/%.c
    96 	$(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
    97 	$(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CXXFLAGS)
    99 $(LAUNCHER): $(OBJS) $(LIBJVM) $(LAUNCHER_MAPFILE)
   100 	$(QUIETLY) echo Linking launcher...
   101 	$(QUIETLY) $(LINK_LAUNCHER/PRE_HOOK)
   102 	$(QUIETLY) $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(OBJS) $(LIBS_LAUNCHER)
   103 	$(QUIETLY) $(LINK_LAUNCHER/POST_HOOK)
   105 $(LAUNCHER): $(LAUNCHER_SCRIPT)
   107 $(LAUNCHER_SCRIPT): $(LAUNCHERDIR)/launcher.script
   108 	$(QUIETLY) sed -e 's/@@LIBARCH@@/$(LIBARCH)/g' $< > $@
   109 	$(QUIETLY) chmod +x $@

mercurial