2019-06-03 08:28:03 +00:00
|
|
|
#
|
2020-05-19 13:49:46 +00:00
|
|
|
# Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
2019-06-03 08:28:03 +00:00
|
|
|
# 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
|
|
|
|
|
2022-01-19 14:18:14 +00:00
|
|
|
################################################################################
|
|
|
|
# SedEscape
|
|
|
|
#
|
|
|
|
# Escape special characters for use in SED replacement string
|
|
|
|
################################################################################
|
|
|
|
SedEscape = $(subst !,\!,$(subst \,\\,$1))
|
|
|
|
|
2019-06-03 08:28:03 +00:00
|
|
|
################################################################################
|
|
|
|
# Return the full path to an indexer-specific file fragment.
|
|
|
|
#
|
|
|
|
# Param 1: Fragment name
|
|
|
|
################################################################################
|
|
|
|
GetIndexerFragment = \
|
2020-05-19 13:49:46 +00:00
|
|
|
$(TOPDIR)/make/ide/vscode/hotspot/indexers/$(VSCODE_INDEXER)-$(1).txt
|
2019-06-03 08:28:03 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Show indexer-specific notes if they exist, otherwise do nothing
|
|
|
|
################################################################################
|
2024-09-03 15:31:09 +00:00
|
|
|
ifneq ($(wildcard $(call GetIndexerFragment,notes)), )
|
2019-06-03 08:28:03 +00:00
|
|
|
ShowIndexerNotes = $(CAT) $(call GetIndexerFragment,notes)
|
|
|
|
else
|
|
|
|
ShowIndexerNotes =
|
|
|
|
endif
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Return the platform-dependent preferred debug engine name.
|
|
|
|
################################################################################
|
|
|
|
ifeq ($(call isTargetOs, windows), true)
|
|
|
|
DebugEngineName = cppvsdbg
|
|
|
|
else
|
|
|
|
DebugEngineName = cppdbg
|
|
|
|
endif
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Return an additional configuration fragment if the WORKSPACE_ROOT is different
|
|
|
|
# from TOPDIR.
|
|
|
|
################################################################################
|
2024-09-03 15:31:09 +00:00
|
|
|
ifneq ($(WORKSPACE_ROOT), $(TOPDIR))
|
2020-05-19 13:49:46 +00:00
|
|
|
GetExtraWorkspaceRoot = $(TOPDIR)/make/ide/vscode/hotspot/template-workspace-folder.txt
|
2019-06-03 08:28:03 +00:00
|
|
|
else
|
|
|
|
GetExtraWorkspaceRoot = /dev/null
|
|
|
|
endif
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Create a project configuration from a given template, replacing a known set
|
|
|
|
# of variables.
|
|
|
|
#
|
|
|
|
# Param 1: Template
|
|
|
|
# Param 2: Output
|
|
|
|
################################################################################
|
|
|
|
define CreateFromTemplate
|
|
|
|
$(call LogInfo, Generating $2)
|
|
|
|
$(call MakeDir, $(dir $2))
|
|
|
|
$(SED) -e '/{{INDEXER_EXTENSIONS}}/r $(call GetIndexerFragment,extensions)' \
|
|
|
|
-e '/{{INDEXER_SETTINGS}}/r $(call GetIndexerFragment,settings)' \
|
|
|
|
-e '/{{EXTRA_WORKSPACE_ROOT}}/r $(call GetExtraWorkspaceRoot)' $1 | \
|
2022-01-19 14:18:14 +00:00
|
|
|
$(SED) -e 's!{{TOPDIR}}!$(call SedEscape,$(call FixPath,$(TOPDIR)))!g' \
|
|
|
|
-e 's!{{TOPDIR_RELATIVE}}!$(call SedEscape,$(call FixPath,$(strip \
|
|
|
|
$(call RelativePath,$(OUTPUTDIR),$(TOPDIR)))))!g' \
|
|
|
|
-e 's!{{WORKSPACE_ROOT}}!$(call SedEscape,$(call FixPath,$(WORKSPACE_ROOT)))!g' \
|
|
|
|
-e 's!{{OUTPUTDIR}}!$(call SedEscape,$(call FixPath,$(OUTPUTDIR)))!g' \
|
2019-06-03 08:28:03 +00:00
|
|
|
-e 's!{{CONF_NAME}}!$(CONF_NAME)!g' \
|
2022-01-19 14:18:14 +00:00
|
|
|
-e 's!{{COMPILER}}!$(call SedEscape,$(call FixPath,$(CXX))) $(SYSROOT_CFLAGS)!g' \
|
|
|
|
-e 's!{{MAKE}}!$(call SedEscape,$(call FixPath,$(MAKE)))!g' \
|
|
|
|
-e 's!{{PATH}}!$(call SedEscape,$(call FixPath,$(PATH)))!g' \
|
2019-06-03 08:28:03 +00:00
|
|
|
-e 's!{{DEBUGENGINENAME}}!$(call DebugEngineName)!g' \
|
|
|
|
-e '/{{INDEXER_EXTENSIONS}}/d' \
|
|
|
|
-e '/{{INDEXER_SETTINGS}}/d' \
|
|
|
|
-e '/{{EXTRA_WORKSPACE_ROOT}}/d' \
|
|
|
|
> $2
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(OUTPUTDIR)/jdk.code-workspace:
|
|
|
|
$(call LogWarn, Creating workspace $@)
|
2020-05-19 13:49:46 +00:00
|
|
|
$(call CreateFromTemplate, $(TOPDIR)/make/ide/vscode/hotspot/template-workspace.jsonc, $@)
|
2019-06-03 08:28:03 +00:00
|
|
|
$(call ShowIndexerNotes)
|
|
|
|
|
|
|
|
$(OUTPUTDIR)/.vscode/tasks.json:
|
2020-05-19 13:49:46 +00:00
|
|
|
$(call CreateFromTemplate, $(TOPDIR)/make/ide/vscode/hotspot/template-tasks.jsonc, $@)
|
2019-06-03 08:28:03 +00:00
|
|
|
|
|
|
|
$(OUTPUTDIR)/.vscode/launch.json:
|
2020-05-19 13:49:46 +00:00
|
|
|
$(call CreateFromTemplate, $(TOPDIR)/make/ide/vscode/hotspot/template-launch.jsonc, $@)
|
2019-06-03 08:28:03 +00:00
|
|
|
|
|
|
|
TARGETS := $(OUTPUTDIR)/jdk.code-workspace $(OUTPUTDIR)/.vscode/tasks.json \
|
|
|
|
$(OUTPUTDIR)/.vscode/launch.json
|
|
|
|
|
|
|
|
all: $(TARGETS)
|
|
|
|
|
|
|
|
.PHONY: all $(TARGETS)
|