From 65a1b222bcd0d4a52ca0cd7b401a806e906cc964 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 7 May 2025 17:07:29 +0200 Subject: [PATCH 1/2] 8351029: IncludeCustomExtension does not work on cygwin with source code below /home --- make/PreInitSupport.gmk | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/make/PreInitSupport.gmk b/make/PreInitSupport.gmk index 668363d872576..0c5432dd0c369 100644 --- a/make/PreInitSupport.gmk +++ b/make/PreInitSupport.gmk @@ -251,12 +251,16 @@ endef # Param 2: The SPEC file to use. define DefineMainTargets + # We need to include the given SPEC file to setup TOPDIR properly + SPEC_FILE := $(strip $2) + -include $$(SPEC_FILE) + # We will start by making sure the main-targets.gmk file is removed, if # make has not been restarted. By the -include, we will trigger the # rule for generating the file (which is never there since we removed it), # thus generating it fresh, and make will restart, incrementing the restart # count. - main_targets_file := $$(dir $(strip $2))make-support/main-targets.gmk + main_targets_file := $$(dir $$(SPEC_FILE))make-support/main-targets.gmk ifeq ($$(MAKE_RESTARTS), ) # Only do this if make has not been restarted, and if we do not force it. @@ -268,10 +272,10 @@ define DefineMainTargets $$(main_targets_file): @( cd $$(TOPDIR) && \ $$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(TOPDIR)/make/GenerateFindTests.gmk \ - -I $$(TOPDIR)/make/common SPEC=$(strip $2) ) + -I $$(TOPDIR)/make/common SPEC=$$(SPEC_FILE) ) @( cd $$(TOPDIR) && \ $$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(TOPDIR)/make/Main.gmk \ - -I $$(TOPDIR)/make/common SPEC=$(strip $2) NO_RECIPES=true \ + -I $$(TOPDIR)/make/common SPEC=$$(SPEC_FILE) NO_RECIPES=true \ $$(MAKE_LOG_VARS) \ create-main-targets-include ) From 5eb4623832df1a9ef3a33aa7e7d2a62a9362f543 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Thu, 8 May 2025 00:43:52 +0200 Subject: [PATCH 2/2] Alternative solution --- make/PreInit.gmk | 12 ++++++------ make/PreInitSupport.gmk | 7 ++----- make/common/MakeFileStart.gmk | 2 +- make/common/MakeIncludeStart.gmk | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/make/PreInit.gmk b/make/PreInit.gmk index a01971e845dc1..bce61ccde5f52 100644 --- a/make/PreInit.gmk +++ b/make/PreInit.gmk @@ -161,19 +161,19 @@ ifneq ($(SKIP_SPEC), true) ( cd $(TOPDIR) && \ $(foreach spec, $(SPECS), \ $(MAKE) $(MAKE_INIT_ARGS) -j 1 -f $(TOPDIR)/make/Init.gmk \ - SPEC=$(spec) $(MAKE_INIT_MAIN_TARGET_ARGS) \ - main && \ + SPEC=$(spec) TOPDIR_ALT=$(TOPDIR) \ + $(MAKE_INIT_MAIN_TARGET_ARGS) main && \ $(if $(and $(COMPARE_BUILD), $(PARALLEL_TARGETS)), \ $(MAKE) $(MAKE_INIT_ARGS) -f $(TOPDIR)/make/Init.gmk \ - SPEC=$(spec) \ + SPEC=$(spec) TOPDIR_ALT=$(TOPDIR) \ COMPARE_BUILD="$(COMPARE_BUILD)" \ pre-compare-build && \ $(MAKE) $(MAKE_INIT_ARGS) -j 1 -f $(TOPDIR)/make/Init.gmk \ - SPEC=$(spec) $(MAKE_INIT_MAIN_TARGET_ARGS) \ + SPEC=$(spec) TOPDIR_ALT=$(TOPDIR) \ COMPARE_BUILD="$(COMPARE_BUILD):NODRYRUN=true" \ - main && \ + $(MAKE_INIT_MAIN_TARGET_ARGS) main && \ $(MAKE) $(MAKE_INIT_ARGS) -f $(TOPDIR)/make/Init.gmk \ - SPEC=$(spec) \ + SPEC=$(spec) TOPDIR_ALT=$(TOPDIR) \ COMPARE_BUILD="$(COMPARE_BUILD):NODRYRUN=true" \ post-compare-build && \ ) \ diff --git a/make/PreInitSupport.gmk b/make/PreInitSupport.gmk index 0c5432dd0c369..1d3c3ce913519 100644 --- a/make/PreInitSupport.gmk +++ b/make/PreInitSupport.gmk @@ -250,10 +250,7 @@ endef # Param 1: FORCE = force generation of main-targets.gmk or LAZY = do not force. # Param 2: The SPEC file to use. define DefineMainTargets - - # We need to include the given SPEC file to setup TOPDIR properly SPEC_FILE := $(strip $2) - -include $$(SPEC_FILE) # We will start by making sure the main-targets.gmk file is removed, if # make has not been restarted. By the -include, we will trigger the @@ -272,10 +269,10 @@ define DefineMainTargets $$(main_targets_file): @( cd $$(TOPDIR) && \ $$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(TOPDIR)/make/GenerateFindTests.gmk \ - -I $$(TOPDIR)/make/common SPEC=$$(SPEC_FILE) ) + -I $$(TOPDIR)/make/common SPEC=$$(SPEC_FILE) TOPDIR_ALT=$$(TOPDIR)) @( cd $$(TOPDIR) && \ $$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(TOPDIR)/make/Main.gmk \ - -I $$(TOPDIR)/make/common SPEC=$$(SPEC_FILE) NO_RECIPES=true \ + -I $$(TOPDIR)/make/common SPEC=$$(SPEC_FILE) TOPDIR_ALT=$$(TOPDIR) NO_RECIPES=true \ $$(MAKE_LOG_VARS) \ create-main-targets-include ) diff --git a/make/common/MakeFileStart.gmk b/make/common/MakeFileStart.gmk index f1dd0abb792c3..f18c623d3e8d2 100644 --- a/make/common/MakeFileStart.gmk +++ b/make/common/MakeFileStart.gmk @@ -47,7 +47,7 @@ endif # We need spec.gmk to get $(TOPDIR) include $(SPEC) -THIS_MAKEFILE := $(patsubst make/%,%,$(patsubst $(TOPDIR)/%,%,$(THIS_MAKEFILE_PATH))) +THIS_MAKEFILE := $(patsubst make/%,%,$(patsubst $(TOPDIR_ALT)/make/%,%,$(patsubst $(TOPDIR)/%,%,$(THIS_MAKEFILE_PATH)))) ifeq ($(LOG_FLOW), true) $(info :Enter $(THIS_MAKEFILE)) diff --git a/make/common/MakeIncludeStart.gmk b/make/common/MakeIncludeStart.gmk index d09f027c1d38d..3904633f9f218 100644 --- a/make/common/MakeIncludeStart.gmk +++ b/make/common/MakeIncludeStart.gmk @@ -29,7 +29,7 @@ # Get the next to last word (by prepending a padding element) THIS_INCLUDE_PATH := $(word $(words ${MAKEFILE_LIST}),padding ${MAKEFILE_LIST}) -THIS_INCLUDE := $(patsubst $(TOPDIR)/make/%,%,$(THIS_INCLUDE_PATH)) +THIS_INCLUDE := $(patsubst $(TOPDIR_ALT)/make/%,%,$(patsubst $(TOPDIR)/make/%,%,$(THIS_INCLUDE_PATH))) # Print an indented message, also counting the top-level makefile as a level ifneq ($(INCLUDE_GUARD_$(THIS_INCLUDE)), true)