Skip to content

Commit

Permalink
Centralize definition of J9TOOLS_DIR and fix uses on Windows 11
Browse files Browse the repository at this point in the history
* put generally useful macros in MakeBase.gmk

Signed-off-by: Keith W. Campbell <keithc@ca.ibm.com>
  • Loading branch information
keithc-ca committed Jul 12, 2023
1 parent 18084a9 commit b792fa8
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 23 deletions.
2 changes: 1 addition & 1 deletion closed/GensrcJ9JCL.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ $(J9JCL_SOURCES_DONEFILE) : \
@$(MKDIR) -p $(J9TOOLS_DIR)
$(MAKE) $(MAKE_ARGS) -C $(OPENJ9_TOPDIR)/sourcetools -f buildj9tools.mk \
BOOT_JDK=$(BOOT_JDK) \
DEST_DIR=$(call FixPath,$(J9TOOLS_DIR)) \
DEST_DIR=$(call MixedPath,$(J9TOOLS_DIR)) \
JAVA_HOME=$(BOOT_JDK) \
preprocessor
@$(ECHO) Generating J9JCL sources
Expand Down
25 changes: 7 additions & 18 deletions closed/JPP.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,17 @@ endif # OPENJ9_ENABLE_OPENJDK_METHODHANDLES
# $3 - destination subdirectory
# $4 - more options (optional)
define RunJPP
@$(ECHO) $(BOOT_JDK)/bin/java \
-cp "$(call FixPath,$(JPP_JAR))" \
$(call EchoAndRun, $(BOOT_JDK)/bin/java \
-cp "$(call MixedPath,$(JPP_JAR))" \
-Dfile.encoding=US-ASCII \
com.ibm.jpp.commandline.CommandlineBuilder \
-verdict \
-config $1 \
-baseDir "$(call FixPath,$(dir $2))" \
-baseDir "$(call MixedPath,$(dir $2))" \
-srcRoot $(notdir $2)/ \
-xml "$(call FixPath,$(OPENJ9_TOPDIR)/jcl/jpp_configuration.xml)" \
-dest "$(call FixPath,$(SUPPORT_OUTPUTDIR)$(strip $3))" \
-xml "$(call MixedPath,$(OPENJ9_TOPDIR)/jcl/jpp_configuration.xml)" \
-dest "$(call MixedPath,$(SUPPORT_OUTPUTDIR)$(strip $3))" \
-tag:define "$(subst $(SPACE),;,$(sort $(JPP_TAGS)))" \
$4
@$(BOOT_JDK)/bin/java \
-cp "$(call FixPath,$(JPP_JAR))" \
-Dfile.encoding=US-ASCII \
com.ibm.jpp.commandline.CommandlineBuilder \
-verdict \
-config $1 \
-baseDir "$(call FixPath,$(dir $2))" \
-srcRoot $(notdir $2)/ \
-xml "$(call FixPath,$(OPENJ9_TOPDIR)/jcl/jpp_configuration.xml)" \
-dest "$(call FixPath,$(SUPPORT_OUTPUTDIR)$(strip $3))" \
-tag:define "$(subst $(SPACE),;,$(sort $(JPP_TAGS)))" \
$4
$4 \
)
endef # RunJPP
7 changes: 3 additions & 4 deletions closed/OpenJ9.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ifeq (,$(wildcard $(SPEC)))
endif
include $(SPEC)
include $(TOPDIR)/make/common/MakeBase.gmk
include $(TOPDIR)/closed/JPP.gmk

ifeq (,$(BUILD_ID))
BUILD_ID := 000000
Expand Down Expand Up @@ -314,8 +315,6 @@ $(foreach file, \
$(notdir $(wildcard $(OPENJ9_TOPDIR)/buildspecs/*)), \
$(eval $(call openj9_stage_buildspec_file,$(file))))

J9TOOLS_DIR := $(SUPPORT_OUTPUTDIR)/j9tools

stage-j9 :
@$(ECHO) Staging OpenJ9 runtime in $(OUTPUTDIR)/vm
$(call openj9_copy_tree,$(OUTPUTDIR)/vm,$(OPENJ9_TOPDIR)/runtime)
Expand Down Expand Up @@ -480,13 +479,13 @@ run-preprocessors-j9 : stage-j9
+BOOT_JDK=$(BOOT_JDK) $(EXPORT_COMPILER_ENV_VARS) OPENJDK_VERSION_NUMBER_FOUR_POSITIONS=$(VERSION_NUMBER_FOUR_POSITIONS) \
$(MAKE) $(MAKE_ARGS) -C $(OUTPUTDIR)/vm -f $(OPENJ9_TOPDIR)/runtime/buildtools.mk \
BUILD_ID=$(BUILD_ID) \
DEST_DIR=$(call FixPath,$(J9TOOLS_DIR)) \
DEST_DIR=$(call MixedPath,$(J9TOOLS_DIR)) \
EXTRA_CONFIGURE_ARGS=$(OMR_EXTRA_CONFIGURE_ARGS) \
FREEMARKER_JAR="$(FREEMARKER_JAR)" \
J9VM_SHA=$(OPENJ9_SHA) \
JAVA_HOME=$(BOOT_JDK) \
OMR_DIR=$(OUTPUTDIR)/vm/omr \
SOURCETOOLS_DIR=$(call FixPath,$(OPENJ9_TOPDIR))/sourcetools \
SOURCETOOLS_DIR=$(call MixedPath,$(OPENJ9_TOPDIR))/sourcetools \
SPEC=$(OPENJ9_BUILDSPEC) \
UMA_OPTIONS_EXTRA="-buildDate $(shell date +'%Y%m%d')" \
VERSION_MAJOR=$(VERSION_FEATURE) \
Expand Down
34 changes: 34 additions & 0 deletions closed/custom/common/MakeBase.gmk
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# ===========================================================================
# (c) Copyright IBM Corp. 2023, 2023 All Rights Reserved
# ===========================================================================
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# IBM designates this particular file as subject to the "Classpath" exception
# as provided by IBM in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, see <http://www.gnu.org/licenses/>.
# ===========================================================================

# Echo a command and then execute it.
# $1 - the command
define EchoAndRun
@ $(ECHO) $1
@ $1
endef

# On Windows, FixPath yields backslashes which can cause problems, so
# we use PATHTOOL instead for tools (like java) that support both.
ifeq ($(call isTargetOs, windows), true)
MixedPath = $(shell $(PATHTOOL) -m $1)
else
MixedPath = $1
endif

0 comments on commit b792fa8

Please sign in to comment.