8310376: Extend SetupTarget macro with DIR parameter

Reviewed-by: mikael
This commit is contained in:
Erik Joelsson 2023-06-21 09:57:49 +00:00
parent 7ea22cd385
commit 574c6f0ebf

View File

@ -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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -38,11 +38,16 @@ _MAINSUPPORT_GMK := 1
# TARGET the makefile target # TARGET the makefile target
# ARGS arguments to the makefile # ARGS arguments to the makefile
# DEPS the target(s) this new rule depends on # DEPS the target(s) this new rule depends on
# DIR the directory of the makefile (defaults to $(TOPDIR)/make)
# #
SetupTarget = $(NamedParamsMacroTemplate) SetupTarget = $(NamedParamsMacroTemplate)
define SetupTargetBody define SetupTargetBody
ifeq ($$($1_DIR), )
$1_DIR := $(TOPDIR)/make
endif
$1: $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 ALL_TARGETS += $1