Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] trailing backslash in top-level Makefile
@ 2009-06-02 16:34 Jerome Guitton
  2009-06-02 18:00 ` Ralf Wildenhues
  0 siblings, 1 reply; 7+ messages in thread
From: Jerome Guitton @ 2009-06-02 16:34 UTC (permalink / raw)
  To: gdb-patches, gcc-patches, binutils

[-- Attachment #1: Type: text/plain, Size: 986 bytes --]


The top-level Makefile.in may generate a trailing backslash at the end
of the target "all" (if gcc-bootstrap is false). Something like that:

[...]
all:
        @: $(MAKE); $(unstage)
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
          $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \

.PHONY: all-build
[...]


On most system, that's fine. However, this is rejected by some shells.
For example, the system bash on some solaris systems:

ostende% bash --version 
GNU bash, version 2.03.0(1)-release (sparc-sun-solaris)
Copyright 1998 Free Software Foundation, Inc.
> bash -c "ls \\"

bash: -c: line 2: syntax error: unexpected end of file

The patch in attachment would fix the problem. It's a little bit ugly
though. "echo" is used as a "nop". Would someone have a better idea to fix
the problem?


2009-06-02  Jerome Guitton  <guitton@adacore.com>

	* Makefile.tpl: Remove a trailing backslash.
	* Makefile.in: Regenerate.


[-- Attachment #2: toplevel.diff --]
[-- Type: text/x-diff, Size: 1200 bytes --]

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/Makefile.in,v
retrieving revision 1.302
diff -u -r1.302 Makefile.in
--- Makefile.in	2 Jun 2009 08:23:45 -0000	1.302
+++ Makefile.in	2 Jun 2009 15:18:31 -0000
@@ -859,11 +859,11 @@
 	  $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
 	else \
 @endif gcc-bootstrap
-	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \
+	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target ; \
 @if gcc-bootstrap
-	    ; \
 	fi
 @endif gcc-bootstrap
+	echo
 
 .PHONY: all-build
 
Index: Makefile.tpl
===================================================================
RCS file: /cvs/src/src/Makefile.tpl,v
retrieving revision 1.206
diff -u -r1.206 Makefile.tpl
--- Makefile.tpl	2 Jun 2009 08:23:45 -0000	1.206
+++ Makefile.tpl	2 Jun 2009 15:18:38 -0000
@@ -625,11 +625,11 @@
 	  $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
 	else \
 @endif gcc-bootstrap
-	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \
+	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target ; \
 @if gcc-bootstrap
-	    ; \
 	fi
 @endif gcc-bootstrap
+	echo
 
 .PHONY: all-build
 [+ FOR build_modules +]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] trailing backslash in top-level Makefile
  2009-06-02 16:34 [RFA] trailing backslash in top-level Makefile Jerome Guitton
@ 2009-06-02 18:00 ` Ralf Wildenhues
  2009-06-02 22:04   ` Ralf Wildenhues
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Ralf Wildenhues @ 2009-06-02 18:00 UTC (permalink / raw)
  To: Jerome Guitton; +Cc: gdb-patches, gcc-patches, binutils

Hello Jerome,

* Jerome Guitton wrote on Tue, Jun 02, 2009 at 06:33:56PM CEST:
> 
> The top-level Makefile.in may generate a trailing backslash at the end
> of the target "all" (if gcc-bootstrap is false). Something like that:

>         @: $(MAKE); $(unstage)
>         @r=`${PWD_COMMAND}`; export r; \
>         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
>           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \

> On most system, that's fine. However, this is rejected by some shells.
> For example, the system bash on some solaris systems:
> 
> ostende% bash --version 
> GNU bash, version 2.03.0(1)-release (sparc-sun-solaris)
> Copyright 1998 Free Software Foundation, Inc.
> > bash -c "ls \\"
> 
> bash: -c: line 2: syntax error: unexpected end of file

Thank you!  I couldn't find this bit of information when last looking
for it; will update the Autoconf manual section about make/shell
portability issues with this.

> The patch in attachment would fix the problem. It's a little bit ugly
> though. "echo" is used as a "nop". Would someone have a better idea to fix
> the problem?

The fix is wrong as it disables transporting a nonzero exit status from
the $(MAKE) command back to the toplevel make.

I suggest this still-untested patch (gimme a couple of hours).

Thanks,
Ralf

	* Makefile.tpl: Avoid a trailing backslash.
	* Makefile.in: Regenerate.

diff --git a/Makefile.tpl b/Makefile.tpl
index f49f3fc..db10e71 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -628,8 +628,9 @@ all:
 	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \
 @if gcc-bootstrap
 	    ; \
-	fi
+	fi \
 @endif gcc-bootstrap
+	&& :
 
 .PHONY: all-build
 [+ FOR build_modules +]


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] trailing backslash in top-level Makefile
  2009-06-02 18:00 ` Ralf Wildenhues
@ 2009-06-02 22:04   ` Ralf Wildenhues
  2009-06-02 22:08     ` DJ Delorie
  2009-06-02 23:16   ` Alexandre Oliva
  2009-06-03  8:44   ` Jerome Guitton
  2 siblings, 1 reply; 7+ messages in thread
