< prev index next >

make/CompileJavaModules.gmk

Print this page

 14 # version 2 for more details (a copy is included in the LICENSE file that
 15 # accompanied this code).
 16 #
 17 # You should have received a copy of the GNU General Public License version
 18 # 2 along with this work; if not, write to the Free Software Foundation,
 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20 #
 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22 # or visit www.oracle.com if you need additional information or have any
 23 # questions.
 24 #
 25 
 26 # This must be the first rule
 27 default: all
 28 
 29 include $(SPEC)
 30 include MakeBase.gmk
 31 include Modules.gmk
 32 include JavaCompilation.gmk
 33 


 34 ################################################################################
 35 # If this is an imported module that has prebuilt classes, only compile
 36 # module-info.java.
 37 ifneq ($(IMPORT_MODULES_CLASSES), )
 38   IMPORT_MODULE_DIR := $(IMPORT_MODULES_CLASSES)/$(MODULE)
 39   ifneq ($(wildcard $(IMPORT_MODULE_DIR)), )
 40     $(MODULE)_INCLUDE_FILES := module-info.java
 41   endif
 42 else
 43   IMPORT_MODULE_DIR :=
 44 endif
 45 
 46 ################################################################################
 47 # Setup the compilation for the module
 48 #
 49 MODULE_SRC_DIRS := $(call FindModuleSrcDirs, $(MODULE))
 50 
 51 # The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
 52 # JDK_FILTER at the make command line, only a subset of the JDK java files will
 53 # be recompiled. If multiple paths are separated by comma, convert that into a

 73 $(JDK_OUTPUTDIR)/modules/%_zh_HK.properties: $(JDK_OUTPUTDIR)/modules/%_zh_TW.properties
 74 	$(install-file)
 75 
 76 CreateHkTargets = \
 77     $(call FilterExcludedTranslations, \
 78         $(patsubst $(TOPDIR)/src/%, $(JDK_OUTPUTDIR)/modules/%, \
 79             $(subst /share/classes,, \
 80                 $(subst _zh_TW,_zh_HK, $(filter %_zh_TW.properties, $1)) \
 81             ) \
 82         ), \
 83         .properties \
 84     )
 85 
 86 ################################################################################
 87 # Include module specific build settings
 88 
 89 -include Java.gmk
 90 
 91 ################################################################################
 92 # Setup the main compilation
 93 
 94 $(eval $(call SetupJavaCompilation, $(MODULE), \
 95     SMALL_JAVA := false, \
 96     MODULE := $(MODULE), \
 97     SRC := $(wildcard $(MODULE_SRC_DIRS)), \
 98     INCLUDES := $(JDK_USER_DEFINED_FILTER), \
 99     FAIL_NO_SRC := $(FAIL_NO_SRC), \
100     BIN := $(if $($(MODULE)_BIN), $($(MODULE)_BIN), $(JDK_OUTPUTDIR)/modules), \
101     HEADERS := $(SUPPORT_OUTPUTDIR)/headers, \
102     CREATE_API_DIGEST := true, \
103     CLEAN := $(CLEAN), \
104     CLEAN_FILES := $(CLEAN_FILES), \
105     COPY := $(COPY), \
106     DISABLED_WARNINGS := $(DISABLED_WARNINGS_java), \
107     EXCLUDES := $(EXCLUDES), \
108     EXCLUDE_FILES := $(EXCLUDE_FILES), \
109     KEEP_ALL_TRANSLATIONS := $(KEEP_ALL_TRANSLATIONS), \
110     JAVAC_FLAGS := \
111         $(DOCLINT) \
112         $(JAVAC_FLAGS) \
113         --module-source-path $(MODULESOURCEPATH) \
114         --module-path $(MODULEPATH) \
115         --system none, \
116 ))
117 
118 TARGETS += $($(MODULE))
119 













































