Re: Proposal: make/Main.gmk Add extra extension/override points to the make file

2018-02-20 Thread Erik Joelsson

This looks ok, I will push it.

https://bugs.openjdk.java.net/browse/JDK-8198425

/Erik


On 2018-02-19 04:39, Steve Groeger wrote:

diff -r b2f2bdba0472 make/Main.gmk
--- a/make/Main.gmkFri Jan 26 11:27:53 2018 -0800
+++ b/make/Main.gmkMon Feb 19 12:31:55 2018 +
@@ -644,8 +644,11 @@
   generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs
+  # If not already set, set the JVM variant target so that the JVM 
will be built.

+  JVM_MAIN_LIB_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-libs
+
   # Building one JVM variant is enough to start building the other libs
-  $(LIBS_TARGETS): hotspot-$(JVM_VARIANT_MAIN)-libs
+  $(LIBS_TARGETS): $(JVM_MAIN_LIB_TARGETS)
   $(LAUNCHER_TARGETS): java.base-libs
@@ -722,8 +725,11 @@
     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 target so that the JVM will be built.
+  JVM_MAIN_TARGETS ?= hotspot
+
+  # Building java.base-jmod requires all of VM (ie hotspot) to be built.
+  java.base-jmod: $(JVM_MAIN_TARGETS)
   # Declare dependencies from -jmod to all other module targets
   # When creating a BUILDJDK, the java compilation has already been 
done by the

@@ -749,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.
@@ -824,9 +830,11 @@
   docs-javase-api-modulegraph: exploded-image buildtools-modules
   docs-reference-api-modulegraph: exploded-image buildtools-modules
-
+  # If not already set, then set the JVM specific docs targets
+  JVM_DOCS_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-gensrc
+
   # The gensrc steps for hotspot and jdk.jdi create html spec files.
-  docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc \
+  docs-jdk-specs: $(JVM_DOCS_TARGETS) jdk.jdi-gensrc \
       docs-jdk-index
   docs-jdk-index: exploded-image buildtools-modules
@@ -893,8 +901,10 @@
 

 # Virtual targets without recipes
+# If not already set, set the JVM specific tools targets
+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
@@ -937,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_MAIN_TARGETS)
 demos: demos-jdk
@@ -1004,10 +1014,15 @@
 # This target builds the documentation image
 docs-image: docs-jdk
+# If not already set, set the JVM specific targets to built the test 
image
+JVM_TEST_IMAGE_TARGETS ?= test-image-hotspot-jtreg-native 
test-image-hotspot-gtest

+
 # This target builds the test image
-test-image: 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
+test-image: prepare-test-image \
+    test-image-jdk-jtreg-native test-image-failure-handler \
+    test-image-demos-jdk $(JVM_TEST_IMAGE_TARGETS)
+
+
 # all-images builds all our deliverables as images.
 all-images: product-images test-image docs-image
@@ -1146,7 +1161,10 @@
     $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
 

+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, Main-post.gmk))
 .PHONY: $(ALL_TARGETS)
 FRC: # Force target




Re: Proposal: make/Main.gmk Add extra extension/override points to the make file

2018-02-19 Thread Steve Groeger
Hi Erik, 

Have made the changes you requested, so all should now be OK to contribute. 
Please let me know if there is anything else you need me to do in order to get 
this contributed.

Here is the latest diff:

diff -r b2f2bdba0472 make/Main.gmk
--- a/make/Main.gmk Fri Jan 26 11:27:53 2018 -0800
+++ b/make/Main.gmk Mon Feb 19 12:31:55 2018 +
@@ -644,8 +644,11 @@
 
   generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs
 
+  # If not already set, set the JVM variant target so that the JVM will be 
built.
+  JVM_MAIN_LIB_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-libs
+
   # Building one JVM variant is enough to start building the other libs
-  $(LIBS_TARGETS): hotspot-$(JVM_VARIANT_MAIN)-libs
+  $(LIBS_TARGETS): $(JVM_MAIN_LIB_TARGETS)
 
   $(LAUNCHER_TARGETS): java.base-libs
 
@@ -722,8 +725,11 @@
 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 target so that the JVM will be built.
