< prev index next >

make/Main.gmk

Print this page

        

@@ -64,30 +64,34 @@
 ################################################################################
 
 ################################################################################
 # Interim/build tools targets, compiling tools used during the build
 
-buildtools-langtools:
+# When creating a BUILDJDK, the buildtools and interim targets have already
+# been built and should not be built again.
+ifneq ($(CREATING_BUILDJDK), true)
+  buildtools-langtools:
         +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f ToolsLangtools.gmk)
 
-interim-langtools:
+  interim-langtools:
         +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimLangtools.gmk)
 
-interim-rmic:
+  interim-rmic:
         +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
 
-interim-cldrconverter:
+  interim-cldrconverter:
         +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
 
-buildtools-jdk:
+  buildtools-jdk:
         +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileToolsJdk.gmk)
 
-buildtools-modules:
+  buildtools-modules:
         +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileModuleTools.gmk)
 
-buildtools-hotspot:
+  buildtools-hotspot:
         +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileToolsHotspot.gmk)
+endif
 
 ALL_TARGETS += buildtools-langtools interim-langtools \
     interim-rmic interim-cldrconverter buildtools-jdk buildtools-modules \
     buildtools-hotspot
 

@@ -100,43 +104,47 @@
 ALL_TARGETS += generate-exported-symbols
 
 ################################################################################
 # Gensrc targets, generating source before java compilation can be done
 #
-$(eval $(call DeclareRecipesForPhase, GENSRC, \
-    TARGET_SUFFIX := gensrc-src, \
-    FILE_PREFIX := Gensrc, \
-    MAKE_SUBDIR := gensrc, \
-    CHECK_MODULES := $(ALL_MODULES), \
-))
-
-$(foreach m, $(GENSRC_MODULES), $(eval $m-gensrc: $m-gensrc-src))
-
-LANGTOOLS_GENSRC_TARGETS := $(filter $(addsuffix -%, $(LANGTOOLS_MODULES)), $(GENSRC_TARGETS))
-INTERIM_LANGTOOLS_GENSRC_TARGETS := $(filter $(addsuffix -%, \
-    $(INTERIM_LANGTOOLS_BASE_MODULES)), $(GENSRC_TARGETS))
-HOTSPOT_GENSRC_TARGETS := $(filter $(addsuffix -%, $(HOTSPOT_MODULES)), $(GENSRC_TARGETS))
-JDK_GENSRC_TARGETS := $(filter-out $(LANGTOOLS_GENSRC_TARGETS) \
-    $(HOTSPOT_GENSRC_TARGETS), $(GENSRC_TARGETS))
-
-GENSRC_MODULEINFO_MODULES := $(ALL_MODULES)
-GENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \
-    $(GENSRC_MODULEINFO_MODULES))
-
-GENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES)
-GENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \
-    $(addsuffix -gensrc, $(GENSRC_MODULES)))
+# When creating a BUILDJDK, the java targets have already been built and copied
+# into the buildjdk so no need to generate sources.
+ifneq ($(CREATING_BUILDJDK), true)
+  $(eval $(call DeclareRecipesForPhase, GENSRC, \
+      TARGET_SUFFIX := gensrc-src, \
+      FILE_PREFIX := Gensrc, \
+      MAKE_SUBDIR := gensrc, \
+      CHECK_MODULES := $(ALL_MODULES), \
+  ))
+
+  $(foreach m, $(GENSRC_MODULES), $(eval $m-gensrc: $m-gensrc-src))
+
+  LANGTOOLS_GENSRC_TARGETS := $(filter $(addsuffix -%, $(LANGTOOLS_MODULES)), $(GENSRC_TARGETS))
+  INTERIM_LANGTOOLS_GENSRC_TARGETS := $(filter $(addsuffix -%, \
+      $(INTERIM_LANGTOOLS_BASE_MODULES)), $(GENSRC_TARGETS))
+  HOTSPOT_GENSRC_TARGETS := $(filter $(addsuffix -%, $(HOTSPOT_MODULES)), $(GENSRC_TARGETS))
+  JDK_GENSRC_TARGETS := $(filter-out $(LANGTOOLS_GENSRC_TARGETS) \
+      $(HOTSPOT_GENSRC_TARGETS), $(GENSRC_TARGETS))
+
+  GENSRC_MODULEINFO_MODULES := $(ALL_MODULES)
+  GENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \
+      $(GENSRC_MODULEINFO_MODULES))
+
+  GENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES)
+  GENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \
+      $(addsuffix -gensrc, $(GENSRC_MODULES)))
 
