make/hotspot/ide/CreateVSProject.gmk
changeset 47216 71c04702a3d5
parent 43972 1ade39b8381b
child 47217 72e3ae9a25eb
equal deleted inserted replaced
47215:4ebc2e2fb97c 47216:71c04702a3d5
       
     1 #
       
     2 # Copyright (c) 2016, 2017, 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 # This must be the first rule
       
    27 default: all
       
    28 
       
    29 include $(SPEC)
       
    30 include MakeBase.gmk
       
    31 include JavaCompilation.gmk
       
    32 include SetupJavaCompilers.gmk
       
    33 
       
    34 ifeq ($(OPENJDK_TARGET_OS), windows)
       
    35   # The next part is a bit hacky. We include the CompileJvm.gmk to be
       
    36   # able to extact flags, but we do not wish to execute the rules.
       
    37 
       
    38   # Use client as base for defines and includes
       
    39   JVM_VARIANT=client
       
    40 
       
    41   include HotspotCommon.gmk
       
    42   include lib/CompileJvm.gmk
       
    43 
       
    44   # Reset targets so we don't build libjvm.
       
    45   TARGETS :=
       
    46 
       
    47   # Helper macro to convert a unix path to a Windows path, suitable for
       
    48   # inclusion in a command line.
       
    49   FixPath = \
       
    50     $(strip $(subst \,\\,$(shell $(CYGPATH) -w $1)))
       
    51 
       
    52   JVM_DEFINES_client := $(patsubst -D%,%, $(filter -D%, $(JVM_CFLAGS)))
       
    53   EXTRACTED_DEFINES_client := $(addprefix -define , $(JVM_DEFINES_client))
       
    54 
       
    55   JVM_INCLUDES_client := $(patsubst -I%,%, $(filter -I%, $(JVM_CFLAGS)))
       
    56   EXTRACTED_INCLUDES_client := $(foreach path, $(JVM_INCLUDES_client), -absoluteInclude $(call FixPath, $(path)))
       
    57 
       
    58   # Hand-code variant-specific arguments, based on the fact that we use
       
    59   # client for general arguments. Not optimal but other solutions require
       
    60   # major changes in ProjectCreator.
       
    61   ADDITIONAL_VARIANT_ARGS := \
       
    62       -define_server COMPILER2 \
       
    63       -ignorePath_client adfiles \
       
    64       -ignorePath_client c2_ \
       
    65       -ignorePath_client runtime_ \
       
    66       -ignorePath_client libadt \
       
    67       -ignorePath_client opto \
       
    68       #
       
    69 
       
    70   IGNORED_PLATFORMS_ARGS := \
       
    71     -ignorePath aarch64 \
       
    72     -ignorePath aix \
       
    73     -ignorePath arm \
       
    74     -ignorePath bsd \
       
    75     -ignorePath linux \
       
    76     -ignorePath posix \
       
    77     -ignorePath ppc \
       
    78     -ignorePath shark \
       
    79     -ignorePath solaris \
       
    80     -ignorePath sparc \
       
    81     -ignorePath x86_32 \
       
    82     -ignorePath zero \
       
    83       #
       
    84 
       
    85   ################################################################################
       
    86   # Build the ProjectCreator java tool.
       
    87 
       
    88   TOOLS_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)/support/tools_classes
       
    89 
       
    90   $(eval $(call SetupJavaCompilation, BUILD_PROJECT_CREATOR, \
       
    91       SETUP := GENERATE_OLDBYTECODE, \
       
    92       ADD_JAVAC_FLAGS := -Xlint:-auxiliaryclass, \
       
    93       SRC := $(HOTSPOT_TOPDIR)/make/src/classes, \
       
    94       BIN := $(TOOLS_OUTPUTDIR), \
       
    95   ))
       
    96 
       
    97   TARGETS += $(BUILD_PROJECT_CREATOR)
       
    98 
       
    99   # Run the ProjectCreator tool
       
   100   PROJECT_CREATOR_TOOL := $(JAVA_SMALL) -cp $(TOOLS_OUTPUTDIR) build.tools.projectcreator.ProjectCreator
       
   101 
       
   102   IDE_OUTPUTDIR := $(BUILD_OUTPUT)/ide/hotspot-visualstudio
       
   103 
       
   104   VCPROJ_FILE := $(IDE_OUTPUTDIR)/jvm.vcxproj
       
   105 
       
   106   PROJECT_CREATOR_CLASS := build.tools.projectcreator.WinGammaPlatformVC10
       
   107 
       
   108   # We hard-code gensrc dir to server (since this includes adfiles)
       
   109   PROJECT_CREATOR_ARGS := \
       
   110       -sourceBase $(call FixPath, $(HOTSPOT_TOPDIR)) \
       
   111       -startAt src \
       
   112       -relativeSrcInclude src \
       
   113       -hidePath .hg \
       
   114       -hidePath .jcheck \
       
   115       -hidePath jdk.aot \
       
   116       -hidePath jdk.hotspot.agent \
       
   117       -hidePath jdk.internal.vm.ci \
       
   118       -hidePath jdk.internal.vm.compiler \
       
   119       -hidePath jdk.jfr \
       
   120       -compiler VC10 \
       
   121       -jdkTargetRoot $(call FixPath, $(JDK_OUTPUTDIR)) \
       
   122       -platformName x64 \
       
   123       -buildBase $(call FixPath, $(IDE_OUTPUTDIR)/vs-output) \
       
   124       -buildSpace $(call FixPath, $(IDE_OUTPUTDIR)) \
       
   125       -makeBinary $(call FixPath, $(MAKE)) \
       
   126       -makeOutput $(call FixPath, $(JDK_OUTPUTDIR)/bin/server) \
       
   127       -absoluteInclude $(call FixPath, $(HOTSPOT_OUTPUTDIR)/variant-server/gensrc) \
       
   128       -absoluteSrcInclude $(call FixPath, $(HOTSPOT_OUTPUTDIR)/variant-server/gensrc) \
       
   129       $(EXTRACTED_DEFINES_client) \
       
   130       $(EXTRACTED_INCLUDES_client) \
       
   131       $(ADDITIONAL_VARIANT_ARGS) \
       
   132       $(IGNORED_PLATFORMS_ARGS) \
       
   133       #
       
   134 
       
   135   VCPROJ_VARDEPS := $(PROJECT_CREATOR_CLASS) $(PROJECT_CREATOR_ARGS)
       
   136   VCPROJ_VARDEPS_FILE := $(call DependOnVariable, VCPROJ_VARDEPS, \
       
   137     $(VCPROJ_FILE).vardeps)
       
   138 
       
   139   $(VCPROJ_FILE): $(BUILD_PROJECT_CREATOR) $(VCPROJ_VARDEPS_FILE)
       
   140 	$(call MakeDir, $(@D))
       
   141 	$(call ExecuteWithLog, $@, \
       
   142 	    $(PROJECT_CREATOR_TOOL) $(PROJECT_CREATOR_CLASS) \
       
   143 	    $(PROJECT_CREATOR_ARGS) -projectFileName $(call FixPath, $@)) \
       
   144 	    $(LOG_INFO)
       
   145 
       
   146   TARGETS += $(VCPROJ_FILE)
       
   147 
       
   148   all: $(TARGETS)
       
   149 
       
   150 else
       
   151   all:
       
   152 	$(info Hotspot Visual Studio generation only supported on Windows)
       
   153 endif
       
   154 
       
   155 .PHONY: all