* [PATCH/committed] sim: touch modules target @ 2021-05-08 16:35 Mike Frysinger via Gdb-patches 2021-05-08 20:49 ` Tom Tromey 0 siblings, 1 reply; 7+ messages in thread From: Mike Frysinger via Gdb-patches @ 2021-05-08 16:35 UTC (permalink / raw) To: gdb-patches If there are no updates to the file, touch the result so we don't keep trying to regenerate it. --- sim/common/ChangeLog | 4 ++++ sim/common/Make-common.in | 1 + 2 files changed, 5 insertions(+) diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 1c0e44f2c1de..4fb31af3b182 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,7 @@ +2021-05-08 Mike Frysinger <vapier@gentoo.org> + + * Make-common.in (modules.c): Touch $@ at the end. + 2021-05-08 Mike Frysinger <vapier@gentoo.org> * cgen-trace.c (sim_cgen_disassemble_insn): Change %x to PRIxTA. diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in index 4edc54ca40e0..56b36b235721 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -481,6 +481,7 @@ modules.c: Makefile $(SIM_OBJS:.o=.c) ) >$@.tmp $(SHELL) $(srcroot)/move-if-change $@.tmp $@ @rm -f $@.l-tmp $@.tmp + touch $@ # CGEN support. -- 2.31.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH/committed] sim: touch modules target 2021-05-08 16:35 [PATCH/committed] sim: touch modules target Mike Frysinger via Gdb-patches @ 2021-05-08 20:49 ` Tom Tromey 2021-05-09 19:56 ` Mike Frysinger via Gdb-patches 2021-06-15 0:39 ` [PATCH] sim: switch modules.c & version.c to stamp files Mike Frysinger via Gdb-patches 0 siblings, 2 replies; 7+ messages in thread From: Tom Tromey @ 2021-05-08 20:49 UTC (permalink / raw) To: Mike Frysinger via Gdb-patches >>>>> "Mike" == Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> writes: Mike> If there are no updates to the file, touch the result so we don't Mike> keep trying to regenerate it. Normally you don't want to do it this way. I think it will result in recompilations if the inputs change but the output does not. Since it depends on Makefile and all the source files, this may be pretty often. Now, if that's ok with you, it's simpler to just replace the move-if-change with a $(MV). The more common approach is to use a stamp file. So you write: modules.c: modules-c-stamp ; @true modules-c-stamp: ... the existing code, but also touch modules-c-stamp There are a few examples of this idiom already in the tree. hw-config.h uses this, in the same file. You'd also want to add the stamp file to the clean rule. Tom ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH/committed] sim: touch modules target 2021-05-08 20:49 ` Tom Tromey @ 2021-05-09 19:56 ` Mike Frysinger via Gdb-patches 2021-06-15 0:39 ` [PATCH] sim: switch modules.c & version.c to stamp files Mike Frysinger via Gdb-patches 1 sibling, 0 replies; 7+ messages in thread From: Mike Frysinger via Gdb-patches @ 2021-05-09 19:56 UTC (permalink / raw) To: Tom Tromey; +Cc: Mike Frysinger via Gdb-patches On 08 May 2021 14:49, Tom Tromey wrote: > >>>>> "Mike" == Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> writes: > > Mike> If there are no updates to the file, touch the result so we don't > Mike> keep trying to regenerate it. > > Normally you don't want to do it this way. I think it will result in > recompilations if the inputs change but the output does not. Since it > depends on Makefile and all the source files, this may be pretty often. > > Now, if that's ok with you, it's simpler to just replace the > move-if-change with a $(MV). > > The more common approach is to use a stamp file. So you write: > > modules.c: modules-c-stamp ; @true > modules-c-stamp: ... the existing code, but also touch modules-c-stamp > > There are a few examples of this idiom already in the tree. hw-config.h > uses this, in the same file. You'd also want to add the stamp file to > the clean rule. thanks, i'll take a look. i was trying trying to figure out how to use this thing correctly to avoid the rebuilds. -mike ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] sim: switch modules.c & version.c to stamp files 2021-05-08 20:49 ` Tom Tromey 2021-05-09 19:56 ` Mike Frysinger via Gdb-patches @ 2021-06-15 0:39 ` Mike Frysinger via Gdb-patches 2021-06-15 20:08 ` Tom Tromey 1 sibling, 1 reply; 7+ messages in thread From: Mike Frysinger via Gdb-patches @ 2021-06-15 0:39 UTC (permalink / raw) To: gdb-patches This fixes remaking of these files and avoids unnecessary rebuilds. --- sim/Makefile.in | 5 +++-- sim/common/Make-common.in | 5 +++-- sim/common/local.mk | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in index 3dab9ca1fd14..cd50ad03e7e6 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -465,7 +465,8 @@ test-hw-events: $(srccom)/hw-events.c libsim.a $(srccom)/hw-events.c libsim.a $(EXTRA_LIBS) # See sim_pre_argv_init and sim_module_install in sim-module.c for more details. -modules.c: Makefile $(SIM_OBJS:.o=.c) +modules.c: stamp-modules ; @true +stamp-modules: Makefile $(SIM_OBJS:.o=.c) @echo Generating $@ @LANG=C ; export LANG ; \ LC_ALL=C ; export LC_ALL ; \ @@ -481,7 +482,7 @@ modules.c: Makefile $(SIM_OBJS:.o=.c) echo '};'; \ echo 'const int sim_modules_detected_len = ARRAY_SIZE (sim_modules_detected);'; \ ) >$@.tmp - $(SHELL) $(srcroot)/move-if-change $@.tmp $@ + $(SHELL) $(srcroot)/move-if-change $@.tmp modules.c @rm -f $@.l-tmp $@.tmp touch $@ diff --git a/sim/common/local.mk b/sim/common/local.mk index fc1149789a3c..01fb02750e89 100644 --- a/sim/common/local.mk +++ b/sim/common/local.mk @@ -38,7 +38,8 @@ noinst_LIBRARIES += %D%/libcommon.a %D%/sim-load.c \ %D%/version.c -%D%/version.c: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcdir)/%D%/create-version.sh +%D%/version.c: %D%/version.c-stamp ; @true +%D%/version.c-stamp: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcdir)/%D%/create-version.sh $(AM_V_GEN)$(SHELL) $(srcdir)/%D%/create-version.sh $(srcroot)/gdb $@.tmp - $(AM_V_at)$(SHELL) $(srcroot)/move-if-change $@.tmp $@ + $(AM_V_at)$(SHELL) $(srcroot)/move-if-change $@.tmp $(@:-stamp=) $(AM_V_at)touch $@ -- 2.31.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sim: switch modules.c & version.c to stamp files 2021-06-15 0:39 ` [PATCH] sim: switch modules.c & version.c to stamp files Mike Frysinger via Gdb-patches @ 2021-06-15 20:08 ` Tom Tromey 2021-06-15 21:01 ` Mike Frysinger via Gdb-patches 2021-06-15 21:07 ` [PATCH v2] " Mike Frysinger via Gdb-patches 0 siblings, 2 replies; 7+ messages in thread From: Tom Tromey @ 2021-06-15 20:08 UTC (permalink / raw) To: Mike Frysinger via Gdb-patches >>>>> "Mike" == Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> writes: Mike> This fixes remaking of these files and avoids unnecessary rebuilds. Mike> # See sim_pre_argv_init and sim_module_install in sim-module.c for more details. Mike> -modules.c: Makefile $(SIM_OBJS:.o=.c) Mike> +modules.c: stamp-modules ; @true Mike> +stamp-modules: Makefile $(SIM_OBJS:.o=.c) I didn't look at how the .c file is handled, but if 'make clean' removes it, then it ought to remove the stamp file as well. Tom ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sim: switch modules.c & version.c to stamp files 2021-06-15 20:08 ` Tom Tromey @ 2021-06-15 21:01 ` Mike Frysinger via Gdb-patches 2021-06-15 21:07 ` [PATCH v2] " Mike Frysinger via Gdb-patches 1 sibling, 0 replies; 7+ messages in thread From: Mike Frysinger via Gdb-patches @ 2021-06-15 21:01 UTC (permalink / raw) To: Tom Tromey; +Cc: Mike Frysinger via Gdb-patches On 15 Jun 2021 14:08, Tom Tromey wrote: > >>>>> "Mike" == Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> writes: > > Mike> This fixes remaking of these files and avoids unnecessary rebuilds. > > Mike> # See sim_pre_argv_init and sim_module_install in sim-module.c for more details. > Mike> -modules.c: Makefile $(SIM_OBJS:.o=.c) > Mike> +modules.c: stamp-modules ; @true > Mike> +stamp-modules: Makefile $(SIM_OBJS:.o=.c) > > I didn't look at how the .c file is handled, but if 'make clean' removes > it, then it ought to remove the stamp file as well. neither are in the clean target atm. going by the standards page, it sounds like they should. https://www.gnu.org/prep/standards/standards.html#Standard-Targets -mike ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] sim: switch modules.c & version.c to stamp files 2021-06-15 20:08 ` Tom Tromey 2021-06-15 21:01 ` Mike Frysinger via Gdb-patches @ 2021-06-15 21:07 ` Mike Frysinger via Gdb-patches 1 sibling, 0 replies; 7+ messages in thread From: Mike Frysinger via Gdb-patches @ 2021-06-15 21:07 UTC (permalink / raw) To: gdb-patches This fixes remaking of these files and avoids unnecessary rebuilds. Also add both to `make clean` to match other stamp files. --- sim/ChangeLog | 4 ++++ sim/Makefile.in | 8 +++++--- sim/common/ChangeLog | 7 +++++++ sim/common/Make-common.in | 6 ++++-- sim/common/local.mk | 8 ++++++-- 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/sim/ChangeLog b/sim/ChangeLog index 8df4fde31aac..79e9656f36d1 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,3 +1,7 @@ +2021-06-15 Mike Frysinger <vapier@gentoo.org> + + * Makefile.in: Regenerate. + 2021-06-14 Mike Frysinger <vapier@gentoo.org> * configure.ac: Call AM_SILENT_RULES. diff --git a/sim/Makefile.in b/sim/Makefile.in index b5a2c2608dbc..3ba80a463812 100644 --- a/sim/Makefile.in +++ b/sim/Makefile.in @@ -730,7 +730,8 @@ AM_MAKEFLAGS = SIM_PRIMARY_TARGET=$(SIM_PRIMARY_TARGET) # NB: libcommon.a isn't used directly by ports. We need a target for common # objects to be a part of, and ports use the individual objects directly. noinst_LIBRARIES = common/libcommon.a $(am__append_2) -CLEANFILES = testsuite/common/bits-gen testsuite/common/bits32m0.c \ +CLEANFILES = common/version.c common/version.c-stamp \ + testsuite/common/bits-gen testsuite/common/bits32m0.c \ testsuite/common/bits32m31.c testsuite/common/bits64m0.c \ testsuite/common/bits64m63.c DISTCLEANFILES = @@ -1584,9 +1585,10 @@ nltvals: $(abs_srcdir)/common/gennltvals.py --cpp "$(CPP)" --output nltvals.def --srcroot $(srcroot) $(SHELL) $(srcroot)/move-if-change nltvals.def $(abs_srcdir)/common/nltvals.def -common/version.c: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcdir)/common/create-version.sh +common/version.c: common/version.c-stamp ; @true +common/version.c-stamp: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcdir)/common/create-version.sh $(AM_V_GEN)$(SHELL) $(srcdir)/common/create-version.sh $(srcroot)/gdb $@.tmp - $(AM_V_at)$(SHELL) $(srcroot)/move-if-change $@.tmp $@ + $(AM_V_at)$(SHELL) $(srcroot)/move-if-change $@.tmp $(@:-stamp=) $(AM_V_at)touch $@ # Alias for developers. diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 14914dc04169..7e2170314ae7 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,10 @@ +2021-06-15 Mike Frysinger <vapier@gentoo.org> + + * Make-common.in: Add stamp-modules rule to avoid rebuilds. + (clean): Delete modules.c files. + * local.mk: Add version.c-stamp rule to avoid rebuilds. + (CLEANFILES): Add version.c files. + 2021-06-14 Mike Frysinger <vapier@gentoo.org> * local.mk (%D%/version.c): Use AM_V_GEN & AM_V_at wrappers. diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in index 3dab9ca1fd14..12fb233c5ee4 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -465,7 +465,8 @@ test-hw-events: $(srccom)/hw-events.c libsim.a $(srccom)/hw-events.c libsim.a $(EXTRA_LIBS) # See sim_pre_argv_init and sim_module_install in sim-module.c for more details. -modules.c: Makefile $(SIM_OBJS:.o=.c) +modules.c: stamp-modules ; @true +stamp-modules: Makefile $(SIM_OBJS:.o=.c) @echo Generating $@ @LANG=C ; export LANG ; \ LC_ALL=C ; export LC_ALL ; \ @@ -481,7 +482,7 @@ modules.c: Makefile $(SIM_OBJS:.o=.c) echo '};'; \ echo 'const int sim_modules_detected_len = ARRAY_SIZE (sim_modules_detected);'; \ ) >$@.tmp - $(SHELL) $(srcroot)/move-if-change $@.tmp $@ + $(SHELL) $(srcroot)/move-if-change $@.tmp modules.c @rm -f $@.l-tmp $@.tmp touch $@ @@ -543,6 +544,7 @@ mostlyclean clean: $(SIM_EXTRA_CLEAN) rm -f *.[oa] *~ core rm -f run$(EXEEXT) libsim.a rm -f hw-config.h stamp-hw + rm -f modules.c stamp-modules rm -f gentmap targ-map.c targ-vals.h stamp-tvals if [ ! -f Make-common.in ] ; then \ rm -f $(BUILT_SRC_FROM_COMMON) ; \ diff --git a/sim/common/local.mk b/sim/common/local.mk index fc1149789a3c..25c7e5beb1f9 100644 --- a/sim/common/local.mk +++ b/sim/common/local.mk @@ -38,7 +38,11 @@ noinst_LIBRARIES += %D%/libcommon.a %D%/sim-load.c \ %D%/version.c -%D%/version.c: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcdir)/%D%/create-version.sh +%D%/version.c: %D%/version.c-stamp ; @true +%D%/version.c-stamp: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcdir)/%D%/create-version.sh $(AM_V_GEN)$(SHELL) $(srcdir)/%D%/create-version.sh $(srcroot)/gdb $@.tmp - $(AM_V_at)$(SHELL) $(srcroot)/move-if-change $@.tmp $@ + $(AM_V_at)$(SHELL) $(srcroot)/move-if-change $@.tmp $(@:-stamp=) $(AM_V_at)touch $@ + +CLEANFILES += \ + %D%/version.c %D%/version.c-stamp -- 2.31.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-06-15 21:07 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-05-08 16:35 [PATCH/committed] sim: touch modules target Mike Frysinger via Gdb-patches 2021-05-08 20:49 ` Tom Tromey 2021-05-09 19:56 ` Mike Frysinger via Gdb-patches 2021-06-15 0:39 ` [PATCH] sim: switch modules.c & version.c to stamp files Mike Frysinger via Gdb-patches 2021-06-15 20:08 ` Tom Tromey 2021-06-15 21:01 ` Mike Frysinger via Gdb-patches 2021-06-15 21:07 ` [PATCH v2] " Mike Frysinger via Gdb-patches
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox