Skip to content

Commit 2a8e8a4

Browse files
committed
Improve support for builds with multiple configurations
* define J9JCL_SOURCES_DIR & J9JCL_SOURCES_DONEFILE in custom-spec.gmk and use as appropriate * move j9jcl preprocessing to a separate makefile * remove redundant definition of FixPath * remove unused macro OPENJ9_BIN_OR_LIB_DIR Signed-off-by: Keith W. Campbell <[email protected]>
1 parent e1e6651 commit 2a8e8a4

File tree

6 files changed

+89
-60
lines changed

6 files changed

+89
-60
lines changed

closed/GensrcJ9JCL.gmk

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# ===========================================================================
2+
# (c) Copyright IBM Corp. 2020, 2020 All Rights Reserved
3+
# ===========================================================================
4+
# This code is free software; you can redistribute it and/or modify it
5+
# under the terms of the GNU General Public License version 2 only, as
6+
# published by the Free Software Foundation.
7+
#
8+
# IBM designates this particular file as subject to the "Classpath" exception
9+
# as provided by IBM in the LICENSE file that accompanied this code.
10+
#
11+
# This code is distributed in the hope that it will be useful, but WITHOUT
12+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
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, see <http://www.gnu.org/licenses/>.
19+
# ===========================================================================
20+
21+
.PHONY : all
22+
23+
all :
24+
25+
include $(SPEC)
26+
include $(TOPDIR)/make/common/MakeBase.gmk
27+
28+
J9TOOLS_DIR := $(SUPPORT_OUTPUTDIR)/j9tools
29+
JPP_JAR := $(J9TOOLS_DIR)/jpp.jar
30+
31+
RecursiveWildcard = $(foreach dir,$(wildcard $1/*),$(call RecursiveWildcard,$(dir),$2) $(filter $(subst *,%,$2),$(dir)))
32+
AllJclSource = $(call RecursiveWildcard,$(OPENJ9_TOPDIR)/jcl/src,*.java)
33+
34+
JPP_TAGS := PLATFORM-$(OPENJ9_PLATFORM_CODE)
35+
36+
ifeq (true,$(OPENJ9_ENABLE_INLINE_TYPES))
37+
JPP_TAGS += INLINE-TYPES
38+
endif # OPENJ9_ENABLE_INLINE_TYPES
39+
40+
ifeq (true,$(OPENJ9_ENABLE_OPENJDK_METHODHANDLES))
41+
JPP_TAGS += OPENJDK_METHODHANDLES
42+
endif # OPENJ9_ENABLE_OPENJDK_METHODHANDLES
43+
44+
$(J9JCL_SOURCES_DONEFILE) : $(AllJclSource)
45+
@$(ECHO) Building OpenJ9 Java Preprocessor
46+
@$(MKDIR) -p $(J9TOOLS_DIR)
47+
$(MAKE) $(MAKE_ARGS) -C $(OPENJ9_TOPDIR)/sourcetools -f buildj9tools.mk \
48+
BOOT_JDK=$(BOOT_JDK) \
49+
DEST_DIR=$(call FixPath,$(J9TOOLS_DIR)) \
50+
JAVA_HOME=$(BOOT_JDK) \
51+
$(call FixPath,$(JPP_JAR))
52+
@$(ECHO) Generating J9JCL sources
53+
@$(BOOT_JDK)/bin/java \
54+
-cp "$(call FixPath,$(JPP_JAR))" \
55+
-Dfile.encoding=US-ASCII \
56+
com.ibm.jpp.commandline.CommandlineBuilder \
57+
-verdict \
58+
-baseDir "$(call FixPath,$(OPENJ9_TOPDIR))/" \
59+
-config JAVA$(VERSION_FEATURE) \
60+
-srcRoot jcl/ \
61+
-xml jpp_configuration.xml \
62+
-dest "$(call FixPath,$(J9JCL_SOURCES_DIR))" \
63+
-tag:define "$(subst $(SPACE),;,$(sort $(JPP_TAGS)))"
64+
@$(MKDIR) -p $(@D)
65+
@$(TOUCH) $@
66+
67+
all : $(J9JCL_SOURCES_DONEFILE)

closed/OpenJ9.gmk

-50
Original file line numberDiff line numberDiff line change
@@ -86,29 +86,22 @@ ifeq (false,$(WARNINGS_AS_ERRORS_OPENJ9))
8686
endif
8787

8888
ifeq (windows,$(OPENJDK_TARGET_OS))
89-
# convert unix path to windows path
90-
FixPath = $(shell $(CYGPATH) -m $1)
9189
# convert windows path to unix path
9290
UnixPath = $(shell $(CYGPATH) -u $1)
9391
# set Visual Studio environment
9492
# wrap PATH in quotes as it contains spaces (unix path)
9593
# INCLUDE, LIB are already wrapped in quotes (windows paths)
9694
EXPORT_MSVS_ENV_VARS := PATH="$(PATH)" INCLUDE=$(INCLUDE) LIB=$(LIB)
97-
# set the output directory for shared libraries
98-
OPENJ9_BIN_OR_LIB_DIR := bin
9995
else
100-
FixPath = $1
10196
UnixPath = $1
10297
EXPORT_MSVS_ENV_VARS :=
103-
OPENJ9_BIN_OR_LIB_DIR := lib
10498
endif
10599

106100
.PHONY : \
107101
build-j9 \
108102
clean-j9 \
109103
clean-j9-dist \
110104
clean-openj9-thirdparty-binaries \
111-
generate-j9jcl-sources \
112105
run-preprocessors-j9 \
113106
stage-j9 \
114107
#
@@ -331,7 +324,6 @@ $(OPENJ9_VM_BUILD_DIR)/omr/OMR_VERSION_STRING : $(call DependOnVariable, OPENJ9O
331324
$(ECHO) '#define OMR_VERSION_STRING "$(OPENJ9OMR_SHA)"' > $@
332325

333326
run-preprocessors-j9 : \
334-
generate-j9jcl-sources \
335327
$(OPENJ9_VM_BUILD_DIR)/omr/OMR_VERSION_STRING \
336328
$(OPENJ9_VM_BUILD_DIR)/compiler/jit.version \
337329
$(OPENJ9_VM_BUILD_DIR)/include/openj9_version_info.h
@@ -504,48 +496,6 @@ build-j9 : run-preprocessors-j9
504496
@$(ECHO) OpenJ9 compile complete
505497
+$(DDR_COMMAND)
506498

507-
J9JCL_SOURCES_DONEFILE := $(MAKESUPPORT_OUTPUTDIR)/j9jcl_sources.done
508-
509-
recur_wildcard = $(foreach dir,$(wildcard $1/*),$(call recur_wildcard,$(dir),$2) $(filter $(subst *,%,$2),$(dir)))
510-
AllJclSource = $(call recur_wildcard,$(OPENJ9_TOPDIR)/jcl/src,*.java)
511-
512-
JPP_DEST := $(SUPPORT_OUTPUTDIR)/j9jcl_sources
513-
JPP_JAR := $(J9TOOLS_DIR)/jpp.jar
514-
JPP_TAGS := PLATFORM-$(OPENJ9_PLATFORM_CODE)
515-
516-
ifeq (true,$(OPENJ9_ENABLE_INLINE_TYPES))
517-
JPP_TAGS += INLINE-TYPES
518-
endif # OPENJ9_ENABLE_INLINE_TYPES
519-
520-
ifeq (true,$(OPENJ9_ENABLE_OPENJDK_METHODHANDLES))
521-
JPP_TAGS += OPENJDK_METHODHANDLES
522-
endif # OPENJ9_ENABLE_OPENJDK_METHODHANDLES
523-
524-
$(J9JCL_SOURCES_DONEFILE) : $(AllJclSource)
525-
@$(ECHO) Building OpenJ9 Java Preprocessor
526-
@$(MKDIR) -p $(J9TOOLS_DIR)
527-
$(MAKE) $(MAKE_ARGS) -C $(OPENJ9_TOPDIR)/sourcetools -f buildj9tools.mk \
528-
BOOT_JDK=$(BOOT_JDK) \
529-
DEST_DIR=$(call FixPath,$(J9TOOLS_DIR)) \
530-
JAVA_HOME=$(BOOT_JDK) \
531-
$(call FixPath,$(JPP_JAR))
532-
@$(ECHO) Generating J9JCL sources
533-
@$(BOOT_JDK)/bin/java \
534-
-cp "$(call FixPath,$(JPP_JAR))" \
535-
-Dfile.encoding=US-ASCII \
536-
com.ibm.jpp.commandline.CommandlineBuilder \
537-
-verdict \
538-
-baseDir "$(call FixPath,$(OPENJ9_TOPDIR))/" \
539-
-config JAVA$(VERSION_FEATURE) \
540-
-srcRoot jcl/ \
541-
-xml jpp_configuration.xml \
542-
-dest "$(call FixPath,$(JPP_DEST))" \
543-
-tag:define "$(subst $(SPACE),;,$(sort $(JPP_TAGS)))"
544-
@$(MKDIR) -p $(@D)
545-
@$(TOUCH) $@
546-
547-
generate-j9jcl-sources : $(J9JCL_SOURCES_DONEFILE)
548-
549499
clean-j9 : clean-openj9-thirdparty-binaries
550500
+$(MAKE) $(MAKE_ARGS) -C $(OUTPUTDIR)/vm clean
551501

closed/autoconf/custom-spec.gmk.in

+3
Original file line numberDiff line numberDiff line change
@@ -156,5 +156,8 @@ else
156156
OPENJ9_VM_BUILD_DIR = $(OUTPUTDIR)/vm
157157
endif
158158

159+
J9JCL_SOURCES_DIR := $(SUPPORT_OUTPUTDIR)/j9jcl
160+
J9JCL_SOURCES_DONEFILE := $(MAKESUPPORT_OUTPUTDIR)/j9jcl.done
161+
159162
# Disable all hotspot features.
160163
JVM_FEATURES_server :=

closed/custom/Docs.gmk

+5-5
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ OPENJ9_JAVADOC_TEMP := $(SUPPORT_OUTPUTDIR)/docs/_javadoc_temp.html
7474
JDK_API_CUSTOM_TARGETS += $(OPENJ9_JAVADOC_MARKER)
7575

7676
################################################################################
77-
# The OpenJ9 classes are built from the j9jcl_sources and closed/src
77+
# The OpenJ9 classes are built from the $(J9JCL_SOURCES_DIR) and closed/src
7878
# directories.
7979
# The packages are beneath directories called /share/classes (or /unix/classes,
8080
# /windows/classes etc.) which do not appear in the javadoc tree structure.
@@ -102,7 +102,7 @@ OPENJ9_JAVADOC_SCRIPT_BODY = \
102102
# replaced after the javadoc has been created.
103103
$(OPENJ9_JAVADOC_MARKER) : $(OPENJDK_JAVADOC_MARKER) $(OPENJ9_ONLY_JAVADOC_MARKER)
104104
$(ECHO) '$(OPENJ9_JAVADOC_SCRIPT_BODY)' >$(OPENJ9_JAVADOC_SCRIPT)
105-
$(CD) $(SUPPORT_OUTPUTDIR)/j9jcl_sources ; \
105+
$(CD) $(J9JCL_SOURCES_DIR) ; \
106106
$(FIND) . -type f -name '*.java' \
107107
| $(SED) -e 's|/[^/]\+/classes/|/|' -e 's|package-info.java$$|package-summary.html|' -e 's|\.java$$|.html|' \
108108
| $(XARGS) $(BASH) $(OPENJ9_JAVADOC_SCRIPT)
@@ -155,8 +155,8 @@ OPENJ9_ONLY_INDEX_HTML := $(IMAGES_OUTPUTDIR)/openj9-docs/api/index.html
155155
# (via OPENJ9_ONLY_JAVADOC_FILELIST) to identify when the javadoc needs
156156
# regenerating.
157157

158-
OPENJ9_ONLY_FILELIST := $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/j9jcl_sources -type f)
159-
OPENJ9_ONLY_JAVADOC_FILELIST := $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/j9jcl_sources -type f '(' -path '*/openj9.*/*.java' -o -path '*/jdk.management/*.java' ')')
158+
OPENJ9_ONLY_FILELIST := $(shell $(FIND) $(J9JCL_SOURCES_DIR) -type f)
159+
OPENJ9_ONLY_JAVADOC_FILELIST := $(shell $(FIND) $(J9JCL_SOURCES_DIR) -type f '(' -path '*/openj9.*/*.java' -o -path '*/jdk.management/*.java' ')')
160160
OPENJ9_ONLY_JAVADOC_FILES := $(SUPPORT_OUTPUTDIR)/openj9-docs/_javadoc_openj9_files.txt
161161

162162
# Set up the javadoc command line options.
@@ -283,7 +283,7 @@ OPENJ9_ONLY_JAVADOC_SCRIPT_BODY = \
283283
OPENJ9_ONLY_JAVADOC_SCRIPT_BODY_ESC = $(subst ','\'',$(OPENJ9_ONLY_JAVADOC_SCRIPT_BODY))
284284

285285
# Create a stub package-info.java file for each package with source files in
286-
# j9jcl_sources but no package-info.java file. This is then used by javadoc
286+
# $(J9JCL_SOURCES_DIR) but no package-info.java file. This is then used by javadoc
287287
# instead of the openjdk version to direct the user to the Oracle online
288288
# documentation for that package.
289289

closed/custom/Main.gmk

-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ CLEAN_DIRS += vm
2222

2323
.PHONY : \
2424
debug-image \
25-
generate-j9jcl-sources \
2625
j9vm-build \
2726
test-image-openj9 \
2827
#
@@ -45,9 +44,6 @@ OPENJ9_MAKE := $(MAKE) $(MAKE_ARGS) -f $(TOPDIR)/closed/OpenJ9.gmk
4544

4645
create-main-targets-include java.base-gensrc : generate-j9jcl-sources
4746

48-
generate-j9jcl-sources :
49-
@+$(OPENJ9_MAKE) $@
50-
5147
j9vm-build : buildtools-langtools
5248
ifeq ($(BUILD_OPENSSL),yes)
5349
@+$(MAKE) $(MAKE_ARGS) -f $(TOPDIR)/closed/openssl.gmk

closed/custom/common/Modules.gmk

+14-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,18 @@ MODULES_FILTER += \
3636

3737
TOP_SRC_DIRS += \
3838
$(TOPDIR)/closed/src \
39-
$(SUPPORT_OUTPUTDIR)/j9jcl_sources \
39+
$(J9JCL_SOURCES_DIR) \
4040
#
41+
42+
.PHONY : generate-j9jcl-sources
43+
44+
generate-j9jcl-sources $(J9JCL_SOURCES_DONEFILE) :
45+
@+$(MAKE) $(MAKE_ARGS) -f $(TOPDIR)/closed/GensrcJ9JCL.gmk
46+
47+
# When building multiple configurations at once (e.g. 'make CONF= images')
48+
# the 'create-main-targets-include' target will only be considered for the
49+
# first configuration; J9JCL source generation will be delayed for other
50+
# configurations. In order to produce a complete module-deps.gmk, we need
51+
# to ensure that the J9JCL source has been generated.
52+
53+
-include $(J9JCL_SOURCES_DONEFILE)

0 commit comments

Comments
 (0)