jdk
154 строки · 5.5 Кб
1#
2# Copyright (c) 2016, 2023, 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
27default: all
28
29include $(SPEC)
30include MakeBase.gmk
31include JavaCompilation.gmk
32include Execute.gmk
33
34ifeq ($(call isTargetOs, windows), true)
35# The next part is a bit hacky. We include the CompileJvm.gmk to be
36# able to extract flags, but we do not wish to execute the rules.
37
38# Use primary variant for defines and includes
39JVM_VARIANT := $(JVM_VARIANT_MAIN)
40
41include HotspotCommon.gmk
42include lib/CompileJvm.gmk
43
44# Reset targets so we don't build libjvm.
45TARGETS :=
46
47ifeq ($(call isBuildOsEnv, windows.cygwin windows.msys2), true)
48FixLinuxExecutable = $(call FixPath, $1)
49else ifeq ($(call isBuildOsEnv, windows.wsl1 windows.wsl2), true)
50FixLinuxExecutable = "%windir%\Sysnative\wsl.exe $1"
51endif
52
53JVM_DEFINES_client := $(patsubst -D%,%, $(filter -D%, $(JVM_CFLAGS)))
54EXTRACTED_DEFINES_client := $(addprefix -define , $(JVM_DEFINES_client))
55
56JVM_INCLUDES_client := $(patsubst -I%,%, $(filter -I%, $(JVM_CFLAGS)))
57EXTRACTED_INCLUDES_client := $(foreach path, $(JVM_INCLUDES_client), -absoluteInclude $(call FixPath, $(path)))
58
59# Hand-code variant-specific arguments, based on the fact that we use
60# client for general arguments. Not optimal but other solutions require
61# major changes in ProjectCreator.
62ADDITIONAL_VARIANT_ARGS := \
63-define_server COMPILER2 \
64-ignorePath_client adfiles \
65-ignorePath_client c2_ \
66-ignorePath_client runtime_ \
67-ignorePath_client libadt \
68-ignorePath_client opto \
69#
70
71IGNORED_PLATFORMS_ARGS := \
72-ignorePath aarch64 \
73-ignorePath aix \
74-ignorePath arm \
75-ignorePath bsd \
76-ignorePath linux \
77-ignorePath posix \
78-ignorePath ppc \
79-ignorePath x86_32 \
80-ignorePath zero \
81#
82
83################################################################################
84# Build the ProjectCreator java tool.
85
86TOOLS_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)/support/ide_classes
87
88$(eval $(call SetupJavaCompilation, BUILD_PROJECT_CREATOR, \
89TARGET_RELEASE := $(TARGET_RELEASE_BOOTJDK), \
90DISABLED_WARNINGS := auxiliaryclass deprecation rawtypes unchecked cast options, \
91SRC := $(TOPDIR)/make/ide/visualstudio/hotspot/src/classes, \
92BIN := $(TOOLS_OUTPUTDIR), \
93JAVAC_FLAGS := -XDstringConcat=inline, \
94))
95
96TARGETS += $(BUILD_PROJECT_CREATOR)
97
98# Run the ProjectCreator tool
99PROJECT_CREATOR_TOOL := $(JAVA_SMALL) -cp $(TOOLS_OUTPUTDIR) build.tools.projectcreator.ProjectCreator
100
101IDE_OUTPUTDIR := $(OUTPUTDIR)/ide/hotspot-visualstudio
102
103VCPROJ_FILE := $(IDE_OUTPUTDIR)/jvm.vcxproj
104
105PROJECT_CREATOR_CLASS := build.tools.projectcreator.WinGammaPlatformVC10
106
107# We hard-code gensrc dir to server (since this includes adfiles)
108PROJECT_CREATOR_ARGS := \
109-sourceBase $(call FixPath, $(TOPDIR)/src) \
110-startAt hotspot \
111-relativeSrcInclude hotspot \
112-hidePath .hg \
113-hidePath .jcheck \
114-hidePath jdk.hotspot.agent \
115-hidePath jdk.internal.vm.ci \
116-hidePath jdk.jfr \
117-compiler VC10 \
118-jdkTargetRoot $(call FixPath, $(JDK_OUTPUTDIR)) \
119-platformName x64 \
120-buildBase $(call FixPath, $(IDE_OUTPUTDIR)/vs-output) \
121-buildSpace $(call FixPath, $(IDE_OUTPUTDIR)) \
122-makeBinary $(call FixLinuxExecutable, $(MAKE)) \
123-makeOutput $(call FixPath, $(JDK_OUTPUTDIR)/bin/server) \
124-absoluteInclude $(call FixPath, $(HOTSPOT_OUTPUTDIR)/variant-server/gensrc) \
125-absoluteSrcInclude $(call FixPath, $(HOTSPOT_OUTPUTDIR)/variant-server/gensrc) \
126$(EXTRACTED_DEFINES_client) \
127$(EXTRACTED_INCLUDES_client) \
128$(ADDITIONAL_VARIANT_ARGS) \
129$(IGNORED_PLATFORMS_ARGS) \
130#
131
132VCPROJ_VARDEPS := $(PROJECT_CREATOR_CLASS) $(PROJECT_CREATOR_ARGS)
133VCPROJ_VARDEPS_FILE := $(call DependOnVariable, VCPROJ_VARDEPS, \
134$(VCPROJ_FILE).vardeps)
135
136$(eval $(call SetupExecute, vcproj_file, \
137INFO := Generating Visual Studio project file, \
138DEPS := $(BUILD_PROJECT_CREATOR) $(VCPROJ_VARDEPS_FILE), \
139OUTPUT_FILE := $(VCPROJ_FILE), \
140COMMAND := $(PROJECT_CREATOR_TOOL) $(PROJECT_CREATOR_CLASS) \
141$(PROJECT_CREATOR_ARGS) -projectFileName $(call FixPath, $(VCPROJ_FILE)) \
142$(LOG_INFO), \
143))
144
145TARGETS += $(vcproj_file_TARGET)
146
147all: $(TARGETS)
148
149else
150all:
151$(info Hotspot Visual Studio generation only supported on Windows)
152endif
153
154.PHONY: all
155