From 574c6f0ebfdff86722a3659b91ec860a922ffc4d Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Wed, 21 Jun 2023 09:57:49 +0000 Subject: [PATCH] 8310376: Extend SetupTarget macro with DIR parameter Reviewed-by: mikael --- make/MainSupport.gmk | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/make/MainSupport.gmk b/make/MainSupport.gmk index 34137c502d4..8c575423005 100644 --- a/make/MainSupport.gmk +++ b/make/MainSupport.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -38,11 +38,16 @@ _MAINSUPPORT_GMK := 1 # TARGET the makefile target # ARGS arguments to the makefile # DEPS the target(s) this new rule depends on +# DIR the directory of the makefile (defaults to $(TOPDIR)/make) # SetupTarget = $(NamedParamsMacroTemplate) define SetupTargetBody + ifeq ($$($1_DIR), ) + $1_DIR := $(TOPDIR)/make + endif + $1: - +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f $$($1_MAKEFILE).gmk $$($1_TARGET) $$($1_ARGS)) + +($(CD) $$($1_DIR) && $(MAKE) $(MAKE_ARGS) -f $$($1_MAKEFILE).gmk $$($1_TARGET) $$($1_ARGS)) ALL_TARGETS += $1