* [PATCH] sim: build: move generated headers to built sources
@ 2023-01-03 3:14 Mike Frysinger
0 siblings, 0 replies; only message in thread
From: Mike Frysinger @ 2023-01-03 3:14 UTC (permalink / raw)
To: gdb-patches
Automake's automatic header deptracking has a bootstrap problem where
it can't detect generated headers when compiling. We've been handling
that by adding a custom SIM_ALL_RECURSIVE_DEPS variable, but that only
works when building objects recursively in subdirs. As we move those
out to the top-level, we don't have any recursive steps anymore. The
Automake approach is to declare those headers in BUILT_SOURCES.
This isn't completely foolproof as the Automake manual documents: it
only activates for `make all`, not `make foo.o`, but that shouldn't be
a huge limitation as it only affects the initial compile. After that,
rebuilds should work fine.
---
sim/Makefile.am | 1 +
sim/Makefile.in | 253 ++++++++++++++++++++++++-------------------
sim/bpf/local.mk | 6 +-
sim/cr16/local.mk | 3 +-
sim/cris/local.mk | 6 +-
sim/d10v/local.mk | 3 +-
sim/frv/local.mk | 3 +-
sim/iq2000/local.mk | 3 +-
sim/lm32/local.mk | 3 +-
sim/m32r/local.mk | 8 +-
sim/mips/local.mk | 2 +
sim/mn10300/local.mk | 9 ++
sim/or1k/local.mk | 3 +-
sim/v850/local.mk | 9 ++
14 files changed, 189 insertions(+), 123 deletions(-)
diff --git a/sim/Makefile.am b/sim/Makefile.am
index eb891a56f2d5..dd85297c83e5 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -36,6 +36,7 @@ check_PROGRAMS =
noinst_PROGRAMS =
noinst_LIBRARIES =
EXTRA_PROGRAMS =
+BUILT_SOURCES =
CLEANFILES =
DISTCLEANFILES =
diff --git a/sim/bpf/local.mk b/sim/bpf/local.mk
index 7221dafa9b21..4ba1f461303c 100644
--- a/sim/bpf/local.mk
+++ b/sim/bpf/local.mk
@@ -23,11 +23,13 @@
noinst_PROGRAMS += %D%/run
-%C%_BUILD_OUTPUTS = \
+## List all generated headers to help Automake dependency tracking.
+BUILT_SOURCES += \
%D%/eng-le.h \
+ %D%/eng-be.h
+%C%_BUILD_OUTPUTS = \
%D%/mloop-le.c \
%D%/stamp-mloop-le \
- %D%/eng-be.h \
%D%/mloop-be.c \
%D%/stamp-mloop-be
diff --git a/sim/cr16/local.mk b/sim/cr16/local.mk
index cb0d6051b751..f5401f6d5f93 100644
--- a/sim/cr16/local.mk
+++ b/sim/cr16/local.mk
@@ -24,9 +24,10 @@
noinst_PROGRAMS += %D%/run
+## List all generated headers to help Automake dependency tracking.
+BUILT_SOURCES += %D%/simops.h
%C%_BUILD_OUTPUTS = \
%D%/gencode$(EXEEXT) \
- %D%/simops.h \
%D%/table.c
## This makes sure build tools are available before building the arch-subdirs.
diff --git a/sim/cris/local.mk b/sim/cris/local.mk
index 96c6e738da90..0e56fefa960c 100644
--- a/sim/cris/local.mk
+++ b/sim/cris/local.mk
@@ -34,11 +34,13 @@ AM_MAKEFLAGS += %C%_SIM_EXTRA_HW_DEVICES="$(%C%_SIM_EXTRA_HW_DEVICES)"
check_PROGRAMS += %D%/rvdummy
-%C%_BUILD_OUTPUTS = \
+## List all generated headers to help Automake dependency tracking.
+BUILT_SOURCES += \
%D%/engv10.h \
+ %D%/engv32.h
+%C%_BUILD_OUTPUTS = \
%D%/mloopv10f.c \
%D%/stamp-mloop-v10f \
- %D%/engv32.h \
%D%/mloopv32f.c \
%D%/stamp-mloop-v32f
diff --git a/sim/d10v/local.mk b/sim/d10v/local.mk
index ba9a754245c5..38a3c9263d62 100644
--- a/sim/d10v/local.mk
+++ b/sim/d10v/local.mk
@@ -24,9 +24,10 @@
noinst_PROGRAMS += %D%/run
+## List all generated headers to help Automake dependency tracking.
+BUILT_SOURCES += %D%/simops.h
%C%_BUILD_OUTPUTS = \
%D%/gencode$(EXEEXT) \
- %D%/simops.h \
%D%/table.c
## This makes sure build tools are available before building the arch-subdirs.
diff --git a/sim/frv/local.mk b/sim/frv/local.mk
index d5fdd1dba303..11db636a7159 100644
--- a/sim/frv/local.mk
+++ b/sim/frv/local.mk
@@ -27,8 +27,9 @@ noinst_PROGRAMS += %D%/run
%C%docdir = $(docdir)/%C%
%C%doc_DATA = %D%/README
+## List all generated headers to help Automake dependency tracking.
+BUILT_SOURCES += %D%/eng.h
%C%_BUILD_OUTPUTS = \
- %D%/eng.h \
%D%/mloop.c \
%D%/stamp-mloop
diff --git a/sim/iq2000/local.mk b/sim/iq2000/local.mk
index 639a712c1f79..881cf2c55dcd 100644
--- a/sim/iq2000/local.mk
+++ b/sim/iq2000/local.mk
@@ -24,8 +24,9 @@
noinst_PROGRAMS += %D%/run
+## List all generated headers to help Automake dependency tracking.
+BUILT_SOURCES += %D%/eng.h
%C%_BUILD_OUTPUTS = \
- %D%/eng.h \
%D%/mloop.c \
%D%/stamp-mloop
diff --git a/sim/lm32/local.mk b/sim/lm32/local.mk
index bdef055b6e36..3f9606410d62 100644
--- a/sim/lm32/local.mk
+++ b/sim/lm32/local.mk
@@ -27,8 +27,9 @@ noinst_PROGRAMS += %D%/run
%C%_SIM_EXTRA_HW_DEVICES = lm32cpu lm32timer lm32uart
AM_MAKEFLAGS += %C%_SIM_EXTRA_HW_DEVICES="$(%C%_SIM_EXTRA_HW_DEVICES)"
+## List all generated headers to help Automake dependency tracking.
+BUILT_SOURCES += %D%/eng.h
%C%_BUILD_OUTPUTS = \
- %D%/eng.h \
%D%/mloop.c \
%D%/stamp-mloop
diff --git a/sim/m32r/local.mk b/sim/m32r/local.mk
index a5e5d8829a5e..4f9f2bc257dc 100644
--- a/sim/m32r/local.mk
+++ b/sim/m32r/local.mk
@@ -27,14 +27,16 @@ noinst_PROGRAMS += %D%/run
%C%_SIM_EXTRA_HW_DEVICES = m32r_cache m32r_uart
AM_MAKEFLAGS += %C%_SIM_EXTRA_HW_DEVICES="$(%C%_SIM_EXTRA_HW_DEVICES)"
-%C%_BUILD_OUTPUTS = \
+## List all generated headers to help Automake dependency tracking.
+BUILT_SOURCES += \
%D%/eng.h \
+ %D%/engx.h \
+ %D%/eng2.h
+%C%_BUILD_OUTPUTS = \
%D%/mloop.c \
%D%/stamp-mloop \
- %D%/engx.h \
%D%/mloopx.c \
%D%/stamp-mloop-x \
- %D%/eng2.h \
%D%/mloop2.c \
%D%/stamp-mloop-2
diff --git a/sim/mips/local.mk b/sim/mips/local.mk
index b7efc3947dee..fa70edde35b6 100644
--- a/sim/mips/local.mk
+++ b/sim/mips/local.mk
@@ -27,6 +27,8 @@ noinst_PROGRAMS += %D%/run
%C%_SIM_EXTRA_HW_DEVICES = tx3904cpu tx3904irc tx3904tmr tx3904sio
AM_MAKEFLAGS += %C%_SIM_EXTRA_HW_DEVICES="$(%C%_SIM_EXTRA_HW_DEVICES)"
+## List all generated headers to help Automake dependency tracking.
+BUILT_SOURCES += %D%/itable.h
%C%_BUILT_SRC_FROM_IGEN_ITABLE = \
%D%/itable.h \
%D%/itable.c
diff --git a/sim/mn10300/local.mk b/sim/mn10300/local.mk
index de229ec490ee..afb1df75f2ef 100644
--- a/sim/mn10300/local.mk
+++ b/sim/mn10300/local.mk
@@ -27,6 +27,15 @@ noinst_PROGRAMS += %D%/run
%C%_SIM_EXTRA_HW_DEVICES = mn103cpu mn103int mn103tim mn103ser mn103iop
AM_MAKEFLAGS += %C%_SIM_EXTRA_HW_DEVICES="$(%C%_SIM_EXTRA_HW_DEVICES)"
+## List all generated headers to help Automake dependency tracking.
+BUILT_SOURCES += \
+ %D%/icache.h \
+ %D%/idecode.h \
+ %D%/semantics.h \
+ %D%/model.h \
+ %D%/support.h \
+ %D%/itable.h \
+ %D%/engine.h
%C%_BUILT_SRC_FROM_IGEN = \
%D%/icache.h \
%D%/icache.c \
diff --git a/sim/or1k/local.mk b/sim/or1k/local.mk
index b1181434529c..ef8ae2a6abcb 100644
--- a/sim/or1k/local.mk
+++ b/sim/or1k/local.mk
@@ -26,8 +26,9 @@ noinst_PROGRAMS += %D%/run
%C%docdir = $(docdir)/%C%
%C%doc_DATA = %D%/README
+## List all generated headers to help Automake dependency tracking.
+BUILT_SOURCES += %D%/eng.h
%C%_BUILD_OUTPUTS = \
- %D%/eng.h \
%D%/mloop.c \
%D%/stamp-mloop
diff --git a/sim/v850/local.mk b/sim/v850/local.mk
index b2dd5778691d..4741e070a300 100644
--- a/sim/v850/local.mk
+++ b/sim/v850/local.mk
@@ -24,6 +24,15 @@
noinst_PROGRAMS += %D%/run
+## List all generated headers to help Automake dependency tracking.
+BUILT_SOURCES += \
+ %D%/icache.h \
+ %D%/idecode.h \
+ %D%/semantics.h \
+ %D%/model.h \
+ %D%/support.h \
+ %D%/itable.h \
+ %D%/engine.h
%C%_BUILT_SRC_FROM_IGEN = \
%D%/icache.h \
%D%/icache.c \
--
2.39.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-03 3:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-03 3:14 [PATCH] sim: build: move generated headers to built sources 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).