-define DeclareModuleInfoRecipe
-  $1-gensrc-moduleinfo:
+  define DeclareModuleInfoRecipe
+    $1-gensrc-moduleinfo:
         +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
             -f GensrcModuleInfo.gmk MODULE=$1)
 
-  $1-gensrc: $1-gensrc-moduleinfo
-endef
+    $1-gensrc: $1-gensrc-moduleinfo
+  endef
 
-$(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
+  $(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
+endif
 
 ALL_TARGETS += $(GENSRC_TARGETS)
 
 ################################################################################
 # Generate data targets

@@ -278,31 +286,10 @@
 
 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)
 

@@ -348,11 +335,11 @@
 bootcycle-images:
         ifneq ($(COMPILE_TYPE), cross)
           $(call LogWarn, Boot cycle build step 2: Building a new JDK image using previously built image)
           $(call MakeDir, $(OUTPUTDIR)/bootcycle-build)
           +$(MAKE) $(MAKE_ARGS) -f $(TOPDIR)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \
-              LOG_PREFIX="[bootcycle] " JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main
+              JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main
         else
           $(call LogWarn, Boot cycle build disabled when cross compiling)
         endif
 
 zip-security:

@@ -445,22 +432,19 @@
   # This target is only called by the recursive call below.
   create-buildjdk-interim-image-helper: interim-image jdk.jlink-launchers \
       java.base-copy jdk.jdeps-launchers
 endif
 
-BUILDJDK_MODULES := $(sort $(foreach m, jdk.jlink $(INTERIM_IMAGE_MODULES), \
-    $(call FindTransitiveDepsForModule, $m) $m))
+create-buildjdk-copy:
+        +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreateBuildJdkCopy.gmk)
 
 create-buildjdk-interim-image:
         +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk \
             $@-helper \
             SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
             HOTSPOT_SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
-            CREATING_BUILDJDK=true \
-            LOG_PREFIX="[buildjdk] " \
-            JAVA_MODULES="$(BUILDJDK_MODULES)" \
-        )
+            CREATING_BUILDJDK=true)
 
 ALL_TARGETS += create-buildjdk-copy create-buildjdk-interim-image
 
 ################################################################################
 # The interim-image is a small jlinked image that is used to generate artifacts

@@ -688,11 +672,11 @@
   endif
 
   # The demos are currently linking to libjvm and libjava, just like all other
   # jdk libs, even though they don't need to. To avoid warnings, make sure they
   # aren't built until after libjava and libjvm are available to link to.
-  demos-jdk: java.base-libs exploded-image
+  demos-jdk: java.base-libs exploded-image-optimize
   test-image-demos-jdk: demos-jdk
 
   # Declare dependency from <module>-java to <module>-gensrc
   $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
 

@@ -704,11 +688,15 @@
   # Declare dependencies between <module>-rmic to <module>-java
   $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
 
   # Declare dependencies from <module>-lib to <module>-java
   # Skip modules that do not have java source.
-  $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
+  # When creating a BUILDJDK, the java compilation has already been done by the
+  # normal build and copied in.
+  ifneq ($(CREATING_BUILDJDK), true)
+    $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
+  endif
 
   # Declare dependencies from all other <module>-lib to java.base-lib
   $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
       $(eval $t: java.base-libs))
 

@@ -742,11 +730,11 @@
   # The ct.sym generation uses all the moduleinfos as input
   jdk.compiler-gendata: $(GENSRC_MODULEINFO_TARGETS)
 
   # Declare dependencies between jmod targets.
   # java.base jmod needs jrt-fs.jar and access to the other jmods to be built.
-  # When creating the BUILDJDK, we don't need to add hashes to java.base, thus
+  # When creating a BUILDJDK, we don't need to add hashes to java.base, thus
   # we don't need to depend on all other jmods
   ifneq ($(CREATING_BUILDJDK), true)
     java.base-jmod: jrtfs-jar $(filter-out java.base-jmod, $(JMOD_TARGETS))
   endif
 

@@ -755,11 +743,15 @@
 
   # Building java.base-jmod requires all of VM (ie hotspot) to be built.
   java.base-jmod: $(JVM_MAIN_TARGETS)
 
   # Declare dependencies from <module>-jmod to all other module targets
