[02/10] Introduce stamp file for hw-config.h

Message ID 20210408203312.2938165-3-tom@tromey.com
State New
Headers show
Series
  • sim build improvements
Related show

Commit Message

Tom Tromey April 8, 2021, 8:33 p.m.
This adds a stamp file for hw-config.h, to avoid unnecessary rebuilds.
It also arranges to remove hw-config.h in "mostlyclean", because the
file is created by "make".

2021-04-08  Tom Tromey  <tom@tromey.com>

	* Make-common.in (stamp-hw): New target.
	(hw-config.h): Depend on stamp-hw.
	(mostlyclean): Remove stamp-hw and hw-config.h.
---
 sim/common/ChangeLog      | 6 ++++++
 sim/common/Make-common.in | 7 +++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

-- 
2.26.2

Comments

Tankut Baris Aktemur via Gdb-patches April 9, 2021, 12:25 a.m. | #1
On 08 Apr 2021 14:33, Tom Tromey wrote:
> This adds a stamp file for hw-config.h, to avoid unnecessary rebuilds.

> It also arranges to remove hw-config.h in "mostlyclean", because the

> file is created by "make".


lgtm, thanks
-mike

Patch

diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 34e8d5c5298..f1ebc5e30c7 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -438,7 +438,8 @@  $(all_object_files) : $(generated_files)
 @GMAKE_TRUE@-include $(patsubst %.o, $(DEPDIR)/%.Po, $(all_object_files))
 
 # FIXME This is one very simple-minded way of generating the file hw-config.h
-hw-config.h: Makefile.in $(srccom)/Make-common.in config.status Makefile
+hw-config.h: stamp-hw ; @true
+stamp-hw: Makefile.in $(srccom)/Make-common.in config.status Makefile
 	rm -f tmp-hw.h
 	echo "/* generated by Makefile */" > tmp-hw.h
 	sim_hw="$(SIM_HW)"; \
@@ -452,7 +453,8 @@  hw-config.h: Makefile.in $(srccom)/Make-common.in config.status Makefile
 	done >> tmp-hw.h
 	echo "  NULL," >> tmp-hw.h
 	echo "};" >> tmp-hw.h
-	mv tmp-hw.h hw-config.h
+	$(SHELL) $(srcroot)/move-if-change tmp-hw.h hw-config.h
+	@echo stamp > stamp-hw
 
 test-hw-events: $(srccom)/hw-events.c libsim.a
 	$(CC) $(ALL_CFLAGS) -DMAIN -o test-hw-events$(EXEEXT) \
@@ -507,6 +509,7 @@  TAGS: force
 mostlyclean clean: $(SIM_EXTRA_CLEAN)
 	rm -f *.[oa] *~ core
 	rm -f run$(EXEEXT) libsim.a
+	rm -f hw-config.h stamp-hw
 	rm -f gentmap targ-map.c targ-vals.h stamp-tvals
 	if [ ! -f Make-common.in ] ; then \
 		rm -f $(BUILT_SRC_FROM_COMMON) ; \