diff -r 8ca86cfb126f make/Main.gmk
--- a/make/Main.gmk	Wed Dec 06 15:51:06 2017 -0800
+++ b/make/Main.gmk	Wed Dec 13 16:27:04 2017 +0000
@@ -56,6 +56,9 @@
 # All modules for the current target platform.
 ALL_MODULES := $(call FindAllModules)
 
+# If not already set, set the JVM lib target so that the JVM will be built.
+JVM_LIBS_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-libs
+
 ################################################################################
 ################################################################################
 #
@@ -645,7 +648,7 @@
   generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs
 
   # Building one JVM variant is enough to start building the other libs
-  $(LIBS_TARGETS): hotspot-$(JVM_VARIANT_MAIN)-libs
+  $(LIBS_TARGETS): $(JVM_LIBS_TARGETS)
 
   $(LAUNCHER_TARGETS): java.base-libs
 
@@ -721,8 +724,12 @@
     java.base-jmod: jrtfs-jar $(filter-out java.base-jmod, $(JMOD_TARGETS))
   endif
 
-  # Building java.base-jmod requires all of hotspot to be built.
-  java.base-jmod: hotspot
+  # If not already set, set the JVM lib target so that the JVM will be built.
+  JAVA_BASE_JMOD_DEPS ?= hotspot
+  
+  # Building java.base-jmod requires all of VM (ie hotspot) to be built.
+  java.base-jmod: $(JAVA_BASE_JMOD_DEPS) 
+
 
   # Declare dependencies from <module>-jmod to all other module targets
   # When creating a BUILDJDK, the java compilation has already been done by the
@@ -748,7 +755,7 @@
   # 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 \
+  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.
@@ -808,8 +815,7 @@
   # populated (java, copy and gendata targets) and the basic libs and launchers
   # have been built.
   exploded-image-optimize: java copy gendata java.base-libs java.base-launchers \
-      buildtools-modules
-
+      buildtools-modules $(JVM_IMAGE_TARGETS) 
   bootcycle-images: jdk-image
 
   docs-jdk-api-javadoc: $(GENSRC_TARGETS) rmic
@@ -892,12 +898,17 @@
 ################################################################################
 # Virtual targets without recipes
 
+JVM_TOOLS_TARGETS ?= buildtools-hotspot
 buildtools: buildtools-langtools interim-langtools interim-rmic \
-    buildtools-jdk buildtools-hotspot
+    buildtools-jdk $(JVM_TOOLS_TARGETS) 
 
-hotspot: $(HOTSPOT_VARIANT_TARGETS) hotspot-jsig
-
-hotspot-libs: hotspot-jsig
+# Setup JVM variables if not already set for a different jvm other than hotspot
+JVM_RULE ?= hotspot
+JVM_RULE_TARGETS ?= $(HOTSPOT_VARIANT_TARGETS) hotspot-jsig
+JVM_LIB ?= hotspot-libs
+JVM_LIB_TARGETS ?= hotspot-jsig
+$(JVM_RULE): $(JVM_RULE_TARGETS) 
+$(JVM_LIB): $(JVM_LIB_TARGETS)
 
 # Create targets hotspot-libs and hotspot-gensrc.
 $(foreach v, $(JVM_VARIANTS), \
@@ -936,7 +947,7 @@
 $(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy))
 
 # Building java.base includes building all of hotspot.
-java.base: hotspot
+java.base: $(JVM_BUILD_TARGETS)
 
 demos: demos-jdk
 
@@ -1003,13 +1014,19 @@
 # This target builds the documentation image
 docs-image: docs-jdk
 
-# This target builds the test image
-test-image: prepare-test-image test-image-hotspot-jtreg-native \
+# If not already set, set the targets to built the test image
+TEST_IMAGE_TARGETS ?= prepare-test-image test-image-hotspot-jtreg-native \
     test-image-jdk-jtreg-native test-image-failure-handler test-image-hotspot-gtest \
     test-image-demos-jdk
 
+# This target builds the test image
+test-image: $(TEST_IMAGE_TARGETS)
+
+# If not already set, set the targets to built all images
+ALL_IMAGES_TARGETS ?= product-images test-image docs-image
+
 # all-images builds all our deliverables as images.
-all-images: product-images test-image docs-image
+all-images: $(ALL_IMAGES_TARGETS)
 
 # all-bundles packages all our deliverables as tar.gz bundles.
 all-bundles: product-bundles test-bundles docs-bundles
