make/vscode/CreateVSCodeProject.gmk
author kbarrett
Thu, 04 Jul 2019 13:26:41 -0400
changeset 55592 fd1a4c4b7616
parent 55166 2ae056696b15
permissions -rw-r--r--
8226793: Replace OopStorage dup_name with os::strdup Summary: Use os::strdup and os::free. Reviewed-by: tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55166
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
     1
#
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
     2
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
     4
#
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    10
#
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    15
# accompanied this code).
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    16
#
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    20
#
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    23
# questions.
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    24
#
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    25
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    26
# This must be the first rule
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    27
default: all
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    28
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    29
include $(SPEC)
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    30
include MakeBase.gmk
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    31
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    32
################################################################################
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    33
# Return the full path to an indexer-specific file fragment.
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    34
#
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    35
# Param 1: Fragment name
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    36
################################################################################
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    37
GetIndexerFragment = \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    38
    $(TOPDIR)/make/vscode/indexers/$(VSCODE_INDEXER)-$(1).txt
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    39
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    40
################################################################################
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    41
# Show indexer-specific notes if they exist, otherwise do nothing
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    42
################################################################################
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    43
ifneq (,$(wildcard $(call GetIndexerFragment,notes)))
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    44
  ShowIndexerNotes = $(CAT) $(call GetIndexerFragment,notes)
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    45
else
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    46
  ShowIndexerNotes =
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    47
endif
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    48
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    49
################################################################################
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    50
# Return the platform-dependent preferred debug engine name.
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    51
################################################################################
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    52
ifeq ($(call isTargetOs, windows), true)
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    53
  DebugEngineName = cppvsdbg
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    54
else
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    55
  DebugEngineName = cppdbg
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    56
endif
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    57
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    58
################################################################################
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    59
# Return an additional configuration fragment if the WORKSPACE_ROOT is different
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    60
# from TOPDIR.
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    61
################################################################################
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    62
ifneq ($(WORKSPACE_ROOT),$(TOPDIR))
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    63
  GetExtraWorkspaceRoot = $(TOPDIR)/make/vscode/template-workspace-folder.txt
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    64
else
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    65
  GetExtraWorkspaceRoot = /dev/null
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    66
endif
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    67
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    68
################################################################################
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    69
# Create a project configuration from a given template, replacing a known set
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    70
# of variables.
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    71
#
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    72
# Param 1: Template
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    73
# Param 2: Output
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    74
################################################################################
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    75
define CreateFromTemplate
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    76
	$(call LogInfo, Generating $2)
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    77
	$(call MakeDir, $(dir $2))
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    78
	$(SED) -e '/{{INDEXER_EXTENSIONS}}/r $(call GetIndexerFragment,extensions)' \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    79
	    -e '/{{INDEXER_SETTINGS}}/r $(call GetIndexerFragment,settings)' \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    80
	    -e '/{{EXTRA_WORKSPACE_ROOT}}/r $(call GetExtraWorkspaceRoot)' $1 | \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    81
	$(SED) -e 's!{{TOPDIR}}!$(call FixPath,$(TOPDIR))!g' \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    82
	    -e 's!{{TOPDIR_RELATIVE}}!$(call FixPath,$(strip \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    83
	        $(call RelativePath,$(OUTPUTDIR),$(TOPDIR))))!g' \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    84
	    -e 's!{{WORKSPACE_ROOT}}!$(call FixPath,$(WORKSPACE_ROOT))!g' \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    85
	    -e 's!{{OUTPUTDIR}}!$(call FixPath,$(OUTPUTDIR))!g' \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    86
	    -e 's!{{CONF_NAME}}!$(CONF_NAME)!g' \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    87
	    -e 's!{{COMPILER}}!$(call FixPath,$(CXX)) $(SYSROOT_CFLAGS)!g' \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    88
	    -e 's!{{MAKE}}!$(call FixPath,$(MAKE))!g' \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    89
	    -e 's!{{PATH}}!$(call FixPathList,$(PATH))!g' \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    90
	    -e 's!{{DEBUGENGINENAME}}!$(call DebugEngineName)!g' \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    91
	    -e '/{{INDEXER_EXTENSIONS}}/d' \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    92
	    -e '/{{INDEXER_SETTINGS}}/d' \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    93
	    -e '/{{EXTRA_WORKSPACE_ROOT}}/d' \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    94
	    > $2
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    95
endef
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    96
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    97
$(OUTPUTDIR)/jdk.code-workspace:
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    98
	$(call LogWarn, Creating workspace $@)
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
    99
	$(call CreateFromTemplate, $(TOPDIR)/make/vscode/template-workspace.jsonc, $@)
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
   100
	$(call ShowIndexerNotes)
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
   101
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
   102
$(OUTPUTDIR)/.vscode/tasks.json:
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
   103
	$(call CreateFromTemplate, $(TOPDIR)/make/vscode/template-tasks.jsonc, $@)
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
   104
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
   105
$(OUTPUTDIR)/.vscode/launch.json:
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
   106
	$(call CreateFromTemplate, $(TOPDIR)/make/vscode/template-launch.jsonc, $@)
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
   107
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
   108
TARGETS := $(OUTPUTDIR)/jdk.code-workspace $(OUTPUTDIR)/.vscode/tasks.json \
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
   109
    $(OUTPUTDIR)/.vscode/launch.json
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
   110
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
   111
all: $(TARGETS)
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
   112
2ae056696b15 8223678: Add Visual Studio Code workspace generation support (for native code)
rwestberg
parents:
diff changeset
   113
.PHONY: all $(TARGETS)