make/Main.gmk
changeset 45772 43bf6f30fcba
parent 45229 88a3fab6006f
child 45271 81a039ba9344
equal deleted inserted replaced
45771:e447c20c3ff9 45772:43bf6f30fcba
     1 #
     1 #
     2 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
     2 # Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     5 # This code is free software; you can redistribute it and/or modify it
     6 # under the terms of the GNU General Public License version 2 only, as
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.  Oracle designates this
     7 # published by the Free Software Foundation.  Oracle designates this
    41 include $(SRC_ROOT)/make/MainSupport.gmk
    41 include $(SRC_ROOT)/make/MainSupport.gmk
    42 
    42 
    43 # Load the vital tools for all the makefiles.
    43 # Load the vital tools for all the makefiles.
    44 include $(SRC_ROOT)/make/common/MakeBase.gmk
    44 include $(SRC_ROOT)/make/common/MakeBase.gmk
    45 include $(SRC_ROOT)/make/common/Modules.gmk
    45 include $(SRC_ROOT)/make/common/Modules.gmk
       
    46 include $(SRC_ROOT)/make/common/FindTests.gmk
    46 
    47 
    47 # Declare ALL_TARGETS as an immediate variable. This variable is a list of all
    48 # Declare ALL_TARGETS as an immediate variable. This variable is a list of all
    48 # valid top level targets. It's used to declare them all as PHONY and to
    49 # valid top level targets. It's used to declare them all as PHONY and to
    49 # generate the -only targets.
    50 # generate the -only targets.
    50 ALL_TARGETS :=
    51 ALL_TARGETS :=
   269 
   270 
   270 ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \
   271 ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \
   271     $(HOTSPOT_VARIANT_LIBS_TARGETS) hotspot-jsig hotspot-ide-project
   272     $(HOTSPOT_VARIANT_LIBS_TARGETS) hotspot-jsig hotspot-ide-project
   272 
   273 
   273 ################################################################################
   274 ################################################################################
   274 # Build demos and samples targets
   275 # Build demos targets
   275 
   276 
   276 demos-jdk:
   277 demos-jdk:
   277 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
   278 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
   278 
   279 
   279 samples-jdk:
   280 test-image-demos-jdk:
   280 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
   281 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk images)
   281 
   282 
   282 ALL_TARGETS += demos-jdk samples-jdk
   283 ALL_TARGETS += demos-jdk test-image-demos-jdk
   283 
   284 
   284 ################################################################################
   285 ################################################################################
   285 # Jigsaw specific data and analysis targets.
   286 # Jigsaw specific data and analysis targets.
   286 
   287 
   287 generate-summary:
   288 generate-summary:
   360     release-file exploded-image-optimize
   361     release-file exploded-image-optimize
   361 
   362 
   362 ################################################################################
   363 ################################################################################
   363 # Docs targets
   364 # Docs targets
   364 
   365 
   365 docs-javadoc:
   366 # If building full docs, to complete docs-*-api we need both the javadoc and
   366 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-javadoc)
   367 # modulegraph targets.
   367 
   368 docs-jdk-api-javadoc:
   368 docs-copy:
   369 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-api-javadoc)
   369 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-copy)
   370 
       
   371 docs-jdk-api-modulegraph:
       
   372 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-api-modulegraph)
       
   373 
       
   374 docs-javase-api-javadoc:
       
   375 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-javase-api-javadoc)
       
   376 
       
   377 docs-javase-api-modulegraph:
       
   378 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-javase-api-modulegraph)
       
   379 
       
   380 docs-jdk-specs:
       
   381 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-specs)
       
   382 
       
   383 docs-jdk-index:
       
   384 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-index)
   370 
   385 
   371 docs-zip:
   386 docs-zip:
   372 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-zip)
   387 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-zip)
   373 
   388 
   374 ALL_TARGETS += docs-javadoc docs-copy docs-zip
   389 update-build-docs:
       
   390 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f UpdateBuildDocs.gmk)
       
   391 
       
   392 ALL_TARGETS += docs-jdk-api-javadoc docs-jdk-api-modulegraph \
       
   393     docs-javase-api-javadoc docs-javase-api-modulegraph docs-jdk-specs \
       
   394     docs-jdk-index docs-zip update-build-docs
   375 
   395 
   376 ################################################################################
   396 ################################################################################
   377 # Cross compilation support
   397 # Cross compilation support
   378 
   398 
   379 ifeq ($(CREATING_BUILDJDK), true)
   399 ifeq ($(CREATING_BUILDJDK), true)
   421 endif
   441 endif
   422 
   442 
   423 ALL_TARGETS += $(INTERIM_JMOD_TARGETS) interim-image generate-link-opt-data
   443 ALL_TARGETS += $(INTERIM_JMOD_TARGETS) interim-image generate-link-opt-data
   424 
   444 
   425 ################################################################################
   445 ################################################################################
       
   446 # Generate test names for all JTReg test groups
       
   447 #
       
   448 
       
   449 define DeclareRunTestRecipe
       
   450   run-test-$1:
       
   451 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test TEST="$1")
       
   452 
       
   453 endef
       
   454 
       
   455 # ALL_NAMED_TESTS is defined in FindTests.gmk
       
   456 $(foreach t, $(ALL_NAMED_TESTS), $(eval $(call DeclareRunTestRecipe,$t)))
       
   457 ALL_TEST_TARGETS := $(addprefix run-test-, $(ALL_NAMED_TESTS))
       
   458 
       
   459 ALL_TARGETS += $(ALL_TEST_TARGETS)
       
   460 
       
   461 ################################################################################
   426 # Build tests
   462 # Build tests
   427 #
   463 #
   428 
   464 
   429 prepare-test-image:
   465 prepare-test-image:
   430 	$(MKDIR) -p $(TEST_IMAGE_DIR)
   466 	$(MKDIR) -p $(TEST_IMAGE_DIR)
   443 	    build-test-jdk-jtreg-native)
   479 	    build-test-jdk-jtreg-native)
   444 
   480 
   445 test-image-jdk-jtreg-native:
   481 test-image-jdk-jtreg-native:
   446 	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
   482 	+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
   447 	    test-image-jdk-jtreg-native)
   483 	    test-image-jdk-jtreg-native)
       
   484 
       
   485 run-test:
       
   486 	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test TEST="$(TEST)")
   448 
   487 
   449 ifeq ($(BUILD_GTEST), true)
   488 ifeq ($(BUILD_GTEST), true)
   450   test-image-hotspot-gtest:
   489   test-image-hotspot-gtest:
   451 	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f GtestImage.gmk)
   490 	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f GtestImage.gmk)
   452 endif
   491 endif
   472 endif
   511 endif
   473 
   512 
   474 ALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
   513 ALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
   475     test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
   514     test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
   476     test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \
   515     test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \
   477     test-failure-handler test-image-failure-handler test-image-hotspot-gtest
   516     test-failure-handler test-image-failure-handler test-image-hotspot-gtest \
       
   517     run-test
   478 
   518 
   479 ################################################################################
   519 ################################################################################
   480 # Run tests
   520 # Run tests
   481 
   521 
   482 # Run tests specified by $(TEST), or the default test set.
   522 # Run tests specified by $(TEST), or the default test set.
   595 
   635 
   596   # The demos are currently linking to libjvm and libjava, just like all other
   636   # The demos are currently linking to libjvm and libjava, just like all other
   597   # jdk libs, even though they don't need to. To avoid warnings, make sure they
   637   # jdk libs, even though they don't need to. To avoid warnings, make sure they
   598   # aren't built until after libjava and libjvm are available to link to.
   638   # aren't built until after libjava and libjvm are available to link to.
   599   demos-jdk: java.base-libs exploded-image-optimize
   639   demos-jdk: java.base-libs exploded-image-optimize
       
   640   test-image-demos-jdk: demos-jdk
   600 
   641 
   601   # Declare dependency from <module>-java to <module>-gensrc
   642   # Declare dependency from <module>-java to <module>-gensrc
   602   $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
   643   $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
   603 
   644 
   604   # Declare dependencies between java modules
   645   # Declare dependencies between java modules
   631 
   672 
   632   # The swing beans need to have java base properly generated to avoid errors
   673   # The swing beans need to have java base properly generated to avoid errors
   633   # in javadoc.
   674   # in javadoc.
   634   java.desktop-gensrc-jdk: java.base-gensrc
   675   java.desktop-gensrc-jdk: java.base-gensrc
   635 
   676 
   636   # The annotation processing for jdk.vm.ci and jdk.vm.compiler needs classes
   677   # The annotation processing for jdk.internal.vm.ci and jdk.internal.vm.compiler
   637   # from the current JDK.
   678   # needs classes from the current JDK.
   638   jdk.vm.ci-gensrc-hotspot: $(addsuffix -java, \
   679   jdk.internal.vm.ci-gensrc-hotspot: $(addsuffix -java, \
   639       $(call FindTransitiveDepsForModule, jdk.vm.ci))
   680       $(call FindTransitiveDepsForModule, jdk.internal.vm.ci))
   640   jdk.vm.compiler-gensrc-hotspot: $(addsuffix -java, \
   681   jdk.internal.vm.compiler-gensrc-hotspot: $(addsuffix -java, \
   641       $(call FindTransitiveDepsForModule, jdk.vm.compiler))
   682       $(call FindTransitiveDepsForModule, jdk.internal.vm.compiler))
   642 
   683 
   643   # For jdk.vm.compiler, the gensrc step is generating a module-info.java.extra
   684   # For jdk.internal.vm.compiler, the gensrc step is generating a module-info.java.extra
   644   # file to be processed by the gensrc-moduleinfo target.
   685   # file to be processed by the gensrc-moduleinfo target.
   645   jdk.vm.compiler-gensrc-moduleinfo: jdk.vm.compiler-gensrc-hotspot
   686   jdk.internal.vm.compiler-gensrc-moduleinfo: jdk.internal.vm.compiler-gensrc-hotspot
   646 
   687 
   647   # Explicitly add dependencies for special targets
   688   # Explicitly add dependencies for special targets
   648   java.base-java: unpack-sec
   689   java.base-java: unpack-sec
   649 
   690 
   650   jdk.jdeps-gendata: java rmic
   691   jdk.jdeps-gendata: java rmic
   652   # Declare dependencies between jmod targets.
   693   # Declare dependencies between jmod targets.
   653   # java.base jmod needs jrt-fs.jar and access to the other jmods to be built.
   694   # java.base jmod needs jrt-fs.jar and access to the other jmods to be built.
   654   # When creating a BUILDJDK, we don't need to add hashes to java.base, thus
   695   # When creating a BUILDJDK, we don't need to add hashes to java.base, thus
   655   # we don't need to depend on all other jmods
   696   # we don't need to depend on all other jmods
   656   ifneq ($(CREATING_BUILDJDK), true)
   697   ifneq ($(CREATING_BUILDJDK), true)
   657     java.base-jmod: jrtfs-jar $(filter-out java.base-jmod \
   698     java.base-jmod: jrtfs-jar $(filter-out java.base-jmod, $(JMOD_TARGETS))
   658         $(addsuffix -jmod, $(call FindAllUpgradeableModules)), $(JMOD_TARGETS))
       
   659   endif
   699   endif
   660 
   700 
   661   # Building java.base-jmod requires all of hotspot to be built.
   701   # Building java.base-jmod requires all of hotspot to be built.
   662   java.base-jmod: hotspot
   702   java.base-jmod: hotspot
   663 
   703 
   726       generate-link-opt-data: interim-image
   766       generate-link-opt-data: interim-image
   727     endif
   767     endif
   728     generate-link-opt-data: buildtools-jdk
   768     generate-link-opt-data: buildtools-jdk
   729 
   769 
   730     # The generated classlist needs to go into java.base-jmod.
   770     # The generated classlist needs to go into java.base-jmod.
   731     java.base-jmod jdk-image jre-image: generate-link-opt-data
   771     java.base-jmod jdk.jlink-jmod jdk-image jre-image: generate-link-opt-data
   732   endif
   772   endif
   733 
   773 
   734   release-file: create-source-revision-tracker
   774   release-file: create-source-revision-tracker
   735 
   775 
   736   jdk-image: jmods zip-source demos samples release-file
   776   jdk-image: jmods zip-source demos release-file
   737   jre-image: jmods release-file
   777   jre-image: jmods release-file
   738   symbols-image: $(LIBS_TARGETS) $(LAUNCHER_TARGETS)
   778   symbols-image: $(LIBS_TARGETS) $(LAUNCHER_TARGETS)
   739 
   779 
   740   profiles-image: jmods release-file
   780   profiles-image: jmods release-file
   741 
   781 
   747   exploded-image-optimize: java copy gendata java.base-libs java.base-launchers \
   787   exploded-image-optimize: java copy gendata java.base-libs java.base-launchers \
   748       buildtools-modules
   788       buildtools-modules
   749 
   789 
   750   bootcycle-images: jdk-image
   790   bootcycle-images: jdk-image
   751 
   791 
   752   docs-javadoc: $(GENSRC_TARGETS) rmic
   792   docs-jdk-api-javadoc: $(GENSRC_TARGETS) rmic
   753 
   793 
   754   # The gensrc step for jdk.jdi creates an html file that is used by docs-copy.
   794   docs-javase-api-javadoc: $(GENSRC_TARGETS) rmic
   755   docs-copy: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc
   795 
   756 
   796   docs-jdk-api-modulegraph: exploded-image buildtools-modules
   757   docs-zip: docs-javadoc docs-copy
   797 
       
   798   docs-javase-api-modulegraph: exploded-image buildtools-modules
       
   799 
       
   800   # The gensrc steps for hotspot and jdk.jdi create html spec files.
       
   801   docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc \
       
   802       docs-jdk-index
       
   803 
       
   804   docs-jdk-index: exploded-image buildtools-modules
       
   805 
       
   806   docs-zip: docs-jdk
   758 
   807 
   759   test: jdk-image test-image
   808   test: jdk-image test-image
       
   809 
       
   810   run-test: jdk-image test-image
       
   811 
       
   812   # Declare dependency for all generated test targets
       
   813   $(foreach t, $(ALL_TEST_TARGETS), $(eval $t: jdk-image test-image))
   760 
   814 
   761   create-buildjdk-copy: jdk.jlink-java java.base-gendata \
   815   create-buildjdk-copy: jdk.jlink-java java.base-gendata \
   762       $(addsuffix -java, $(INTERIM_IMAGE_MODULES))
   816       $(addsuffix -java, $(INTERIM_IMAGE_MODULES))
   763 
   817 
   764   create-buildjdk-interim-image: create-buildjdk-copy
   818   create-buildjdk-interim-image: create-buildjdk-copy
   855 # Building java.base includes building all of hotspot.
   909 # Building java.base includes building all of hotspot.
   856 java.base: hotspot
   910 java.base: hotspot
   857 
   911 
   858 demos: demos-jdk
   912 demos: demos-jdk
   859 
   913 
   860 samples: samples-jdk
       
   861 
       
   862 # The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
   914 # The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
   863 exploded-image-base: $(ALL_MODULES)
   915 exploded-image-base: $(ALL_MODULES)
   864 exploded-image: exploded-image-base release-file
   916 exploded-image: exploded-image-base release-file
   865 # When cross compiling, no need to optimize the exploded image since it won't
   917 # When cross compiling, no need to optimize the exploded image since it won't
   866 # be runnable on the host platform anyway.
   918 # be runnable on the host platform anyway.
   867 ifneq ($(COMPILE_TYPE), cross)
   919 ifneq ($(COMPILE_TYPE), cross)
   868   exploded-image: exploded-image-optimize
   920   exploded-image: exploded-image-optimize
   869 endif
   921 endif
   870 
   922 
   871 create-buildjdk: create-buildjdk-copy create-buildjdk-interim-image
   923 create-buildjdk: create-buildjdk-copy create-buildjdk-interim-image
       
   924 
       
   925 docs-jdk-api: docs-jdk-api-javadoc
       
   926 docs-javase-api: docs-javase-api-javadoc
       
   927 
       
   928 # If we're building full docs, we must also generate the module graphs to
       
   929 # get non-broken api documentation.
       
   930 ifeq ($(ENABLE_FULL_DOCS), true)
       
   931   docs-jdk-api: docs-jdk-api-modulegraph
       
   932   docs-javase-api: docs-javase-api-modulegraph
       
   933 endif
       
   934 
       
   935 docs-jdk: docs-jdk-api docs-jdk-specs docs-jdk-index
       
   936 docs-javase: docs-javase-api
       
   937 
       
   938 # alias for backwards compatibility
       
   939 docs-javadoc: docs-jdk-api
   872 
   940 
   873 mac-bundles: mac-bundles-jdk
   941 mac-bundles: mac-bundles-jdk
   874 
   942 
   875 # The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
   943 # The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
   876 # and in line with this, our targets for creating these are named *-image[s].
   944 # and in line with this, our targets for creating these are named *-image[s].
   899 ifeq ($(OPENJDK_TARGET_OS), macosx)
   967 ifeq ($(OPENJDK_TARGET_OS), macosx)
   900   product-images: mac-bundles
   968   product-images: mac-bundles
   901 endif
   969 endif
   902 
   970 
   903 # This target builds the documentation image
   971 # This target builds the documentation image
   904 docs-image: docs-javadoc docs-copy
   972 docs-image: docs-jdk
   905 
   973 
   906 # This target builds the test image
   974 # This target builds the test image
   907 test-image: prepare-test-image test-image-hotspot-jtreg-native \
   975 test-image: prepare-test-image test-image-hotspot-jtreg-native \
   908     test-image-jdk-jtreg-native test-image-failure-handler test-image-hotspot-gtest
   976     test-image-jdk-jtreg-native test-image-failure-handler test-image-hotspot-gtest \
       
   977     test-image-demos-jdk
   909 
   978 
   910 # all-images builds all our deliverables as images.
   979 # all-images builds all our deliverables as images.
   911 all-images: product-images test-image docs-image
   980 all-images: product-images test-image docs-image
   912 
   981 
   913 # all-bundles packages all our deliverables as tar.gz bundles.
   982 # all-bundles packages all our deliverables as tar.gz bundles.
   914 all-bundles: product-bundles test-bundles docs-bundles
   983 all-bundles: product-bundles test-bundles docs-bundles
   915 
   984 
   916 ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-gensrc gensrc gendata \
   985 ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-gensrc gensrc gendata \
   917     copy java rmic libs launchers jmods \
   986     copy java rmic libs launchers jmods \
   918     jdk.jdwp.agent-gensrc $(ALL_MODULES) demos samples \
   987     jdk.jdwp.agent-gensrc $(ALL_MODULES) demos \
   919     exploded-image-base exploded-image \
   988     exploded-image-base exploded-image \
   920     create-buildjdk mac-bundles product-images \
   989     create-buildjdk docs-jdk-api docs-javase-api docs-jdk docs-javase \
       
   990     docs-javadoc mac-bundles product-images \
   921     profiles profiles-images \
   991     profiles profiles-images \
   922     docs-image test-image all-images \
   992     docs-image test-image all-images \
   923     all-bundles
   993     all-bundles
   924 
   994 
   925 ################################################################################
   995 ################################################################################
  1030 	  @$(ECHO) $(sort $(ALL_TARGETS))
  1100 	  @$(ECHO) $(sort $(ALL_TARGETS))
  1031 
  1101 
  1032 print-modules:
  1102 print-modules:
  1033 	  @$(ECHO) $(sort $(ALL_MODULES))
  1103 	  @$(ECHO) $(sort $(ALL_MODULES))
  1034 
  1104 
       
  1105 print-tests:
       
  1106 	  @$(ECHO) $(sort $(ALL_NAMED_TESTS))
       
  1107 
  1035 create-main-targets-include:
  1108 create-main-targets-include:
  1036 	  $(call LogInfo, Generating main target list)
  1109 	  $(call LogInfo, Generating main target list)
  1037 	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
  1110 	  @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
  1038 	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
  1111 	      $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
  1039 
  1112