Skip to content

Commit ee15e75

Browse files
committed
Improve support for builds with multiple configurations
* 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 ee15e75

File tree

4 files changed

+85
-54
lines changed

4 files changed

+85
-54
lines changed

closed/GensrcJ9JCL.gmk

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
J9JCL_SOURCES_DONEFILE := $(MAKESUPPORT_OUTPUTDIR)/j9jcl_sources.done
29+
30+
J9TOOLS_DIR := $(SUPPORT_OUTPUTDIR)/j9tools
31+
32+
RecursiveWildcard = $(foreach dir,$(wildcard $1/*),$(call RecursiveWildcard,$(dir),$2) $(filter $(subst *,%,$2),$(dir)))
33+
AllJclSource = $(call RecursiveWildcard,$(OPENJ9_TOPDIR)/jcl/src,*.java)
34+
35+
JPP_DEST := $(SUPPORT_OUTPUTDIR)/j9jcl_sources
36+
JPP_JAR := $(J9TOOLS_DIR)/jpp.jar
37+
JPP_TAGS := PLATFORM-$(OPENJ9_PLATFORM_CODE)
38+
39+
ifeq (true,$(OPENJ9_ENABLE_INLINE_TYPES))
40+
JPP_TAGS += INLINE-TYPES
41+
endif # OPENJ9_ENABLE_INLINE_TYPES
42+
43+
ifeq (true,$(OPENJ9_ENABLE_OPENJDK_METHODHANDLES))
44+
JPP_TAGS += OPENJDK_METHODHANDLES
45+
endif # OPENJ9_ENABLE_OPENJDK_METHODHANDLES
46+
47+
$(J9JCL_SOURCES_DONEFILE) : $(AllJclSource)
48+
@$(ECHO) Building OpenJ9 Java Preprocessor
49+
@$(MKDIR) -p $(J9TOOLS_DIR)
50+
$(MAKE) $(MAKE_ARGS) -C $(OPENJ9_TOPDIR)/sourcetools -f buildj9tools.mk \
51+
BOOT_JDK=$(BOOT_JDK) \
52+
DEST_DIR=$(call FixPath,$(J9TOOLS_DIR)) \
53+
JAVA_HOME=$(BOOT_JDK) \
54+
$(call FixPath,$(JPP_JAR))
55+
@$(ECHO) Generating J9JCL sources
56+
@$(BOOT_JDK)/bin/java \
57+
-cp "$(call FixPath,$(JPP_JAR))" \
58+
-Dfile.encoding=US-ASCII \
59+
com.ibm.jpp.commandline.CommandlineBuilder \
60+
-verdict \
61+
-baseDir "$(call FixPath,$(OPENJ9_TOPDIR))/" \
62+
-config JAVA$(VERSION_FEATURE) \
63+
-srcRoot jcl/ \
64+
-xml jpp_configuration.xml \
65+
-dest "$(call FixPath,$(JPP_DEST))" \
66+
-tag:define "$(subst $(SPACE),;,$(sort $(JPP_TAGS)))"
67+
@$(MKDIR) -p $(@D)
68+
@$(TOUCH) $@
69+
70+
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/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

+15
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,18 @@ TOP_SRC_DIRS += \
3838
$(TOPDIR)/closed/src \
3939
$(SUPPORT_OUTPUTDIR)/j9jcl_sources \
4040
#
41+
42+
.PHONY : generate-j9jcl-sources
43+
44+
generate-j9jcl-sources :
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 later for
50+
# other configurations. In order to produce a complete module-deps.gmk
51+
# we need to ensure that the J9JCL source has been generated.
52+
53+
ifeq (,$(wildcard $(SUPPORT_OUTPUTDIR)/j9jcl_sources))
54+
$(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk : generate-j9jcl-sources
55+
endif

0 commit comments

Comments
 (0)