-  $(foreach m, $(JAVA_MODULES), $(eval $m_JMOD_DEPS += $m-java))
+  # When creating a BUILDJDK, the java compilation has already been done by the
+  # normal build and copied in.
+  ifneq ($(CREATING_BUILDJDK), true)
+    $(foreach m, $(JAVA_MODULES), $(eval $m_JMOD_DEPS += $m-java))
+  endif
   $(foreach m, $(GENDATA_MODULES), $(eval $m_JMOD_DEPS += $m-gendata))
   $(foreach m, $(RMIC_MODULES), $(eval $m_JMOD_DEPS += $m-rmic))
   $(foreach m, $(LIBS_MODULES), $(eval $m_JMOD_DEPS += $m-libs))
   $(foreach m, $(LAUNCHER_MODULES), $(eval $m_JMOD_DEPS += $m-launchers))
   $(foreach m, $(COPY_MODULES), $(eval $m_JMOD_DEPS += $m-copy))

@@ -780,41 +772,38 @@
   $(COMPILE_COMMANDS_TARGETS_HOTSPOT): clean-compile-commands
   $(COMPILE_COMMANDS_TARGETS_JDK): clean-compile-commands
   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.
+  #
+  # For the exploded image to be runnable, all java modules and
+  # jdk.jlink-launchers need to be built. We also need to copy jvm.cfg (done
+  # in java.base-copy) and tzdb.dat (done in java.base-gendata) to the
+  # appropriate location otherwise jimage, jlink and jmod won't start. This
+  # also applies when creating the buildjdk.
+  DEFAULT_JMOD_DEPS += java.base-libs java.base-copy java.base-gendata \
+      jdk.jlink-launchers
+  # When cross compiling and buildjdk is to be created, depend on creating the
+  # buildjdk instead of the default dependencies.
   ifeq ($(CREATE_BUILDJDK), true)
+    # Avoid calling create-buildjdk from within a create-buildjdk call.
     ifneq ($(CREATING_BUILDJDK), true)
-      # When cross compiling and buildjdk is to be created, simply depend on
-      # creating the buildjdk.
       $(JMOD_TARGETS): create-buildjdk
       buildtools-modules: create-buildjdk
     else
-      # While actually creating the buildjdk, we need to list the bare
-      # minimum dependencies needed before running jmod, to avoid building
-      # more than necessary. This includes:
-      # * all java modules
-      # * jdk.jlink-launchers
-      # * copy jvm.cfg (done in java.base-copy)
-      # * tzdb.dat (done in java.base-gendata)
-      # Without all of these jimage, jlink and jmod won't start.
-      $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): java.base-libs java.base-copy \
-          java.base-gendata jdk.jlink-launchers java
+      # While actually creating the buildjdk, the default deps applies.
+      $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): $(DEFAULT_JMOD_DEPS)
     endif
   else
-    # The normal non cross compilation case uses needs to wait for the full
-    # exploded-image to avoid a race with the optimize target.
-    $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): exploded-image
+    # The normal non cross compilation case uses the default deps.
+    # To avoid races with the optimize target, that also needs to happen first.
+    $(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): $(DEFAULT_JMOD_DEPS) \
+        exploded-image-optimize
   endif
 
   # All modules include the main license files from java.base.
   $(JMOD_TARGETS): java.base-copy
 

@@ -898,24 +887,29 @@
 
   # Declare dependency for all generated test targets
   $(foreach t, $(filter-out test-make%, $(ALL_TEST_TARGETS)), $(eval $t: jdk-image test-image))
   $(foreach t, $(ALL_EXPLODED_TEST_TARGETS), $(eval $t: exploded-image test-image))
 
+  create-buildjdk-copy: jdk.jlink-java java.base-gendata \
+      $(addsuffix -java, $(INTERIM_IMAGE_MODULES))
+
+  create-buildjdk-interim-image: create-buildjdk-copy
+
   interim-image: $(INTERIM_JMOD_TARGETS)
 
-  build-test-lib: exploded-image
+  build-test-lib: exploded-image-optimize
 
   build-test-failure-handler: interim-langtools
 
   test-image-failure-handler: build-test-failure-handler
 
   build-test-hotspot-jtreg-native: buildtools-jdk \
       hotspot-$(JVM_VARIANT_MAIN)-libs
 
   build-test-jdk-jtreg-native: buildtools-jdk java.base-libs
 
-  build-test-hotspot-jtreg-graal: exploded-image
+  build-test-hotspot-jtreg-graal: exploded-image-optimize
 
   test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
 
   test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
 

@@ -1003,11 +997,11 @@
 # be runnable on the host platform anyway.
 ifneq ($(COMPILE_TYPE), cross)
   exploded-image: exploded-image-optimize
 endif
 
-create-buildjdk: create-buildjdk-interim-image
+create-buildjdk: create-buildjdk-copy create-buildjdk-interim-image
 
 docs-jdk-api: docs-jdk-api-javadoc
 docs-javase-api: docs-javase-api-javadoc
 docs-reference-api: docs-reference-api-javadoc
 
< prev index next >