From b792fa8806efa517a233e53d88c0033035a65175 Mon Sep 17 00:00:00 2001 From: "Keith W. Campbell" Date: Mon, 19 Jun 2023 11:52:23 -0400 Subject: [PATCH] Centralize definition of J9TOOLS_DIR and fix uses on Windows 11 * put generally useful macros in MakeBase.gmk Signed-off-by: Keith W. Campbell --- closed/GensrcJ9JCL.gmk | 2 +- closed/JPP.gmk | 25 +++++++---------------- closed/OpenJ9.gmk | 7 +++---- closed/custom/common/MakeBase.gmk | 34 +++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 23 deletions(-) create mode 100644 closed/custom/common/MakeBase.gmk diff --git a/closed/GensrcJ9JCL.gmk b/closed/GensrcJ9JCL.gmk index 19629e8ebfc..eaded1a21df 100644 --- a/closed/GensrcJ9JCL.gmk +++ b/closed/GensrcJ9JCL.gmk @@ -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 diff --git a/closed/JPP.gmk b/closed/JPP.gmk index 6790e844fa1..4f28bc94081 100644 --- a/closed/JPP.gmk +++ b/closed/JPP.gmk @@ -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 diff --git a/closed/OpenJ9.gmk b/closed/OpenJ9.gmk index f6ba0aa2ae5..0276b8bed99 100644 --- a/closed/OpenJ9.gmk +++ b/closed/OpenJ9.gmk @@ -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 @@ -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) @@ -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) \ diff --git a/closed/custom/common/MakeBase.gmk b/closed/custom/common/MakeBase.gmk new file mode 100644 index 00000000000..bc55724eefe --- /dev/null +++ b/closed/custom/common/MakeBase.gmk @@ -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 . +# =========================================================================== + +# 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