make/hotspot/ide/CreateVSProject.gmk
author ihse
Tue, 05 Feb 2019 14:57:24 +0100
branchihse-targettest-branch
changeset 57145 ceaa243112bd
parent 53157 3d60a1696e19
child 53995 ecc2bcc3beb0
child 57229 37f1897abaf0
permissions -rw-r--r--
Introduce and start using new isProperty functions.

#
# Copyright (c) 2016, 2019, 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.
#

# This must be the first rule
default: all

include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include SetupJavaCompilers.gmk

ifeq ($(call isTargetOs, windows), true)
  # The next part is a bit hacky. We include the CompileJvm.gmk to be
  # able to extact flags, but we do not wish to execute the rules.

  # Use client as base for defines and includes
  JVM_VARIANT=client

  include HotspotCommon.gmk
  include lib/CompileJvm.gmk

  # Reset targets so we don't build libjvm.
  TARGETS :=

  # Helper macro to convert a unix path to a Windows path, suitable for
  # inclusion in a command line.
  ifeq ($(call isBuildOsEnv, windows.cygwin), true)
    FixPath = \
        $(strip $(subst \,\\,$(shell $(CYGPATH) -w $1)))
    FixLinuxExecutable = \
        $(call FixPath, $1)
  else ifeq ($(call isBuildOsEnv, windows.wsl), true)
    FixPath = \
        $(strip $(subst \,\\,$(shell $(WSLPATH) -w $1)))
    FixLinuxExecutable = \
        "%windir%\Sysnative\wsl.exe $1"
  endif

  JVM_DEFINES_client := $(patsubst -D%,%, $(filter -D%, $(JVM_CFLAGS)))
  EXTRACTED_DEFINES_client := $(addprefix -define , $(JVM_DEFINES_client))

  JVM_INCLUDES_client := $(patsubst -I%,%, $(filter -I%, $(JVM_CFLAGS)))
  EXTRACTED_INCLUDES_client := $(foreach path, $(JVM_INCLUDES_client), -absoluteInclude $(call FixPath, $(path)))

  # Hand-code variant-specific arguments, based on the fact that we use
  # client for general arguments. Not optimal but other solutions require
  # major changes in ProjectCreator.
  ADDITIONAL_VARIANT_ARGS := \
      -define_server COMPILER2 \
      -ignorePath_client adfiles \
      -ignorePath_client c2_ \
      -ignorePath_client runtime_ \
      -ignorePath_client libadt \
      -ignorePath_client opto \
      #

  IGNORED_PLATFORMS_ARGS := \
    -ignorePath aarch64 \
    -ignorePath aix \
    -ignorePath arm \
    -ignorePath bsd \
    -ignorePath linux \
    -ignorePath posix \
    -ignorePath ppc \
    -ignorePath solaris \
    -ignorePath sparc \
    -ignorePath x86_32 \
    -ignorePath zero \
      #

  ################################################################################
  # Build the ProjectCreator java tool.

  TOOLS_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)/support/tools_classes

  $(eval $(call SetupJavaCompilation, BUILD_PROJECT_CREATOR, \
      SETUP := GENERATE_OLDBYTECODE, \
      ADD_JAVAC_FLAGS := -Xlint:-auxiliaryclass, \
      SRC := $(TOPDIR)/make/hotspot/src/classes, \
      BIN := $(TOOLS_OUTPUTDIR), \
  ))

  TARGETS += $(BUILD_PROJECT_CREATOR)

  # Run the ProjectCreator tool
  PROJECT_CREATOR_TOOL := $(JAVA_SMALL) -cp $(TOOLS_OUTPUTDIR) build.tools.projectcreator.ProjectCreator

  IDE_OUTPUTDIR := $(OUTPUTDIR)/ide/hotspot-visualstudio

  VCPROJ_FILE := $(IDE_OUTPUTDIR)/jvm.vcxproj

  PROJECT_CREATOR_CLASS := build.tools.projectcreator.WinGammaPlatformVC10

  # We hard-code gensrc dir to server (since this includes adfiles)
  PROJECT_CREATOR_ARGS := \
      -sourceBase $(call FixPath, $(TOPDIR)/src) \
      -startAt hotspot \
      -relativeSrcInclude hotspot \
      -hidePath .hg \
      -hidePath .jcheck \
      -hidePath jdk.aot \
      -hidePath jdk.hotspot.agent \
      -hidePath jdk.internal.vm.ci \
      -hidePath jdk.internal.vm.compiler \
      -hidePath jdk.jfr \
      -compiler VC10 \
      -jdkTargetRoot $(call FixPath, $(JDK_OUTPUTDIR)) \
      -platformName x64 \
      -buildBase $(call FixPath, $(IDE_OUTPUTDIR)/vs-output) \
      -buildSpace $(call FixPath, $(IDE_OUTPUTDIR)) \
      -makeBinary $(call FixLinuxExecutable, $(MAKE)) \
      -makeOutput $(call FixPath, $(JDK_OUTPUTDIR)/bin/server) \
      -absoluteInclude $(call FixPath, $(HOTSPOT_OUTPUTDIR)/variant-server/gensrc) \
      -absoluteSrcInclude $(call FixPath, $(HOTSPOT_OUTPUTDIR)/variant-server/gensrc) \
      $(EXTRACTED_DEFINES_client) \
      $(EXTRACTED_INCLUDES_client) \
      $(ADDITIONAL_VARIANT_ARGS) \
      $(IGNORED_PLATFORMS_ARGS) \
      #

  VCPROJ_VARDEPS := $(PROJECT_CREATOR_CLASS) $(PROJECT_CREATOR_ARGS)
  VCPROJ_VARDEPS_FILE := $(call DependOnVariable, VCPROJ_VARDEPS, \
    $(VCPROJ_FILE).vardeps)

  $(VCPROJ_FILE): $(BUILD_PROJECT_CREATOR) $(VCPROJ_VARDEPS_FILE)
	$(call MakeDir, $(@D))
	$(call ExecuteWithLog, $@, \
	    $(PROJECT_CREATOR_TOOL) $(PROJECT_CREATOR_CLASS) \
	    $(PROJECT_CREATOR_ARGS) -projectFileName $(call FixPath, $@)) \
	    $(LOG_INFO)

  TARGETS += $(VCPROJ_FILE)

  all: $(TARGETS)

else
  all:
	$(info Hotspot Visual Studio generation only supported on Windows)
endif

.PHONY: all