+  JVM_MAIN_TARGETS ?= hotspot
+   
+  # Building java.base-jmod requires all of VM (ie hotspot) to be built.
+  java.base-jmod: $(JVM_MAIN_TARGETS) 
 
   # Declare dependencies from -jmod to all other module targets
   # When creating a BUILDJDK, the java compilation has already been done by the
@@ -749,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.
@@ -824,9 +830,11 @@
   docs-javase-api-modulegraph: exploded-image buildtools-modules
 
   docs-reference-api-modulegraph: exploded-image buildtools-modules
-
+  # If not already set, then set the JVM specific docs targets
+  JVM_DOCS_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-gensrc
+  
   # The gensrc steps for hotspot and jdk.jdi create html spec files.
-  docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc \
+  docs-jdk-specs: $(JVM_DOCS_TARGETS) jdk.jdi-gensrc \
   docs-jdk-index
 
   docs-jdk-index: exploded-image buildtools-modules
@@ -893,8 +901,10 @@
 

 # Virtual targets without recipes
 
+# If not already set, set the JVM specific tools targets
+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
 
@@ -937,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_MAIN_TARGETS)
 
 demos: demos-jdk
 
@@ -1004,10 +1014,15 @@
 # This target builds the documentation image
 docs-image: docs-jdk
 
+# If not already set, set the JVM specific targets to built the test image
+JVM_TEST_IMAGE_TARGETS ?= test-image-hotspot-jtreg-native 
test-image-hotspot-gtest
+
 # This target builds the test image
-test-image: 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
+test-image: prepare-test-image \
+test-image-jdk-jtreg-native test-image-failure-handler \
+test-image-demos-jdk $(JVM_TEST_IMAGE_TARGETS)
+
+
 
 # all-images builds all our deliverables as images.
 all-images: product-images test-image docs-image
@@ -1146,7 +1161,10 @@
  $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
 
 

+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, Main-post.gmk))
 
 .PHONY: $(ALL_TARGETS)
 
 FRC: # Force target
+

 
Thanks
Steve Groeger
Java Runtimes Development
IBM Hursley
IBM United Kingdom Ltd
Tel: (44) 1962 816911 Mobex: 279990 Mobile: 07718 517 129
Fax (44) 1962 816800
Lotus Notes: Steve Groeger/UK/IBM
Internet: groe...@uk.ibm.com
 
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU


-Erik Joelsson  wrote: -
To: Steve Groeger , build-dev@openjdk.java.net
From: Erik Joelsson 
Date: 02/16/2018 19:19
Subject: Re: Proposal: make/Main.gmk Add extra extension/override points to the 
make file

Hello,

I would rename the JVM_VARIANT_TARGETS to JVM_MAIN_LIB_TARGETS. The purpose of 
this target is 

Re: Proposal: make/Main.gmk Add extra extension/override points to the make file

2018-02-16 Thread Erik Joelsson

Hello,

I would rename the JVM_VARIANT_TARGETS to JVM_MAIN_LIB_TARGETS. The 
purpose of this target is to be the minimal amount of prerequisites 
before we can start linking to -ljvm. I would also move the definition 
of that variable down to its first use, like the other variables.


I'm not clear on the difference between JVM_BUILD_TARGETS and 
JVM_MAIN_TARGETS. They should probably be merged.


The docs targets comment needs a newline before it.

Otherwise this looks ok.

/Erik


On 2018-02-14 07:01, Steve Groeger wrote:

diff -r b2f2bdba0472 make/Main.gmk
--- a/make/Main.gmkFri Jan 26 11:27:53 2018 -0800
+++ b/make/Main.gmkWed Feb 14 14:37:15 2018 +
@@ -56,6 +56,9 @@
 # All modules for the current target platform.
 ALL_MODULES := $(call FindAllModules)
+# If not already set, set the JVM variant target so that the JVM will 
be built.

+JVM_VARIANT_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_VARIANT_TARGETS)
   $(LAUNCHER_TARGETS): java.base-libs
@@ -722,8 +725,11 @@
     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 target so that the JVM will be built.
