< prev index next >

make/CompileJavaModules.gmk

Print this page




 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 := $(OUTPUT_ROOT)/tmp/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   $1_DEPS := $$(call FindDepsForModule, $1)
 479 
 480   $1_CLASSPATH := $$(addprefix $(JDK_OUTPUTDIR)/modules/,$$($1_DEPS))
 481   # When crypto classes are prebuilt, need to look for classes already in
 482   # output dir.
 483   ifneq ($(BUILD_CRYPTO), true)
 484     $1_CLASSPATH += $(JDK_OUTPUTDIR)/modules/$1
 485   endif
 486   ifeq ($1, jdk.hotspot.agent)
 487     ## The source of this module is compiled elsewhere, hotspot, and imported.
 488     ## Service types are required in the classpath when compiing module-info
 489     $1_CLASSPATH := $$($1_CLASSPATH) $$(addprefix $(JDK_OUTPUTDIR)/modules/,jdk.hotspot.agent)
 490   endif
 491   $1_CLASSPATH := $$(subst $$(SPACE),$$(PATH_SEP),$$($1_CLASSPATH))
 492   $1_JAVAC_FLAGS := -bootclasspath $(EMPTY_BOOTCLASSPATH) -classpath "$$($1_CLASSPATH)"
 493 
 494   $$(eval $$(call SetupJavaCompilation,$1, \
 495       SETUP := $$(if $$($1_SETUP), $$($1_SETUP), GENERATE_JDKBYTECODE), \
 496       SRC := $$(wildcard $$(call ALL_SRC_DIRS,$1)), \
 497       INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
 498       BIN := $(JDK_OUTPUTDIR)/modules/$1, \
 499       HEADERS := $(SUPPORT_OUTPUTDIR)/headers/$1, \
 500       ADD_JAVAC_FLAGS := $$($1_JAVAC_FLAGS)))
 501 
 502   $1: $$($1) $$($1_COPY_EXTRA)
 503 
 504   # Declare dependencies between java compilation of different modules.
 505   # Since not all modules have been declared yet, or might be declared
 506   # in different invocations of this file, use the macro to find the
 507   # correct target file to depend on.
 508   # Only the javac compilation actually depends on other modules so limit
 509   # dependency declaration to that by using the *_COMPILE_TARGET variable.
 510   $$($1_COMPILE_TARGETS): $$(foreach d,$$($1_DEPS), \
 511       $$(call SetupJavaCompilationCompileTarget, $$d, $(JDK_OUTPUTDIR)/modules/$$d))
 512 endef


< prev index next >