< prev index next >
make/Main.gmk
Print this page
rev 52916 : 8210459: Add support for generating compile_commands.json
Reviewed-by: andrew
rev 52917 : 8217728: Speed up incremental rerun of "make hotspot"
Reviewed-by: tbell
rev 52920 : 8223678: Add Visual Studio Code workspace generation support (for native code)
Reviewed-by: andrew, sgehwolf, clanger
rev 52921 : 8233383: Various minor fixes
Reviewed-by: mbalao
*** 138,148 ****
$(addsuffix -gensrc, $(GENSRC_MODULES)))
define DeclareModuleInfoRecipe
$1-gensrc-moduleinfo:
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
! -f GensrcModuleInfo.gmk MODULE=$1)
$1-gensrc: $1-gensrc-moduleinfo
endef
$(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
--- 138,148 ----
$(addsuffix -gensrc, $(GENSRC_MODULES)))
define DeclareModuleInfoRecipe
$1-gensrc-moduleinfo:
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
! -f gensrc/GensrcModuleInfo.gmk MODULE=$1)
$1-gensrc: $1-gensrc-moduleinfo
endef
$(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
*** 265,274 ****
--- 265,320 ----
ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \
$(HOTSPOT_VARIANT_LIBS_TARGETS) hotspot-ide-project
################################################################################
+ # Generate libs and launcher targets for creating compile_commands.json fragments
+ define DeclareCompileCommandsRecipe
+ $1-compile-commands:
+ $$(call LogInfo, Generating compile_commands.json fragments for $1)
+ +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk $1-only \
+ GENERATE_COMPILE_COMMANDS_ONLY=true)
+
+ COMPILE_COMMANDS_TARGETS_$2 += $1-compile-commands
+ endef
+
+ $(foreach t, $(HOTSPOT_VARIANT_LIBS_TARGETS), \
+ $(eval $(call DeclareCompileCommandsRecipe,$t,HOTSPOT)) \
+ )
+
+ $(foreach t, $(LIBS_TARGETS) $(LAUNCHER_TARGETS), \
+ $(eval $(call DeclareCompileCommandsRecipe,$t,JDK)) \
+ )
+
+ compile-commands compile-commands-hotspot:
+ +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileCommands.gmk)
+
+ ALL_TARGETS += $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK)
+ ALL_TARGETS += compile-commands compile-commands-hotspot
+
+ ################################################################################
+ # VS Code projects
+ vscode-project:
+ +($(CD) $(TOPDIR)/make/vscode && $(MAKE) $(MAKE_ARGS) -f CreateVSCodeProject.gmk \
+ VSCODE_INDEXER=cpptools)
+
+ vscode-project-clangd:
+ +($(CD) $(TOPDIR)/make/vscode && $(MAKE) $(MAKE_ARGS) -f CreateVSCodeProject.gmk \
+ VSCODE_INDEXER=clangd)
+
+ vscode-project-rtags:
+ +($(CD) $(TOPDIR)/make/vscode && $(MAKE) $(MAKE_ARGS) -f CreateVSCodeProject.gmk \
+ VSCODE_INDEXER=rtags)
+
+ vscode-project-ccls:
+ +($(CD) $(TOPDIR)/make/vscode && $(MAKE) $(MAKE_ARGS) -f CreateVSCodeProject.gmk \
+ VSCODE_INDEXER=ccls)
+
+ ALL_TARGETS += vscode-project vscode-project-clangd vscode-project-rtags \
+ vscode-project-ccls
+
+ ################################################################################
# Build demos targets
demos-jdk:
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
*** 561,572 ****
$(call RunTests, "jdk_native_sanity", $(JDK_IMAGE_DIR))
test-make:
($(CD) $(TOPDIR)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
ALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \
! test-hotspot-internal test-hotspot-gtest test-jdk-jtreg-native test-make
################################################################################
# Bundles
product-bundles:
--- 607,622 ----
$(call RunTests, "jdk_native_sanity", $(JDK_IMAGE_DIR))
test-make:
($(CD) $(TOPDIR)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
+ test-compile-commands:
+ ($(CD) $(TOPDIR)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk test-compile-commands)
+
ALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \
! test-hotspot-internal test-hotspot-gtest test-jdk-jtreg-native test-make \
! test-compile-commands
################################################################################
# Bundles
product-bundles:
*** 634,644 ****
$(JAVA_TARGETS): interim-langtools
# Declare dependencies between hotspot-<variant>* targets
$(foreach v, $(JVM_VARIANTS), \
- $(eval hotspot-$v: hotspot-$v-gensrc hotspot-$v-libs) \
$(eval hotspot-$v-gensrc: java.base-copy) \
$(eval hotspot-$v-libs: hotspot-$v-gensrc java.base-copy) \
)
hotspot-ide-project: hotspot exploded-image
--- 684,693 ----
*** 742,751 ****
--- 791,819 ----
$(foreach m, $(LAUNCHER_MODULES), $(eval $m_JMOD_DEPS += $m-launchers))
$(foreach m, $(COPY_MODULES), $(eval $m_JMOD_DEPS += $m-copy))
$(foreach m, $(ALL_MODULES), $(eval $m-jmod: $($(m)_JMOD_DEPS)))
$(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $m-interim-jmod: $($(m)_JMOD_DEPS)))
+ # Setup the minimal set of generated native source dependencies for hotspot
+ $(foreach v, $(JVM_VARIANTS), \
+ $(eval hotspot-$v-libs-compile-commands: hotspot-$v-gensrc) \
+ $(foreach m, $(filter java.desktop jdk.hotspot.agent, $(GENSRC_MODULES)), \
+ $(eval hotspot-$v-libs-compile-commands: $m-gensrc)) \
+ )
+
+ # For the full JDK compile commands, create all possible generated sources
+ $(foreach m, $(GENSRC_MODULES), $(eval $m-libs-compile-commands: $m-gensrc))
+ $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs-compile-commands: $m-java))
+
+ compile-commands-hotspot: $(COMPILE_COMMANDS_TARGETS_HOTSPOT)
+ compile-commands: $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK)
+
+ vscode-project: compile-commands
+ vscode-project-clangd: compile-commands
+ vscode-project-rtags: compile-commands
+ vscode-project-ccls: compile-commands
+
# Jmods cannot be created until we have the jmod tool ready to run. During
# a normal build we run it from the exploded image, but when cross compiling
# it's run from the buildjdk, which is either created at build time or user
# supplied.
#
*** 856,865 ****
--- 924,935 ----
interim-image: $(INTERIM_JMOD_TARGETS)
test-make: clean-test-make
+ test-compile-commands: compile-commands
+
build-test-lib: exploded-image-optimize
build-test-failure-handler: interim-langtools
test-failure-handler: build-test-failure-handler
*** 909,918 ****
--- 979,992 ----
# If not already set, set the JVM specific tools targets
JVM_TOOLS_TARGETS ?= buildtools-hotspot
buildtools: buildtools-langtools interim-langtools interim-rmic \
buildtools-jdk $(JVM_TOOLS_TARGETS)
+ # Declare dependencies from hotspot-<variant> targets
+ $(foreach v, $(JVM_VARIANTS), \
+ $(eval hotspot-$v: hotspot-$v-gensrc hotspot-$v-libs) \
+ )
hotspot: $(HOTSPOT_VARIANT_TARGETS)
# Create targets hotspot-libs and hotspot-gensrc.
$(foreach v, $(JVM_VARIANTS), \
$(eval hotspot-libs: hotspot-$v-libs) \
*** 1085,1095 ****
CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
$(addprefix $m-, $(CLEAN_PHASES))))
# Remove everything, except the output from configure.
clean: $(CLEAN_DIR_TARGETS)
! ($(CD) $(OUTPUTDIR) && $(RM) -r build*.log*)
$(ECHO) Cleaned all build artifacts.
clean-docs:
$(call CleanDocs)
--- 1159,1169 ----
CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
$(addprefix $m-, $(CLEAN_PHASES))))
# Remove everything, except the output from configure.
clean: $(CLEAN_DIR_TARGETS)
! ($(CD) $(OUTPUTDIR) && $(RM) -r build*.log* compile_commands.json)
$(ECHO) Cleaned all build artifacts.
clean-docs:
$(call CleanDocs)
< prev index next >