120 # Declare dependencies between java compilations of different modules.
121 # Since the other modules are declared in different invocations of this file,
122 # use the macro to find the correct target file to depend on.
123 # Only the javac compilation actually depends on other modules so limit
124 # dependency declaration to that by using the *_MODFILELIST variable.
125 $($(MODULE)_MODFILELIST): $(foreach d, $(call FindDepsForModule, $(MODULE)), \
126     $(call SetupJavaCompilationApiTarget, $d, \
127         $(if $($d_BIN), $($d_BIN), $(JDK_OUTPUTDIR)/modules/$d)))
128 
129 ################################################################################
130 # If this is an imported module, copy the pre built classes and resources into
131 # the modules output dir
132 
133 ifneq ($(wildcard $(IMPORT_MODULE_DIR)), )
134   $(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker: \
135       $(call FindFiles, $(IMPORT_MODULE_DIR))
136 	$(call MakeDir, $(@D))
137         # Do not delete marker and build meta data files
138 	$(RM) -r $(filter-out $(@D)/_%, $(wildcard $(@D)/*))
139 	$(CP) -R $(IMPORT_MODULE_DIR)/* $(@D)/

 14 # version 2 for more details (a copy is included in the LICENSE file that
 15 # accompanied this code).
 16 #
 17 # You should have received a copy of the GNU General Public License version
 18 # 2 along with this work; if not, write to the Free Software Foundation,
 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20 #
 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22 # or visit www.oracle.com if you need additional information or have any
 23 # questions.
 24 #
 25 
 26 # This must be the first rule
 27 default: all
 28 
 29 include $(SPEC)
 30 include MakeBase.gmk
 31 include Modules.gmk
 32 include JavaCompilation.gmk
 33 
 34 include CopyFiles.gmk
 35 
 36 ################################################################################
 37 # If this is an imported module that has prebuilt classes, only compile
 38 # module-info.java.
 39 ifneq ($(IMPORT_MODULES_CLASSES), )
 40   IMPORT_MODULE_DIR := $(IMPORT_MODULES_CLASSES)/$(MODULE)
 41   ifneq ($(wildcard $(IMPORT_MODULE_DIR)), )
 42     $(MODULE)_INCLUDE_FILES := module-info.java
 43   endif
 44 else
 45   IMPORT_MODULE_DIR :=
 46 endif
 47 
 48 ################################################################################
 49 # Setup the compilation for the module
 50 #
 51 MODULE_SRC_DIRS := $(call FindModuleSrcDirs, $(MODULE))
 52 
 53 # The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
 54 # JDK_FILTER at the make command line, only a subset of the JDK java files will
 55 # be recompiled. If multiple paths are separated by comma, convert that into a

 75 $(JDK_OUTPUTDIR)/modules/%_zh_HK.properties: $(JDK_OUTPUTDIR)/modules/%_zh_TW.properties
 76 	$(install-file)
 77 
 78 CreateHkTargets = \
 79     $(call FilterExcludedTranslations, \
 80         $(patsubst $(TOPDIR)/src/%, $(JDK_OUTPUTDIR)/modules/%, \
 81             $(subst /share/classes,, \
 82                 $(subst _zh_TW,_zh_HK, $(filter %_zh_TW.properties, $1)) \
 83             ) \
 84         ), \
 85         .properties \
 86     )
 87 
 88 ################################################################################
 89 # Include module specific build settings
 90 
 91 -include Java.gmk
 92 
 93 ################################################################################
 94 # Setup the main compilation

 95 $(eval $(call SetupJavaCompilation, $(MODULE), \
 96     SMALL_JAVA := false, \
 97     MODULE := $(MODULE), \
 98     SRC := $(wildcard $(MODULE_SRC_DIRS)), \
 99     INCLUDES := $(JDK_USER_DEFINED_FILTER), \
100     FAIL_NO_SRC := $(FAIL_NO_SRC), \
101     BIN := $(if $($(MODULE)_BIN), $($(MODULE)_BIN), $(JDK_OUTPUTDIR)/modules), \
102     HEADERS := $(SUPPORT_OUTPUTDIR)/headers, \
103     CREATE_API_DIGEST := true, \
104     CLEAN := $(CLEAN), \
105     CLEAN_FILES := $(CLEAN_FILES), \
106     COPY := $(COPY), \
107     DISABLED_WARNINGS := $(DISABLED_WARNINGS_java), \
108     EXCLUDES := $(EXCLUDES), \
109     EXCLUDE_FILES := $(EXCLUDE_FILES), \
110     KEEP_ALL_TRANSLATIONS := $(KEEP_ALL_TRANSLATIONS), \
111     JAVAC_FLAGS := \
112         $(DOCLINT) \
113         $(JAVAC_FLAGS) \
114         --module-source-path $(MODULESOURCEPATH) \
115         --module-path $(MODULEPATH) \
116         --system none, \
117 ))
118 
119 TARGETS += $($(MODULE))
120 
121 ################################################################################
122 # Setup compilation for value classes in the module
123 # TBD: When $(DOCLINT) was included there was an NPE in JavacTypes.getOverriddenMethods
124 
125 # Directory and file name suffix for jar file containing value classes
126 VALUECLASSES_STR := valueclasses
127 
128 ifneq ($(COMPILER), bootjdk)
129   MODULE_VALUECLASS_SRC_DIRS := $(call FindModuleValueClassSrcDirs, $(MODULE))
130   MODULE_VALUECLASS_SOURCEPATH := $(call GetModuleValueClassSrcPath)
131 
132   ifneq ($(MODULE_VALUECLASS_SRC_DIRS),)
133     $(eval $(call SetupJavaCompilation, $(MODULE)-$(VALUECLASSES_STR), \
134         SMALL_JAVA := false, \
135         MODULE := $(MODULE), \
136         SRC := $(wildcard $(MODULE_VALUECLASS_SRC_DIRS)), \
137         INCLUDES := $(JDK_USER_DEFINED_FILTER), \
138         FAIL_NO_SRC := $(FAIL_NO_SRC), \
139         BIN := $(SUPPORT_OUTPUTDIR)/$(VALUECLASSES_STR)/, \
140         JAR := $(JDK_OUTPUTDIR)/lib/$(VALUECLASSES_STR)/$(MODULE)-$(VALUECLASSES_STR).jar, \
141         HEADERS := $(SUPPORT_OUTPUTDIR)/headers, \
142         DISABLED_WARNINGS := $(DISABLED_WARNINGS_java) preview, \
143         EXCLUDES := $(EXCLUDES), \
144         EXCLUDE_FILES := $(EXCLUDE_FILES) \
145         KEEP_ALL_TRANSLATIONS := $(KEEP_ALL_TRANSLATIONS), \
146         DEPENDS := $($(MODULE)), \
147         JAVAC_FLAGS := \
148             $(JAVAC_FLAGS) \
149             --module-source-path $(MODULE_VALUECLASS_SOURCEPATH) \
150             --module-path $(JDK_OUTPUTDIR)/modules \
151             --system none \
152             --enable-preview -source $(JDK_SOURCE_TARGET_VERSION), \
153     ))
154 
155     TARGETS += $($(MODULE)-$(VALUECLASSES_STR))
156 
157     $(eval $(call SetupCopyFiles, $(MODULE)-copy-valueclass-jar, \
158         FILES := $(JDK_OUTPUTDIR)/lib/$(VALUECLASSES_STR)/$(MODULE)-$(VALUECLASSES_STR).jar, \
159         DEST := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/$(VALUECLASSES_STR), \
160     ))
161 
162     TARGETS += $($(MODULE)-copy-valueclass-jar)
163   endif
164 endif
165 
166 # Declare dependencies between java compilations of different modules.
167 # Since the other modules are declared in different invocations of this file,
168 # use the macro to find the correct target file to depend on.
169 # Only the javac compilation actually depends on other modules so limit
170 # dependency declaration to that by using the *_MODFILELIST variable.
171 $($(MODULE)_MODFILELIST): $(foreach d, $(call FindDepsForModule, $(MODULE)), \
172     $(call SetupJavaCompilationApiTarget, $d, \
173         $(if $($d_BIN), $($d_BIN), $(JDK_OUTPUTDIR)/modules/$d)))
174 
175 ################################################################################
176 # If this is an imported module, copy the pre built classes and resources into
177 # the modules output dir
178 
179 ifneq ($(wildcard $(IMPORT_MODULE_DIR)), )
180   $(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker: \
181       $(call FindFiles, $(IMPORT_MODULE_DIR))
182 	$(call MakeDir, $(@D))
183         # Do not delete marker and build meta data files
184 	$(RM) -r $(filter-out $(@D)/_%, $(wildcard $(@D)/*))
185 	$(CP) -R $(IMPORT_MODULE_DIR)/* $(@D)/
< prev index next >