public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sim: fix arch Makefile regen when unified
@ 2021-06-30  0:51 Mike Frysinger
  2021-06-30 17:04 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2021-06-30  0:51 UTC (permalink / raw)
  To: gdb-patches

The $(arch) variable is only setup for cgen ports, so calculate this
value dynamically.  We also need to generate multiple inputs in order
to properly recreate the subdir Makefile, so list them all.
---
 sim/common/Make-common.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index c203b4e1c7bf..723bda589c9b 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -534,7 +534,8 @@ force:
 
 Makefile: Makefile.in $(srccom)/Make-common.in $(config.status)
 @SIM_COMMON_BUILD_FALSE@	CONFIG_HEADERS= $(SHELL) ./config.status
-@SIM_COMMON_BUILD_TRUE@	cd .. && $(SHELL) ./config.status $(arch)/Makefile
+@SIM_COMMON_BUILD_TRUE@	pwd=`pwd` && subdir=`basename "$$pwd"` && cd .. && \
+@SIM_COMMON_BUILD_TRUE@		$(SHELL) ./config.status Make-common.sim $$subdir/Makefile.sim $$subdir/Makefile
 
 @SIM_COMMON_BUILD_FALSE@config.status: configure
 @SIM_COMMON_BUILD_FALSE@	$(SHELL) ./config.status --recheck
-- 
2.31.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sim: fix arch Makefile regen when unified
  2021-06-30  0:51 [PATCH] sim: fix arch Makefile regen when unified Mike Frysinger
@ 2021-06-30 17:04 ` Tom Tromey
  2021-06-30 17:24   ` Mike Frysinger
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2021-06-30 17:04 UTC (permalink / raw)
  To: Mike Frysinger via Gdb-patches

>>>>> "Mike" == Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> writes:

Mike> -@SIM_COMMON_BUILD_TRUE@	cd .. && $(SHELL) ./config.status $(arch)/Makefile
Mike> +@SIM_COMMON_BUILD_TRUE@	pwd=`pwd` && subdir=`basename "$$pwd"` && cd .. && \
Mike> +@SIM_COMMON_BUILD_TRUE@		$(SHELL) ./config.status Make-common.sim $$subdir/Makefile.sim $$subdir/Makefile

My understanding is that the argument to config.status is the "tag" (aka
filename) of the output -- so the other arguments aren't needed.
If those are also outputs, there should just be new rules for them.

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sim: fix arch Makefile regen when unified
  2021-06-30 17:04 ` Tom Tromey
@ 2021-06-30 17:24   ` Mike Frysinger
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2021-06-30 17:24 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Mike Frysinger via Gdb-patches

On 30 Jun 2021 11:04, Tom Tromey wrote:
> >>>>> "Mike" == Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Mike> -@SIM_COMMON_BUILD_TRUE@	cd .. && $(SHELL) ./config.status $(arch)/Makefile
> Mike> +@SIM_COMMON_BUILD_TRUE@	pwd=`pwd` && subdir=`basename "$$pwd"` && cd .. && \
> Mike> +@SIM_COMMON_BUILD_TRUE@		$(SHELL) ./config.status Make-common.sim $$subdir/Makefile.sim $$subdir/Makefile
> 
> My understanding is that the argument to config.status is the "tag" (aka
> filename) of the output -- so the other arguments aren't needed.
> If those are also outputs, there should just be new rules for them.

Make-common.sim is a common rule shared by all subdirs.
subdir/Makefile.sim & subdir/Makefile are separate rules (and files).
Makefile.sim uses the existing autotool infra to rewrite the source
subdir/Makefile.in (as i don't think i can easily do this myself),
and then the final subdir/Makefile blends the Make-common.sim in.

$src/common/Make-common.in -> $build/Make-common.sim
$src/$arch/Makefile.in     -> $build/$arch/Makefile.sim
$build/Make-common.sim + $build/$arch/Makefile.sim -> $build/$arch/Makefile

it's a bit convoluted still, but it's not exactly new ... the sim code
has been doing this for a while.  i've moved bits around by merging into
a single configure script, but it's still the same number of bits.

the long term plan is to convert it over to automake & subdir/local.mk
modules, then this code would all go away.
-mike

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-30 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-30  0:51 [PATCH] sim: fix arch Makefile regen when unified Mike Frysinger
2021-06-30 17:04 ` Tom Tromey
2021-06-30 17:24   ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).