From b22ee0e49ba2bac8a5295f0426c62e9bd2b311a1 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 2 Jan 2024 02:18:53 -0500 Subject: [PATCH] sim: ppc: hoist pk.h creation to top-level --- sim/Makefile.in | 22 ++++++++++++++++++++-- sim/ppc/Makefile.in | 37 +++++-------------------------------- sim/ppc/local.mk | 24 ++++++++++++++++++++++++ sim/ppc/pk.h | 2 +- 4 files changed, 50 insertions(+), 35 deletions(-) diff --git a/sim/Makefile.in b/sim/Makefile.in index a60c64050a2..98cf2df4f3d 100644 --- a/sim/Makefile.in +++ b/sim/Makefile.in @@ -281,7 +281,7 @@ TESTS = testsuite/common/bits32m0$(EXEEXT) \ @SIM_ENABLE_ARCH_or1k_TRUE@am__append_88 = $(or1k_BUILD_OUTPUTS) @SIM_ENABLE_ARCH_ppc_TRUE@am__append_89 = common/libcommon.a \ @SIM_ENABLE_ARCH_ppc_TRUE@ ppc/defines.h ppc/stamp-igen \ -@SIM_ENABLE_ARCH_ppc_TRUE@ ppc/stamp-hw +@SIM_ENABLE_ARCH_ppc_TRUE@ ppc/stamp-hw ppc/stamp-pk @SIM_ENABLE_ARCH_ppc_TRUE@am__append_90 = ppc/run @SIM_ENABLE_ARCH_ppc_TRUE@am__append_91 = ppc/defines.h \ @SIM_ENABLE_ARCH_ppc_TRUE@ ppc/stamp-defines \ @@ -2987,7 +2987,7 @@ testsuite_common_CPPFLAGS = \ @SIM_ENABLE_ARCH_ppc_TRUE@ppc_BUILD_OUTPUTS = \ @SIM_ENABLE_ARCH_ppc_TRUE@ $(ppc_BUILT_SRC_FROM_IGEN) \ @SIM_ENABLE_ARCH_ppc_TRUE@ ppc/stamp-igen ppc/hw.c ppc/hw.h \ -@SIM_ENABLE_ARCH_ppc_TRUE@ ppc/stamp-hw +@SIM_ENABLE_ARCH_ppc_TRUE@ ppc/stamp-hw ppc/stamp-pk @SIM_ENABLE_ARCH_ppc_TRUE@ppc_IGEN_OPCODE_RULES = ppc/@sim_ppc_opcode@ @SIM_ENABLE_ARCH_ppc_TRUE@ppc_filter_SOURCES = @SIM_ENABLE_ARCH_ppc_TRUE@ppc_filter_LDADD = ppc/filter-main.o ppc/libigen.a @@ -3006,6 +3006,7 @@ testsuite_common_CPPFLAGS = \ @SIM_ENABLE_ARCH_ppc_TRUE@IGEN_OPCODE_RULES = @sim_ppc_opcode@ @SIM_ENABLE_ARCH_ppc_TRUE@ppc_HW_SRC = $(sim_ppc_hw_src:%=ppc/%) +@SIM_ENABLE_ARCH_ppc_TRUE@ppc_PACKAGE_SRC = ppc/pk_disklabel.c @SIM_ENABLE_ARCH_ppc_TRUE@ppcdocdir = $(docdir)/ppc @SIM_ENABLE_ARCH_ppc_TRUE@ppcdoc_DATA = ppc/BUGS ppc/INSTALL ppc/README ppc/RUN @SIM_ENABLE_ARCH_pru_TRUE@nodist_pru_libsim_a_SOURCES = \ @@ -5885,6 +5886,23 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo @SIM_ENABLE_ARCH_ppc_TRUE@ $(AM_V_at)$(SHELL) $(srcroot)/move-if-change ppc/hw.cin ppc/hw.c @SIM_ENABLE_ARCH_ppc_TRUE@ $(AM_V_at)touch $@ @SIM_ENABLE_ARCH_ppc_TRUE@ppc/hw.c ppc/hw.h: ppc/stamp-igen +@SIM_ENABLE_ARCH_ppc_TRUE@$(srcdir)/ppc/pk.h: @MAINT@ ppc/stamp-pk ; @true +@SIM_ENABLE_ARCH_ppc_TRUE@ppc/stamp-pk: $(srcdir)/ppc/Makefile.in $(ppc_PACKAGE_SRC) $(srcroot)/move-if-change +@SIM_ENABLE_ARCH_ppc_TRUE@ $(AM_V_GEN)echo "/* Generated file by local.mk; do not edit. */" > ppc/pk.hin; \ +@SIM_ENABLE_ARCH_ppc_TRUE@ f=""; \ +@SIM_ENABLE_ARCH_ppc_TRUE@ for i in $(ppc_PACKAGE_SRC) ; do \ +@SIM_ENABLE_ARCH_ppc_TRUE@ case " $$f " in \ +@SIM_ENABLE_ARCH_ppc_TRUE@ *" $$i "*) ;; \ +@SIM_ENABLE_ARCH_ppc_TRUE@ *) f="$$f $$i" ;; \ +@SIM_ENABLE_ARCH_ppc_TRUE@ esac ; \ +@SIM_ENABLE_ARCH_ppc_TRUE@ done ; \ +@SIM_ENABLE_ARCH_ppc_TRUE@ for pk in $$f ; do echo $$pk ; done \ +@SIM_ENABLE_ARCH_ppc_TRUE@ | sed -e 's/^.*pk_\(.*\)\.c/\1/' \ +@SIM_ENABLE_ARCH_ppc_TRUE@ -e 's/^/extern package_create_instance_callback pk_/' \ +@SIM_ENABLE_ARCH_ppc_TRUE@ -e 's/$$/_create_instance;/' \ +@SIM_ENABLE_ARCH_ppc_TRUE@ >> ppc/pk.hin +@SIM_ENABLE_ARCH_ppc_TRUE@ $(AM_V_at)$(SHELL) $(srcroot)/move-if-change ppc/pk.hin $(srcdir)/ppc/pk.h +@SIM_ENABLE_ARCH_ppc_TRUE@ $(AM_V_at)touch $@ @SIM_ENABLE_ARCH_pru_TRUE@$(pru_libsim_a_OBJECTS) $(pru_libsim_a_LIBADD): pru/hw-config.h @SIM_ENABLE_ARCH_pru_TRUE@pru/modules.o: pru/modules.c diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in index ed3185f399d..68be5559749 100644 --- a/sim/ppc/Makefile.in +++ b/sim/ppc/Makefile.in @@ -361,12 +361,6 @@ INLINE = \ inline.h \ inline.c -BUILT_SRC_WO_CONFIG = \ - pk.h - -BUILT_SRC = \ - $(BUILT_SRC_WO_CONFIG) - LIB_INLINE_SRC = \ psim.c \ bits.c \ @@ -483,7 +477,7 @@ interrupts.o: interrupts.c $(CPU_H) $(IDECODE_H) $(OS_EMUL_H) # Given that inlines are turned on now, rebuild idecode whenever # anything changes. -idecode.o: idecode.c $(CPU_H) $(IDECODE_H) $(SEMANTICS_H) $(LIB_INLINE_SRC) $(BUILT_SRC) +idecode.o: idecode.c $(CPU_H) $(IDECODE_H) $(SEMANTICS_H) $(LIB_INLINE_SRC) # double.o: double.c dp-bit.c @@ -525,7 +519,7 @@ sim-fpu.o: $(srcdir)/../common/sim-fpu.c $(ECHO_CC) $(CC) -c $(STD_CFLAGS) -DHAVE_CONFIG_H $(srcdir)/../common/sim-fpu.c # Rebuild options whenever something changes so the date/time is up to date. -options.o: options.c $(CPU_H) $(OPTIONS_H) $(DEFINES_H) $(BASICS_H) $(IDECODE_H) $(INLINE) $(LIB_SRC) $(BUILT_SRC) ../config.status Makefile +options.o: options.c $(CPU_H) $(OPTIONS_H) $(DEFINES_H) $(BASICS_H) $(IDECODE_H) $(INLINE) $(LIB_SRC) ../config.status Makefile $(ECHO_CC) $(CC) -c $(STD_CFLAGS) '-DOPCODE_RULES="@sim_ppc_opcode@"' '-DIGEN_FLAGS="$(ppc_IGEN_FLAGS)"' $(srcdir)/options.c hw_cpu.o: hw_cpu.c $(DEVICE_TABLE_H) $(HW_CPU_H) $(INTERRUPTS_H) $(CPU_H) @@ -552,27 +546,6 @@ hw_vm.o: hw_vm.c $(DEVICE_TABLE_H) $(CPU_H) -# real packages -$(srcdir)/pk.h: $(MAINT) tmp-pk - @true -tmp-pk: $(srcdir)/Makefile.in $(PACKAGE_SRC) $(srcroot)/move-if-change - $(ECHO_GEN)# The first for loop is to remove duplicates. - $(SILENCE) echo "/* Generated file by Makefile.in; do not edit. */" > tmp-pk.h; \ - f=""; \ - for i in $(PACKAGE_SRC) ; do \ - case " $$f " in \ - *" $$i "*) ;; \ - *) f="$$f $$i" ;; \ - esac ; \ - done ; \ - for pk in $$f ; do echo $$pk ; done \ - | sed -e 's/^.*pk_\(.*\)\.c/\1/' \ - -e 's/^/extern package_create_instance_callback pk_/' \ - -e 's/$$/_create_instance;/' \ - >> tmp-pk.h - $(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-pk.h $(srcdir)/pk.h - $(SILENCE) touch $@ - pk_disklabel.o: pk_disklabel.c $(DEVICE_TABLE_H) $(PK_H) # ignore this line, it stops make from getting confused @@ -580,11 +553,11 @@ pk_disklabel.o: pk_disklabel.c $(DEVICE_TABLE_H) $(PK_H) tags etags: TAGS -TAGS: $(BUILT_SRC) - etags $(srcdir)/*.h $(srcdir)/*.c $(BUILT_SRC) +TAGS: + etags $(srcdir)/*.h $(srcdir)/*.c clean mostlyclean: - rm -f tmp-* *.[oasi] core $(BUILT_SRC_WO_CONFIG) + rm -f tmp-* *.[oasi] core distclean realclean: clean rm -f TAGS Makefile diff --git a/sim/ppc/local.mk b/sim/ppc/local.mk index 7d4ea357c30..155d83a9470 100644 --- a/sim/ppc/local.mk +++ b/sim/ppc/local.mk @@ -220,5 +220,29 @@ BUILT_SOURCES += \ SIM_ALL_RECURSIVE_DEPS += %D%/stamp-hw %D%/hw.c %D%/hw.h: %D%/stamp-igen +## Real packages +## NB: The first for loop is to remove duplicates. +%C%_PACKAGE_SRC = %D%/pk_disklabel.c +$(srcdir)/%D%/pk.h: @MAINT@ %D%/stamp-pk ; @true +%D%/stamp-pk: $(srcdir)/%D%/Makefile.in $(%C%_PACKAGE_SRC) $(srcroot)/move-if-change + $(AM_V_GEN)echo "/* Generated file by local.mk; do not edit. */" > %D%/pk.hin; \ + f=""; \ + for i in $(%C%_PACKAGE_SRC) ; do \ + case " $$f " in \ + *" $$i "*) ;; \ + *) f="$$f $$i" ;; \ + esac ; \ + done ; \ + for pk in $$f ; do echo $$pk ; done \ + | sed -e 's/^.*pk_\(.*\)\.c/\1/' \ + -e 's/^/extern package_create_instance_callback pk_/' \ + -e 's/$$/_create_instance;/' \ + >> %D%/pk.hin + $(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/pk.hin $(srcdir)/%D%/pk.h + $(AM_V_at)touch $@ + +%C%_BUILD_OUTPUTS += %D%/stamp-pk +SIM_ALL_RECURSIVE_DEPS += %D%/stamp-pk + %C%docdir = $(docdir)/%C% %C%doc_DATA = %D%/BUGS %D%/INSTALL %D%/README %D%/RUN diff --git a/sim/ppc/pk.h b/sim/ppc/pk.h index 92e49e9e8a4..2a672047378 100644 --- a/sim/ppc/pk.h +++ b/sim/ppc/pk.h @@ -1,2 +1,2 @@ -/* Generated file by Makefile.in; do not edit. */ +/* Generated file by local.mk; do not edit. */ extern package_create_instance_callback pk_disklabel_create_instance;