< prev index next >

make/CompileJavaModules.gmk

Print this page

 13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 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 include MakeFileStart.gmk
 27 
 28 ################################################################################
 29 
 30 include JavaCompilation.gmk
 31 include Modules.gmk
 32 


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

 80             ) \
 81         ), \
 82         .properties \
 83     )
 84 
 85 ################################################################################
 86 # Include module specific build settings
 87 
 88 THIS_SNIPPET := modules/$(MODULE)/Java.gmk
 89 
 90 ifneq ($(wildcard $(THIS_SNIPPET)), )
 91   include MakeSnippetStart.gmk
 92 
 93   include $(THIS_SNIPPET)
 94 
 95   include MakeSnippetEnd.gmk
 96 endif
 97 
 98 ################################################################################
 99 # Setup the main compilation
100 
101 $(eval $(call SetupJavaCompilation, $(MODULE), \
102     SMALL_JAVA := false, \
103     MODULE := $(MODULE), \
104     SRC := $(wildcard $(MODULE_SRC_DIRS)), \
105     INCLUDES := $(JDK_USER_DEFINED_FILTER), \
106     FAIL_NO_SRC := $(FAIL_NO_SRC), \
107     BIN := $(if $($(MODULE)_BIN), $($(MODULE)_BIN), $(JDK_OUTPUTDIR)/modules), \
108     HEADERS := $(SUPPORT_OUTPUTDIR)/headers, \
109     CREATE_API_DIGEST := true, \
110     CLEAN := $(CLEAN), \
111     CLEAN_FILES := $(CLEAN_FILES), \
112     COPY := $(COPY), \
113     DISABLED_WARNINGS := $(DISABLED_WARNINGS_java), \
114     EXCLUDES := $(EXCLUDES), \
115     EXCLUDE_FILES := $(EXCLUDE_FILES), \
116     KEEP_ALL_TRANSLATIONS := $(KEEP_ALL_TRANSLATIONS), \
117     JAVAC_FLAGS := \
118         $(DOCLINT) \
119         $(JAVAC_FLAGS) \
120         --module-source-path $(MODULESOURCEPATH) \
121         --module-path $(MODULEPATH) \
122         --system none, \
123 ))
124 
125 TARGETS += $($(MODULE))
126 













































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

 13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 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 include MakeFileStart.gmk
 27 
 28 ################################################################################
 29 
 30 include JavaCompilation.gmk
 31 include Modules.gmk
 32 
 33 include CopyFiles.gmk
 34 
 35 ################################################################################
 36 # If this is an imported module that has prebuilt classes, only compile
 37 # module-info.java.
 38 ifneq ($(IMPORT_MODULES_CLASSES), )
 39   IMPORT_MODULE_DIR := $(IMPORT_MODULES_CLASSES)/$(MODULE)
 40   ifneq ($(wildcard $(IMPORT_MODULE_DIR)), )
 41     $(MODULE)_INCLUDE_FILES := module-info.java
 42   endif
 43 else
 44   IMPORT_MODULE_DIR :=
 45 endif
 46 
 47 ################################################################################
 48 # Setup the compilation for the module
 49 #
 50 MODULE_SRC_DIRS := $(call FindModuleSrcDirs, $(MODULE))
 51 
 52 # The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
 53 # JDK_FILTER at the make command line, only a subset of the JDK java files will
 54 # be recompiled. If multiple paths are separated by comma, convert that into a

 82             ) \
 83         ), \
 84         .properties \
 85     )
 86 
 87 ################################################################################
 88 # Include module specific build settings
 89 
 90 THIS_SNIPPET := modules/$(MODULE)/Java.gmk
 91 
 92 ifneq ($(wildcard $(THIS_SNIPPET)), )
 93   include MakeSnippetStart.gmk
 94 
 95   include $(THIS_SNIPPET)
 96 
 97   include MakeSnippetEnd.gmk
 98 endif
 99 
100 ################################################################################
101 # Setup the main compilation

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