Patchwork [1/3] Update create-version.sh to use common/version.h

login
register
mail settings
Submitter Tom Tromey
Date Jan. 26, 2019, 4:04 a.m.
Message ID <87pnskm5dp.fsf@tromey.com>
Download mbox | patch
Permalink /patch/31216/
State New
Headers show

Comments

Tom Tromey - Jan. 26, 2019, 4:04 a.m.
>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

Tom> How about just copying create-version.sh to sim/common and having it use
Tom> the old #include "version.h"?  Then the two scripts can evolve in their
Tom> own ways as needed, without worrying.

Like this.

Tom
Simon Marchi - Jan. 26, 2019, 4:41 a.m.
On 2019-01-25 23:04, Tom Tromey wrote:
>>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:
> 
> Tom> How about just copying create-version.sh to sim/common and having 
> it use
> Tom> the old #include "version.h"?  Then the two scripts can evolve in 
> their
> Tom> own ways as needed, without worrying.
> 
> Like this.

This is fine with me, but the diff below is weird.  It modifies 
sim/common/create-version.sh, which doesn't exist in master currently.  
And if I apply it with "git am -3", then gdb/common/create-version.sh 
gets modified...

Simon
Tom Tromey - Jan. 26, 2019, 5:03 a.m.
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:

Simon> This is fine with me, but the diff below is weird.  It modifies
Simon> sim/common/create-version.sh, which doesn't exist in master currently.
Simon> And if I apply it with "git am -3", then gdb/common/create-version.sh
Simon> gets modified...

I forgot that I had to "git diff HEAD" instead of just "git diff".
I usually wish the index didn't exist.

Anyway, it's just a copy of the gdb one, then with that patch.
I'll re-send it before I check it in.

Tom

Patch

diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index c05b535237..945a1faba2 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,8 @@ 
+2019-01-25  Tom Tromey  <tom@tromey.com>
+
+	* Make-common.in (version.c): Use sim's create-version.sh.
+	* create-version.sh: New file.
+
 2019-01-16  Pavel I. Kryukov  <kryukov@frtk.ru>
 
 	* sim-arange.c (DEFINE_INLINE_P, DEFINE_NON_INLINE_P): Remove.
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index b211e16baa..1a3bcc9417 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -289,8 +289,8 @@  stamp-tvals: gentmap
 	$(SHELL) $(srcroot)/move-if-change tmp-tmap.c targ-map.c
 	touch stamp-tvals
 
-version.c: Makefile $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcroot)/gdb/common/create-version.sh
-	$(SHELL) $(srcroot)/gdb/common/create-version.sh $(srcroot)/gdb \
+version.c: Makefile $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcroot)/sim/common/create-version.sh
+	$(SHELL) $(srcroot)/sim/common/create-version.sh $(srcroot)/gdb \
 	    $(host_alias) $(target_alias) version.c
 
 #
diff --git a/sim/common/create-version.sh b/sim/common/create-version.sh
index 6e67a61357..51cffe8db5 100755
--- a/sim/common/create-version.sh
+++ b/sim/common/create-version.sh
@@ -30,7 +30,7 @@  output="$4"
 rm -f version.c-tmp $output version.tmp
 date=`sed -n -e 's/^.* BFD_VERSION_DATE \(.*\)$/\1/p' $srcdir/../bfd/version.h`
 sed -e "s/DATE/$date/" < $srcdir/version.in > version.tmp
-echo '#include "common/version.h"' >> version.c-tmp
+echo '#include "version.h"' >> version.c-tmp
 echo 'const char version[] = "'"`sed q version.tmp`"'";' >> version.c-tmp
 echo 'const char host_name[] = "'"$host_alias"'";' >> version.c-tmp
 echo 'const char target_name[] = "'"$target_alias"'";' >> version.c-tmp
diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog
index 8ecdab8a77..171546734b 100644
--- a/sim/ppc/ChangeLog
+++ b/sim/ppc/ChangeLog
@@ -1,3 +1,7 @@ 
+2019-01-25  Tom Tromey  <tom@tromey.com>
+
+	* Makefile.in (version.c): Use sim's create-version.sh.
+
 2018-05-09  Sebastian Rasmussen  <sebras@gmail.com>
 
 	* e500_registers.h: Comment typo fix.
diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index 1635e01c49..fb5a6bd21e 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -548,8 +548,8 @@  $(TARGETLIB): tmp-igen tmp-dgen tmp-hw tmp-pk tmp-defines $(LIB_OBJ) $(GDB_OBJ)
 	$(AR) $(AR_FLAGS) $(TARGETLIB) $(LIB_OBJ) $(GDB_OBJ)
 	$(RANLIB) $(TARGETLIB)
 
-version.c: Makefile $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcroot)/gdb/common/create-version.sh
-	$(SHELL) $(srcroot)/gdb/common/create-version.sh $(srcroot)/gdb \
+version.c: Makefile $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcroot)/sim/common/create-version.sh
+	$(SHELL) $(srcroot)/sim/common/create-version.sh $(srcroot)/gdb \
 	    $(host_alias) $(target_alias) version.c
 version.o: version.c $(version_h)