+  JVM_MAIN_TARGETS ?= hotspot
+
+  # Building java.base-jmod requires all of VM (ie hotspot) to be built.
+  java.base-jmod: $(JVM_MAIN_TARGETS)
   # Declare dependencies from -jmod to all other module targets
   # When creating a BUILDJDK, the java compilation has already been 
done by the

@@ -749,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.
@@ -824,9 +830,11 @@
   docs-javase-api-modulegraph: exploded-image buildtools-modules
   docs-reference-api-modulegraph: exploded-image buildtools-modules
-
+  # If not already set, then set the JVM specific docs targets
+  JVM_DOCS_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-gensrc
+
   # The gensrc steps for hotspot and jdk.jdi create html spec files.
-  docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc \
+  docs-jdk-specs: $(JVM_DOCS_TARGETS) jdk.jdi-gensrc \
       docs-jdk-index
   docs-jdk-index: exploded-image buildtools-modules
@@ -893,8 +901,10 @@
 

 # Virtual targets without recipes
+# If not already set, set the JVM specific tools targets
+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
@@ -936,8 +946,11 @@
 $(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
 $(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy))
+# If not already set, set the JVM specific build targets
+JVM_BUILD_TARGETS ?= hotspot
+
 # Building java.base includes building all of hotspot.
-java.base: hotspot
+java.base: $(JVM_BUILD_TARGETS)
 demos: demos-jdk
@@ -1004,10 +1017,15 @@
 # This target builds the documentation image
 docs-image: docs-jdk
+# If not already set, set the JVM specific targets to built the test 
image
+JVM_TEST_IMAGE_TARGETS ?= test-image-hotspot-jtreg-native 
test-image-hotspot-gtest

+
 # This target builds the test image
-test-image: 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
+test-image: prepare-test-image \
+    test-image-jdk-jtreg-native test-image-failure-handler \
+    test-image-demos-jdk $(JVM_TEST_IMAGE_TARGETS)
+
+
 # all-images builds all our deliverables as images.
 all-images: product-images test-image docs-image
@@ -1146,7 +1164,10 @@
     $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
 

+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, Main-post.gmk))
 .PHONY: $(ALL_TARGETS)
 FRC: # Force target
+




Proposal: make/Main.gmk Add extra extension/override points to the make file

2018-02-14 Thread Steve Groeger
Hi Erik, 

Sorry these updates have take a while to make but here is there latest diff for 
my proposed changes to make/Main.gmk to allow extension/override points in 
that make file to enable someone to provide an alternate JVM.

Please could you take another look at these and let me know if they are OK. 
If so, would you be able to get these proposed and committed.

diff -r b2f2bdba0472 make/Main.gmk
--- a/make/Main.gmk Fri Jan 26 11:27:53 2018 -0800
+++ b/make/Main.gmk Wed Feb 14 14:37:15 2018 +
@@ -56,6 +56,9 @@
 # All modules for the current target platform.
 ALL_MODULES := $(call FindAllModules)
 
+# If not already set, set the JVM variant target so that the JVM will be built.
+JVM_VARIANT_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_VARIANT_TARGETS)
 
   $(LAUNCHER_TARGETS): java.base-libs
 
@@ -722,8 +725,11 @@
 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 target so that the JVM will be built.
+  JVM_MAIN_TARGETS ?= hotspot
+   
+  # Building java.base-jmod requires all of VM (ie hotspot) to be built.
+  java.base-jmod: $(JVM_MAIN_TARGETS) 
 
   # Declare dependencies from -jmod to all other module targets
   # When creating a BUILDJDK, the java compilation has already been done by the
@@ -749,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.
@@ -824,9 +830,11 @@
   docs-javase-api-modulegraph: exploded-image buildtools-modules
 
   docs-reference-api-modulegraph: exploded-image buildtools-modules
-
+  # If not already set, then set the JVM specific docs targets
+  JVM_DOCS_TARGETS ?= hotspot-$(JVM_VARIANT_MAIN)-gensrc
+  
   # The gensrc steps for hotspot and jdk.jdi create html spec files.
-  docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc \
+  docs-jdk-specs: $(JVM_DOCS_TARGETS) jdk.jdi-gensrc \
   docs-jdk-index
 
   docs-jdk-index: exploded-image buildtools-modules