From: Ralf Wildenhues @ 2009-06-02 22:04 UTC (permalink / raw)
  To: Jerome Guitton, gdb-patches, gcc-patches, binutils

* Ralf Wildenhues wrote on Tue, Jun 02, 2009 at 08:00:21PM CEST:
> 	* Makefile.tpl: Avoid a trailing backslash.
> 	* Makefile.in: Regenerate.

> --- a/Makefile.tpl
> +++ b/Makefile.tpl
> @@ -628,8 +628,9 @@ all:
>  	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \
>  @if gcc-bootstrap
>  	    ; \
> -	fi
> +	fi \
>  @endif gcc-bootstrap
> +	&& :
>  
>  .PHONY: all-build
>  [+ FOR build_modules +]

This patch seems to fix the issue, and as such: OK to apply to GCC and
src?

All my testing has been casual rather than following the rules, but I
think I've tried out all failure cases in GCC and src.  Bummer there is
no exact opposite of the '@if gcc-bootstrap' switch yet (neither it nor
gcc-no-bootstrap are true for a binutils-only build), it would make for
a more readable rule.  Hmm, maybe we should add one later.

Cheers,
Ralf


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] trailing backslash in top-level Makefile
  2009-06-02 22:04   ` Ralf Wildenhues
@ 2009-06-02 22:08     ` DJ Delorie
  2009-06-03  6:16       ` Ralf Wildenhues
  0 siblings, 1 reply; 7+ messages in thread
From: DJ Delorie @ 2009-06-02 22:08 UTC (permalink / raw)
  To: Ralf Wildenhues
  Cc: Ralf.Wildenhues, guitton, gdb-patches, gcc-patches, binutils


> > --- a/Makefile.tpl
> > +++ b/Makefile.tpl
> > @@ -628,8 +628,9 @@ all:
> >  	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \
> >  @if gcc-bootstrap
> >  	    ; \
> > -	fi
> > +	fi \
> >  @endif gcc-bootstrap
> > +	&& :
> >  
> >  .PHONY: all-build
> >  [+ FOR build_modules +]
> 
> This patch seems to fix the issue, and as such: OK to apply to GCC and
> src?

I'm OK with it.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] trailing backslash in top-level Makefile
  2009-06-02 18:00 ` Ralf Wildenhues
  2009-06-02 22:04   ` Ralf Wildenhues
@ 2009-06-02 23:16   ` Alexandre Oliva
  2009-06-03  8:44   ` Jerome Guitton
  2 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2009-06-02 23:16 UTC (permalink / raw)
  To: Ralf Wildenhues; +Cc: Jerome Guitton, gdb-patches, gcc-patches, binutils

On Jun  2, 2009, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:

>> $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \

Oh, my, so many tries to fix this one small problem :-(  Sorry that I
introduced it and failed to fix it so far.

> 	* Makefile.tpl: Avoid a trailing backslash.
> 	* Makefile.in: Regenerate.

This is ok, thanks.

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] trailing backslash in top-level Makefile
  2009-06-02 22:08     ` DJ Delorie
@ 2009-06-03  6:16       ` Ralf Wildenhues
  0 siblings, 0 replies; 7+ messages in thread
From: Ralf Wildenhues @ 2009-06-03  6:16 UTC (permalink / raw)
  To: DJ Delorie, Alexandre Oliva; +Cc: guitton, gdb-patches, gcc-patches, binutils

* DJ Delorie wrote on Wed, Jun 03, 2009 at 12:07:47AM CEST:
> > This patch seems to fix the issue, and as such: OK to apply to GCC and
> > src?
> 
> I'm OK with it.

* Alexandre Oliva wrote on Wed, Jun 03, 2009 at 01:15:53AM CEST:
> This is ok, thanks.

Pushed, thanks!


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] trailing backslash in top-level Makefile
  2009-06-02 18:00 ` Ralf Wildenhues
  2009-06-02 22:04   ` Ralf Wildenhues
  2009-06-02 23:16   ` Alexandre Oliva
@ 2009-06-03  8:44   ` Jerome Guitton
  2 siblings, 0 replies; 7+ messages in thread
From: Jerome Guitton @ 2009-06-03  8:44 UTC (permalink / raw)
  To: Ralf Wildenhues, gdb-patches, gcc-patches, binutils

Ralf Wildenhues (Ralf.Wildenhues@gmx.de):

> I suggest this still-untested patch (gimme a couple of hours).

I confirm that your patch fixes the problem on my side; thanks!


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-06-03  8:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-02 16:34 [RFA] trailing backslash in top-level Makefile Jerome Guitton
2009-06-02 18:00 ` Ralf Wildenhues
2009-06-02 22:04   ` Ralf Wildenhues
2009-06-02 22:08     ` DJ Delorie
2009-06-03  6:16       ` Ralf Wildenhues
2009-06-02 23:16   ` Alexandre Oliva
2009-06-03  8:44   ` Jerome Guitton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox