[PATCH/submitted,10/10] sim: ppc: move defines.h generation to the top-level

Message ID 20240102053639.28290-10-vapier@gentoo.org
State New
Headers
Series [PATCH/submitted,01/10] sim: ppc: move long long test to top-level |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply

Commit Message

Mike Frysinger Jan. 2, 2024, 5:36 a.m. UTC
  Since we rely on the top-level config.h now, the defines.h generation
step should live here too.
---
 sim/Makefile.in     | 19 +++++++++++++------
 sim/ppc/Makefile.in | 10 ++--------
 sim/ppc/local.mk    |  9 +++++++++
 3 files changed, 24 insertions(+), 14 deletions(-)
  

Patch

diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index 71199fc72ede..2f638b093939 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -489,7 +489,7 @@  PACKAGE_SRC = pk_disklabel.c
 PACKAGE_OBJ = $(PACKAGE_SRC:.c=.o)
 
 
-$(TARGETLIB): tmp-igen tmp-hw tmp-defines $(LIB_OBJ) $(GDB_OBJ)
+$(TARGETLIB): tmp-igen tmp-hw defines.h $(LIB_OBJ) $(GDB_OBJ)
 	$(ECHO_AR) $(AR) $(AR_FLAGS) $(TARGETLIB) $(LIB_OBJ) $(GDB_OBJ)
 	$(ECHO_RANLIB) $(RANLIB) $(TARGETLIB)
 
@@ -562,12 +562,6 @@  sim-fpu.o: $(srcdir)/../common/sim-fpu.c
 options.o: options.c $(CPU_H) $(OPTIONS_H) $(DEFINES_H) $(BASICS_H) $(IDECODE_H) $(INLINE) $(LIB_SRC) $(BUILT_SRC) config.status Makefile
 	$(ECHO_CC) $(CC) -c $(STD_CFLAGS) '-DOPCODE_RULES="@sim_opcode@"' '-DIGEN_FLAGS="$(IGEN_FLAGS)"' $(srcdir)/options.c
 
-defines.h: tmp-defines; @true
-tmp-defines: Makefile
-	$(ECHO_GEN) sed -n -e '/^#define HAVE_/s/ 1$$/",/' -e '/^#define HAVE_/s//"HAVE_/p' < ../config.h > tmp-defines.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-defines.h defines.h
-	$(SILENCE) touch $@
-
 #
 # Rules to create the built c source code files
 #
@@ -685,7 +679,7 @@  clean mostlyclean:
 	rm -f tmp-* *.[oasi] core $(BUILT_SRC_WO_CONFIG)
 
 distclean realclean: clean
-	rm -f TAGS Makefile config.cache config.status defines.h stamp-h config.log
+	rm -f TAGS Makefile config.cache config.status stamp-h config.log
 
 maintainer-clean: distclean
 	rm -f *~ *.log core *.core
diff --git a/sim/ppc/local.mk b/sim/ppc/local.mk
index 8bcc7e7b9c39..e2d6197f5dd2 100644
--- a/sim/ppc/local.mk
+++ b/sim/ppc/local.mk
@@ -33,6 +33,15 @@  SIM_ALL_RECURSIVE_DEPS += common/libcommon.a
 
 noinst_PROGRAMS += %D%/run
 
+SIM_ALL_RECURSIVE_DEPS += %D%/defines.h
+%D%/defines.h: %D%/stamp-defines ; @true
+%D%/stamp-defines: config.h Makefile
+	$(AM_V_GEN)sed -n -e '/^#define HAVE_/s/ 1$$/",/' -e '/^#define HAVE_/s//"HAVE_/p' < config.h > %D%/defines.hin
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/defines.hin %D%/defines.h
+	$(AM_V_at)touch $@
+
+MOSTLYCLEANFILES += %D%/defines.h %D%/stamp-defines
+
 %D%/spreg.c: @MAINT@ %D%/ppc-spr-table %D%/spreg-gen.py %D%/$(am__dirstamp)
 	$(AM_V_GEN)$(srcdir)/%D%/spreg-gen.py --source $@.tmp
 	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change $@.tmp $(srcdir)/%D%/spreg.c