@@ -893,8 +901,10 @@
 

 # Virtual targets without recipes
 
+# If not already set, set the JVM specific tools targets
+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
 
@@ -936,8 +946,11 @@
 $(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
 $(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy))
 
+# If not already set, set the JVM specific build targets
+JVM_BUILD_TARGETS ?= hotspot
+
 # Building java.base includes building all of hotspot.
-java.base: hotspot
+java.base: $(JVM_BUILD_TARGETS)
 
 demos: demos-jdk
 
@@ -1004,10 +1017,15 @@
 # This target builds the documentation image
 docs-image: docs-jdk
 
+# If not already set, set the JVM specific targets to built the test image
+JVM_TEST_IMAGE_TARGETS ?= test-image-hotspot-jtreg-native 
test-image-hotspot-gtest
+
 # This target builds the test image
-test-image: 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
+test-image: prepare-test-image \
+test-image-jdk-jtreg-native test-image-failure-handler \
+test-image-demos-jdk $(JVM_TEST_IMAGE_TARGETS)
+
+
 
 # all-images builds all our deliverables as images.
 all-images: product-images test-image docs-image
@@ -1146,7 +1164,10 @@
  $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
 
 

+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, Main-post.gmk))
 
 .PHONY: $(ALL_TARGETS)
 
 FRC: # Force target
+ 

 
Thanks
Steve Groeger
Java Runtimes Development
IBM Hursley
IBM United Kingdom Ltd
Tel: (44) 1962 816911 Mobex: 279990 Mobile: 07718 517 129
Fax (44) 1962 816800
Lo

Re: Proposal: make/Main.gmk Add extra extension/override points to the make file

2017-12-14 Thread Steve Groeger
Erik, 
 
Thank you very much for you very constructive comments.  
We do have our own JVM (OpenJ9) which does replace hotspot and which these 
proposed changes are attempting to implement with as minimal changes needed 
within the OpenJDK code as possible.
 
I will attempt to implement some of your suggestions within our current 
extension make file and pottentially use the post extension file. 
Once I have done that I will see if there are still changes needed in the 
make/Main.gmk and will post them to you and the mailing list for further review.
 
I have made a few comments below. 
 
Thanks
Steve Groeger
Java Runtimes Development
IBM Hursley
IBM United Kingdom Ltd
Tel: (44) 1962 816911 Mobex: 279990 Mobile: 07718 517 129
Fax (44) 1962 816800
Lotus Notes: Steve Groeger/UK/IBM
Internet: groe...@uk.ibm.com
 
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU


-Erik Joelsson  wrote: -
To: Steve Groeger , build-dev@openjdk.java.net
From: Erik Joelsson 
Date: 12/14/2017 10:59
Subject: Re: Proposal: make/Main.gmk Add extra extension/override points to the 
make file

Hello Steve,

It's certainly an interesting test of the existing extension points when 
someone else needs to use them. The use case of replacing hotspot 
completely is definitely new to me.

First of all, Main.gmk only contains one call to IncludeCustomExtension 
close to the beginning of the file. We have a pattern of adding a second 
at the bottom for some other files so if you feel that would make things 
simpler, feel free to do so. In this case it would be added right before 
the .PHONY declaration and look like this: "$(eval $(call 
IncludeCustomExtension, Main-post.gmk))".

In some of the cases you seem to simply want to add one or more extra 
targets to a list. That kind of extension can often simply be done by 
adding the rule declaration in your custom extension file. In some cases 
it needs to be set in a -post file.

In other cases it seems to be about replacing hotspot completely with 
another jvm. That could be made more explicit with conditionals that 
completely turn off building of hotspot. Not sure which I like best. 
Depends a bit on your actual requirements on some of the things below. 
 From what I can tell, we should be able to collect the relevant parts 
in a handful of JVM_* variables that we can put at the top with one 
comment explaining the need for the overrides. If this is indeed about 
replacing hotspot, that comment needs to make that clear.

See comments below.


