jdk/make/launcher/Launcher-java.base.gmk
author ihse
Wed, 20 Jan 2016 09:54:13 +0100
changeset 35276 50b3cdcef339
parent 34695 7a6cc9982d22
child 37905 2145d16bd92d
permissions -rw-r--r--
8145596: Enable debug symbols for all libraries Reviewed-by: erikj

#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

include LauncherCommon.gmk

JAVA_RC_FLAGS += -i $(JDK_TOPDIR)/src/java.base/windows/native/common
ifdef OPENJDK
  JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/java.base/windows/native/launcher/icons"
else
  JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/java.base/windows/native/launcher/icons"
endif

################################################################################

# On windows, the debuginfo files get the same name as for java.dll. Build
# into another dir and copy selectively so debuginfo for java.dll isn't
# overwritten.
$(eval $(call SetupBuildLauncher, java, \
    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \
    LDFLAGS_solaris := -R$(OPENWIN_HOME)/lib$(OPENJDK_TARGET_CPU_ISADIR), \
    LIBS_windows := user32.lib comctl32.lib, \
    RC_FLAGS := $(JAVA_RC_FLAGS), \
    VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \
    OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs, \
    OPTIMIZATION := HIGH, \
    WINDOWS_STATIC_LINK := true, \
    NO_JAVA_MS := true, \
))

$(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java)
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs/java$(EXE_SUFFIX) $@

TARGETS += $(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX)

ifeq ($(OPENJDK_TARGET_OS), windows)
  $(eval $(call SetupBuildLauncher, javaw, \
      CFLAGS := -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \
      LIBS_windows := user32.lib comctl32.lib, \
      RC_FLAGS := $(JAVA_RC_FLAGS), \
      VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \
      WINDOWS_STATIC_LINK := true, \
      NO_JAVA_MS := true, \
  ))
endif

$(eval $(call SetupBuildLauncher, keytool, \
    MAIN_CLASS := sun.security.tools.keytool.Main, \
))

################################################################################

BUILD_JEXEC :=
BUILD_JEXEC_SRC :=
BUILD_JEXEC_INC :=
BUILD_JEXEC_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)

#
# UNHANDLED:
# - COMPILE_APPROACH = normal
#

#
# jdk/make/java/Makefile
#
ifeq ($(OPENJDK_TARGET_OS), solaris)
  ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
    BUILD_JEXEC := 1
  endif
endif

ifeq ($(OPENJDK_TARGET_OS), linux)
  BUILD_JEXEC := 1
endif # OPENJDK_TARGET_OS

#
# jdk/make/java/jexec/Makefile
#
ifeq ($(BUILD_JEXEC), 1)

  ifeq ($(OPENJDK_TARGET_OS), windows)
  else ifeq ($(OPENJDK_TARGET_OS), macosx)
    BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/java.base/macosx/native/launcher
  else
    BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/java.base/unix/native/launcher
  endif

  ifeq ($(OPENJDK_TARGET_OS), linux)
    BUILD_JEXEC_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
    BUILD_JEXEC_INC += -I$(JDK_TOPDIR)/src/java.base/share/native/libjli
  endif
endif

#
# Note that the two Makefile's seems to contradict each other,
# and that src/macosx/bin/jexec.c seems unused
#
ifneq ($(BUILD_JEXEC_SRC), )
  $(eval $(call SetupNativeCompilation,BUILD_JEXEC, \
      SRC := $(BUILD_JEXEC_SRC), \
      INCLUDE_FILES := jexec.c, \
      OPTIMIZATION := LOW, \
      CFLAGS := $(CFLAGS_JDKEXE) \
          $(BUILD_JEXEC_INC), \
      CFLAGS_linux := -fPIC, \
      CFLAGS_solaris := -KPIC, \
      LDFLAGS := $(LDFLAGS_JDKEXE), \
      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jexec_obj, \
      OUTPUT_DIR := $(BUILD_JEXEC_DST_DIR), \
      PROGRAM := jexec))

  TARGETS += $(BUILD_JEXEC)
endif

################################################################################

BUILD_JSPAWNHELPER :=
BUILD_JSPAWNHELPER_SRC := $(JDK_TOPDIR)/src/java.base/unix/native/jspawnhelper
JSPAWNHELPER_CFLAGS := -I$(JDK_TOPDIR)/src/java.base/unix/native/libjava
BUILD_JSPAWNHELPER_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)
LINK_JSPAWNHELPER_OBJECTS := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava/childproc.o
BUILD_JSPAWNHELPER_LDFLAGS :=

ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx solaris aix), )
  BUILD_JSPAWNHELPER := 1
endif

ifeq ($(OPENJDK_TARGET_OS), macosx)
  BUILD_JSPAWNHELPER_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
endif

ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
  BUILD_JSPAWNHELPER_LDFLAGS += $(COMPILER_TARGET_BITS_FLAG)64
endif

ifeq ($(BUILD_JSPAWNHELPER), 1)
  $(eval $(call SetupNativeCompilation,BUILD_JSPAWNHELPER, \
      SRC := $(BUILD_JSPAWNHELPER_SRC), \
      INCLUDE_FILES := jspawnhelper.c, \
      OPTIMIZATION := LOW, \
      CFLAGS := $(CFLAGS_JDKEXE) $(JSPAWNHELPER_CFLAGS), \
      LDFLAGS := $(LDFLAGS_JDKEXE) $(BUILD_JSPAWNHELPER_LDFLAGS), \
      LIBS := $(LINK_JSPAWNHELPER_OBJECTS), \
      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jspawnhelper, \
      OUTPUT_DIR := $(BUILD_JSPAWNHELPER_DST_DIR), \
      PROGRAM := jspawnhelper))

  $(BUILD_JSPAWNHELPER): $(LINK_JSPAWNHELPER_OBJECTS)

  TARGETS += $(BUILD_JSPAWNHELPER)
endif

################################################################################