gdbserver Makefile: don't delete intermediary files

Message ID 1504428708-17321-1-git-send-email-simon.marchi@ericsson.com
State New, archived
Headers

Commit Message

Simon Marchi Sept. 3, 2017, 8:51 a.m. UTC
  If you "make" from scratch in gdbserver/, you'll notice that make
deletes the files it considers as intermediary at the end:

  $ make clean && make
  ...
  rm i386-mmx-linux-generated.c x32-avx-avx512-linux-generated.c ...

Then, if you type make again, make will rebuild these files and rebuild
gdbserver.  To avoid this, we can add the .SECONDARY special target.  If
it has no pre-requisites, all intermediary files will be kept.

gdb/gdbservef/ChangeLog:

	* Makefile.in (.SECONDARY): Define target.
---
 gdb/gdbserver/Makefile.in | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Pedro Alves Sept. 4, 2017, 11:34 a.m. UTC | #1
On 09/03/2017 09:51 AM, Simon Marchi wrote:
> If you "make" from scratch in gdbserver/, you'll notice that make
> deletes the files it considers as intermediary at the end:
> 
>   $ make clean && make
>   ...
>   rm i386-mmx-linux-generated.c x32-avx-avx512-linux-generated.c ...
> 
> Then, if you type make again, make will rebuild these files and rebuild
> gdbserver.  

Ah, this has been annoying me for a while.

> To avoid this, we can add the .SECONDARY special target.  If
> it has no pre-requisites, all intermediary files will be kept.
> 
> gdb/gdbservef/ChangeLog:

Typo "gdbservef".

> 
> 	* Makefile.in (.SECONDARY): Define target.

LGTM.

> ---
>  gdb/gdbserver/Makefile.in | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
> index 6cd0959..e43a929 100644
> --- a/gdb/gdbserver/Makefile.in
> +++ b/gdb/gdbserver/Makefile.in
> @@ -632,4 +632,7 @@ endif
>  # Disable implicit make rules.
>  include $(srcdir)/../disable-implicit-rules.mk
>  
> +# Do not delete intermediate files (e.g. *-generated.c).
> +.SECONDARY:
> +
>  # This is the end of "Makefile.in".
> 

Thanks,
Pedro Alves
  
Simon Marchi Sept. 4, 2017, 5:05 p.m. UTC | #2
On 2017-09-04 13:34, Pedro Alves wrote:
> On 09/03/2017 09:51 AM, Simon Marchi wrote:
>> If you "make" from scratch in gdbserver/, you'll notice that make
>> deletes the files it considers as intermediary at the end:
>> 
>>   $ make clean && make
>>   ...
>>   rm i386-mmx-linux-generated.c x32-avx-avx512-linux-generated.c ...
>> 
>> Then, if you type make again, make will rebuild these files and 
>> rebuild
>> gdbserver.
> 
> Ah, this has been annoying me for a while.
> 
>> To avoid this, we can add the .SECONDARY special target.  If
>> it has no pre-requisites, all intermediary files will be kept.
>> 
>> gdb/gdbservef/ChangeLog:
> 
> Typo "gdbservef".

Oops.

>> 
>> 	* Makefile.in (.SECONDARY): Define target.
> 
> LGTM.

Thanks, pushed.

Simon
  

Patch

diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 6cd0959..e43a929 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -632,4 +632,7 @@  endif
 # Disable implicit make rules.
 include $(srcdir)/../disable-implicit-rules.mk
 
+# Do not delete intermediate files (e.g. *-generated.c).
+.SECONDARY:
+
 # This is the end of "Makefile.in".