On 2017-12-14 10:53, Steve Groeger wrote:
> Hi,
>   
> I would like to propose the changes below to allow the make/Main.gmk file to 
> be more extensible.
> These changes will allow an extension make file to be able to extend or 
> override certain variable and
> targets.
>   
> I would appreciate any feedback. I would also like to find out how I go about 
> opbtaining a sponson
> contributor for this change.
>   
> 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 +
> @@ -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
> +
I assume this is about replacing hotspot. I would prefer the variable to 
be named JVM_MAIN_LIBS_TARGET as it's for the main variant only.

  This is OK. Happy to rename the variable. I was expecting requests to change 
the variable names.

>   
> 
>   
> #
>
> @@ -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)
> +
Assuming this is about replacing hotspot. Perhaps rename the variable 
"JVM_MAIN_TARGET" or something similar as it could be reused below. If 
you need to add addition

Re: Proposal: make/Main.gmk Add extra extension/override points to the make file

2017-12-14 Thread Erik Joelsson

Hello Steve,

It's certainly an interesting test of the existing extension points when 
someone else needs to use them. The use case of replacing hotspot 
completely is definitely new to me.


First of all, Main.gmk only contains one call to IncludeCustomExtension 
close to the beginning of the file. We have a pattern of adding a second 
at the bottom for some other files so if you feel that would make things 
simpler, feel free to do so. In this case it would be added right before 
the .PHONY declaration and look like this: "$(eval $(call 
IncludeCustomExtension, Main-post.gmk))".


In some of the cases you seem to simply want to add one or more extra 
targets to a list. That kind of extension can often simply be done by 
adding the rule declaration in your custom extension file. In some cases 
it needs to be set in a -post file.


In other cases it seems to be about replacing hotspot completely with 
another jvm. That could be made more explicit with conditionals that 
completely turn off building of hotspot. Not sure which I like best. 
Depends a bit on your actual requirements on some of the things below. 
From what I can tell, we should be able to collect the relevant parts 
in a handful of JVM_* variables that we can put at the top with one 
comment explaining the need for the overrides. If this is indeed about 
replacing hotspot, that comment needs to make that clear.


See comments below.


On 2017-12-14 10:53, Steve Groeger wrote:

Hi,
  
I would like to propose the changes below to allow the make/Main.gmk file to be more extensible.

These changes will allow an extension make file to be able to extend or 
override certain variable and
targets.
  
I would appreciate any feedback. I would also like to find out how I go about opbtaining a sponson

contributor for this change.
  
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 +
@@ -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
+
I assume this is about replacing hotspot. I would prefer the variable to 
be named JVM_MAIN_LIBS_TARGET as it's for the main variant only.

  

  
#

@@ -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)
+
Assuming this is about replacing hotspot. Perhaps rename the variable 
"JVM_MAIN_TARGET" or something similar as it could be reused below. If 
you need to add additional prereqs to java.base-jmod, you can easily do 
so in your custom extension file.


# Declare dependencies from -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
Unless you actually use the CREAET_BUILDJDK feature (typically for cross 
compiling), you could simply add your extra prereqs in a Main-post.gmk 
file like this:


$(JMOD_TARGETS) $(INTERIM_JMOD_TARGETS): 

If you actually do need it, then the above would be necessary and I'm ok 
with that.


  


# 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
  
This looks like you simply need to add extra prereqs to 
exploded-image-optimize. Since that's a phony target, you can just 
declare it in your own file:


exploded-image-optimize: $(JVM_IMAGE_TARGETS)

Proposal: make/Main.gmk Add extra extension/override points to the make file

2017-12-14 Thread Steve Groeger
Hi, 
 
I would like to propose the changes below to allow the make/Main.gmk file to be 
more extensible.
These changes will allow an extension make file to be able to extend or 
override certain variable and
targets. 
 
I would appreciate any feedback. I would also like to find out how I go about 
opbtaining a sponson
contributor for this change.
 
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 +
@@ -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 -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

Thanks
Steve Groeger
Java Runtimes Development
IBM Hursley
IBM United Kingdom Ltd
Tel: (44) 1962 816911 Mobex: 279990 Mobile: 07718 517 129
Fax (44) 1962 816800
Lotus Notes: Steve Groeger/UK/IBM
Internet: groe...@uk.ibm.com
 
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
Unless st