450 #
451
452 ALL_SRC_DIRS = \
453 $(GENERATED_SRC_DIRS) \
454 $(OS_SRC_DIRS) \
455 $(OS_TYPE_SRC_DIRS) \
456 $(SHARE_SRC_DIRS) \
457 #
458
459 # Find all modules with java sources. Filter out nashorn since it needs to be
460 # compiled separately.
461 ALL_JAVA_MODULES := $(filter-out jdk.scripting.nashorn, $(call FindJavaModules))
462 JAVA_MODULES := $(ALL_JAVA_MODULES)
463
464 # The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
465 # JDK_FILTER at the make command line, only a subset of the JDK java files will
466 # be recompiled. If multiple paths are separated by comma, convert that into a
467 # space separated list.
468 JDK_USER_DEFINED_FILTER := $(strip $(subst $(COMMA),$(SPACE), $(JDK_FILTER)))
469
470 # This macro sets up compilation of a module and declares dependencies for it.
471 # Param 1 - module name
472 define SetupModuleCompilation
473 # Find the module dependencies by parsing modules.list file
474 $1_DEPS := $$(call FindDepsForModule, $1)
475
476 $1_CLASSPATH := $$(addprefix $(JDK_OUTPUTDIR)/modules/,$$($1_DEPS))
477 # When crypto classes are prebuilt, need to look for classes already in
478 # output dir.
479 ifneq ($(BUILD_CRYPTO), true)
480 $1_CLASSPATH += $(JDK_OUTPUTDIR)/modules/$1
481 endif
482 ifeq ($1, jdk.hotspot.agent)
483 ## The source of this module is compiled elsewhere, hotspot, and imported.
484 ## Service types are required in the classpath when compiing module-info
485 $1_CLASSPATH := $$($1_CLASSPATH) $$(addprefix $(JDK_OUTPUTDIR)/modules/,jdk.hotspot.agent)
486 endif
487 $1_CLASSPATH := $$(subst $$(SPACE),$$(PATH_SEP),$$($1_CLASSPATH))
488 $1_JAVAC_FLAGS := -bootclasspath "$$($1_CLASSPATH)"
489
490 $$(eval $$(call SetupJavaCompilation,$1, \
491 SETUP := $$(if $$($1_SETUP), $$($1_SETUP), GENERATE_JDKBYTECODE), \
492 SRC := $$(wildcard $$(call ALL_SRC_DIRS,$1)), \
493 INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
494 BIN := $(JDK_OUTPUTDIR)/modules/$1, \
495 HEADERS := $(SUPPORT_OUTPUTDIR)/headers/$1, \
496 ADD_JAVAC_FLAGS := $$($1_JAVAC_FLAGS)))
497
498 $1: $$($1) $$($1_COPY_EXTRA)
499
500 # Declare dependencies between java compilation of different modules.
501 # Since not all modules have been declared yet, or might be declared
502 # in different invocations of this file, use the macro to find the
503 # correct target file to depend on.
504 # Only the javac compilation actually depends on other modules so limit
505 # dependency declaration to that by using the *_COMPILE_TARGET variable.
506 $$($1_COMPILE_TARGETS): $$(foreach d,$$($1_DEPS), \
507 $$(call SetupJavaCompilationCompileTarget, $$d, $(JDK_OUTPUTDIR)/modules/$$d))
508 endef
|
450 #
451
452 ALL_SRC_DIRS = \
453 $(GENERATED_SRC_DIRS) \
454 $(OS_SRC_DIRS) \
455 $(OS_TYPE_SRC_DIRS) \
456 $(SHARE_SRC_DIRS) \
457 #
458
459 # Find all modules with java sources. Filter out nashorn since it needs to be
460 # compiled separately.
461 ALL_JAVA_MODULES := $(filter-out jdk.scripting.nashorn, $(call FindJavaModules))
462 JAVA_MODULES := $(ALL_JAVA_MODULES)
463
464 # The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
465 # JDK_FILTER at the make command line, only a subset of the JDK java files will
466 # be recompiled. If multiple paths are separated by comma, convert that into a
467 # space separated list.
468 JDK_USER_DEFINED_FILTER := $(strip $(subst $(COMMA),$(SPACE), $(JDK_FILTER)))
469
470 # Create an empty directory to set the bootclasspath to.
471 EMPTY_BOOTCLASSPATH := $(SUPPORT_OUTPUTDIR)/empty-dir
472 $(call MakeDir, $(EMPTY_BOOTCLASSPATH))
473
474 # This macro sets up compilation of a module and declares dependencies for it.
475 # Param 1 - module name
476 define SetupModuleCompilation
477 # Find the module dependencies by parsing modules.list file
478 ifeq ($(ENABLE_SJAVAC), yes)
479 # Due to an issue with sjavac, need to include transitive dependencies in
480 # the classpath.
481 $1_DEPS := $$(call FindTransitiveDepsForModule, $1)
482 else
483 $1_DEPS := $$(call FindDepsForModule, $1)
484 endif
485
486 $1_CLASSPATH := $$(addprefix $(JDK_OUTPUTDIR)/modules/,$$($1_DEPS))
487 # When crypto classes are prebuilt, need to look for classes already in
488 # output dir.
489 ifneq ($(BUILD_CRYPTO), true)
490 $1_CLASSPATH += $(JDK_OUTPUTDIR)/modules/$1
491 endif
492 ifeq ($1, jdk.hotspot.agent)
493 ## The source of this module is compiled elsewhere, hotspot, and imported.
494 ## Service types are required in the classpath when compiing module-info
495 $1_CLASSPATH := $$($1_CLASSPATH) $$(addprefix $(JDK_OUTPUTDIR)/modules/,jdk.hotspot.agent)
496 endif
497 $1_CLASSPATH := $$(subst $$(SPACE),$$(PATH_SEP),$$($1_CLASSPATH))
498 $1_JAVAC_FLAGS := -bootclasspath $(EMPTY_BOOTCLASSPATH) -classpath "$$($1_CLASSPATH)"
499
500 $$(eval $$(call SetupJavaCompilation,$1, \
501 SETUP := $$(if $$($1_SETUP), $$($1_SETUP), GENERATE_JDKBYTECODE), \
502 SRC := $$(wildcard $$(call ALL_SRC_DIRS,$1)), \
503 INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
504 BIN := $(JDK_OUTPUTDIR)/modules/$1, \
505 HEADERS := $(SUPPORT_OUTPUTDIR)/headers/$1, \
506 ADD_JAVAC_FLAGS := $$($1_JAVAC_FLAGS)))
507
508 $1: $$($1) $$($1_COPY_EXTRA)
509
510 # Declare dependencies between java compilation of different modules.
511 # Since not all modules have been declared yet, or might be declared
512 # in different invocations of this file, use the macro to find the
513 # correct target file to depend on.
514 # Only the javac compilation actually depends on other modules so limit
515 # dependency declaration to that by using the *_COMPILE_TARGET variable.
516 $$($1_COMPILE_TARGETS): $$(foreach d,$$($1_DEPS), \
517 $$(call SetupJavaCompilationCompileTarget, $$d, $(JDK_OUTPUTDIR)/modules/$$d))
518 endef
|