Re: echo inside Makefile

2007-11-24 Thread Oleg Goldshmidt
Oron Peled <[EMAIL PROTECTED]> writes:

> The correctness of you assertion greatly depends on which "those" you mean.
> Sunos (which was the dominant Unix throughout the 80's and the beginning
> of the 90's) had /bin/csh as default. BTW, this explains how some parts
> in the academic world got the weird idea of teaching scripting in
> csh.

I thought Bourne sh was the installation default on SunOS, too. It
certainly predates csh. However, csh was originally written by Bill
Joy, if memopry serves, so it well may be that it was the default on
SunOS. I'll trust your memory more than mine.

Does the Single UNIX Specification mandate that Bourne sh be present
on compliant systems? Google shows Wikipedia
(http://en.wikipedia.org/wiki/Single_UNIX_Specification) as the first
hit (rather than the SPec itself, curiously), and the article says so.

I suspect that

http://www.opengroup.org/onlinepubs/009695399/utilities/echo.html

is the definitive document regarding echo. To quote:

"Implementations shall not support any options."

"It is not possible to use echo portably across all POSIX systems
unless both -n (as the first argument) and escape sequences are
omitted."

"New applications are encouraged to use printf instead of echo."

>> b) consider #!/bin/bash even for portable code (restricting it to
>> systems with bash installed, of course).
>
> Hmmm... I disagree, but I'll leave it as a religious subject ;-)

Hmmm... Consider the key word "consider" - maybe it's not so
religious... ;-)

-- 
Oleg Goldshmidt | [EMAIL PROTECTED] | http://www.goldshmidt.org

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: echo inside Makefile

2007-11-23 Thread Oron Peled
On Friday, 23 בNovember 2007, Oleg Goldshmidt wrote:
> "Amos Shapira" <[EMAIL PROTECTED]> writes:
> > - properly-written shell scripts shouldn't depend on their
> > environment

Hmmm... I hope you don't advocate massive overriding of environment
variables in shell scripts: PATH, HOME, TERM and zillions of others
are meant to be inheritted. That's what the environment is for.

What shell scripts *should* depend is standard behaviour, both of the
shell and many other standard utilities (ls, tar, pwd, etc).

> But t?csh was *not* the default interactive shell on those systems. I

The correctness of you assertion greatly depends on which "those" you mean.
Sunos (which was the dominant Unix throughout the 80's and the beginning
of the 90's) had /bin/csh as default. BTW, this explains how some parts
in the academic world got the weird idea of teaching scripting in csh.

> For reasons of portability that you mentioned yourself, the default
> SHELL used by many programs (e.g., make) is /bin/sh. That is what
> changed on Kfir's system, changed in a way that a user cannot
> override

Completely agree.

> ...and it turned out that as a result a utility so basic 
> as echo did not implement any options (-n and -e are just about the
> only options echo has).

Berkeley 'echo':
  Uses the -n option to suppress newlines.
System-V 'echo' (base of POSIX standard):
  Uses escapes (\c to cancel newline, \t for tab, etc).
Linux /bin/echo:
  Berkeley like with some extra options (including a -e
  to enable Sys-V escapes).
Bash: ditto.
Tcsh: configurable behaviour depending on $echo_style

So it's risky to take echo for granted. What you thought as
standard (bash behaviour) is actually an extension of the standard.

> But there is a lesson here somewhere: a) don't use echo options in
> portable #!/bin/sh scripts;

Good advice.

> b) consider #!/bin/bash even for portable code (restricting it to
> systems with bash installed, of course).

Hmmm... I disagree, but I'll leave it as a religious subject ;-)

-- 
Oron Peled Voice/Fax: +972-4-8228492
[EMAIL PROTECTED]  http://www.actcom.co.il/~oron
ICQ UIN: 16527398

"Copyright protects Software. Patents protect Software Monopolies."
http://swpat.ffii.org/

To unsubscribe, 
send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: echo inside Makefile

2007-11-22 Thread Oleg Goldshmidt
"Amos Shapira" <[EMAIL PROTECTED]> writes:

> On 22/11/2007, Oleg Goldshmidt <[EMAIL PROTECTED]> wrote:
>
>> what not that expect echo options, regular expressions, and other
>> stuff ash/dash does not provide. Yes, I realize that it is technically
>> careless. That's no excuse for keeping the default interactive shell
>> different from the default environment shell on a desktop system.
>
> I'm not sure what does the "default interactive shell" have to do here
> - properly-written shell scripts shouldn't depend on their
> environment

So we agree... ;-)

> I used to use tcsh as my interactive shell for over a decade, and it
> (and /bin/csh) used to be the default shell assigned to new users on
> many systems I worked on.

But t?csh was *not* the default interactive shell on those systems. I
don't think it ever was on any Linux (or maybe UNIX) system. The
default was changed consciously from the installation by the
administrators of those systems, for whatever reason. The user can
change it to bash, ksh, zsh, whatever his soul desires.

For reasons of portability that you mentioned yourself, the default
SHELL used by many programs (e.g., make) is /bin/sh. That is what
changed on Kfir's system, changed in a way that a user cannot
override, and it turned out that as a result a utility so basic
as echo did not implement any options (-n and -e are just about the
only options echo has). I don't think it is expected of /bin/sh on a
general-purpose system, frankly.

You mentioned yourself that Kfir's makefile was autogenerated. It had
/bin/sh, not bash, as its environment, and it still used echo -e
-n. Now let's say Kfir is a normal user. He cannot change /bin/sh, he
cannot change the Makefile, the only way out is to invoke whatever
build procedure there is under an environment where SHELL=/bin/bash
(*not* /bin/sh), and hope that a) the build procedure does not
explicitly reset SHELL to /bin/sh somewhere, and b) that bash is
indeed fully compatible with sh. I'd be hard pressed to conclude that
the application is broken.

By the way, FWIW bash is supposed to know when it is invoked as sh
(see man bash for details). I just checked (on a Fedora system) that
echo accepts options inside sh.

I am not saying Debian did anything that was not within their
rights. I think, however, that it is somewhat against the expectations
of even an experienced UNIX/Linux user (and I gather that's not the
exclusive audience of Ubuntu), and I wondered publicly what it might
break.

But there is a lesson here somewhere: a) don't use echo options in
portable #!/bin/sh scripts; b) consider #!/bin/bash even for portable
code (restricting it to systems with bash installed, of course).

-- 
Oleg Goldshmidt | [EMAIL PROTECTED] | http://www.goldshmidt.org

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: echo inside Makefile

2007-11-22 Thread Amos Shapira
On 22/11/2007, Oleg Goldshmidt <[EMAIL PROTECTED]> wrote:
> If you don't want to change your installation, put
>
> SHELL=/bin/bash
>
> at the top of your Makefile. This is probably a good idea for
> portability if you don't trust the user's $SHELL to have all the
> needed features.

1. As far as I followed the thread he said at an early stage that he'd
rather not touch the Makefile because it's auto-generated.

2. For maximum portability it's most probably best to just avoid
dependency on bash at all and stick to /bin/sh.

> I wonder how much it screws up. I imagine there are quite a few
> #!/bin/sh scripts and makefiles without explicit SHELL override and

I think one of Debian's policies is to avoid dependency on bash in
scripts for exactly that reason - it's not always available (e.g.
during installation?).

> what not that expect echo options, regular expressions, and other
> stuff ash/dash does not provide. Yes, I realize that it is technically
> careless. That's no excuse for keeping the default interactive shell
> different from the default environment shell on a desktop system.

I'm not sure what does the "default interactive shell" have to do here
- properly-written shell scripts shouldn't depend on their environment
(well - unless of course they are designed to be configured through
the environment). That's why they should set their PATH etc (even just
for security reasons)...

I used to use tcsh as my interactive shell for over a decade, and it
(and /bin/csh) used to be the default shell assigned to new users on
many systems I worked on.

--Amos

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: echo inside Makefile

2007-11-22 Thread Kfir Lavi
On Nov 22, 2007 6:23 PM, Oleg Goldshmidt <[EMAIL PROTECTED]> wrote:

> "Kfir Lavi" <[EMAIL PROTECTED]> writes:
>
> > Yep,
> > The thing is that make uses /bin/sh and /bin/sh -> dash.
> > Changing the link /bin/sh to point to bash solved the problem.
>
> If you don't want to change your installation, put
>
> SHELL=/bin/bash
>
> at the top of your Makefile. This is probably a good idea for
> portability if you don't trust the user's $SHELL to have all the
> needed features.
>
> Speaking of which, live and learn - I had no idea what dash was before
> it was mentioned in this thread, so I read up for a few minutes (I
> know of ash, I didn't realize they were related, nor did I know that
> ash had a different echo(1)). I am not sure I am ready to consider
> Debian's idea of keeping bash as the default interactive shell and
> dash as "/bin/sh" (the default $SHELL) quite sane. i think it breaks
> the "principle of least astonishment". Besides, Ubuntu is not exactly
> intended for embedded use where the extra few dozen Kb or whatever or
> whatever runtime savings you can get from builtin echo and test would
> be important.
>
> I wonder how much it screws up. I imagine there are quite a few
> #!/bin/sh scripts and makefiles without explicit SHELL override and
> what not that expect echo options, regular expressions, and other
> stuff ash/dash does not provide. Yes, I realize that it is technically
> careless. That's no excuse for keeping the default interactive shell
> different from the default environment shell on a desktop system.
>
> --
> Oleg Goldshmidt | [EMAIL PROTECTED] | http://www.goldshmidt.org
>

I use Ubuntu because thats what all my team uses. If I had the choice, I
would go with Gentoo or Debian. As for the embedded system, my Ubuntu is
just a host for compilation of embedded environment. We use snapgear, which
is virtually stable version of uclinux.


Re: echo inside Makefile

2007-11-22 Thread Oleg Goldshmidt
"Kfir Lavi" <[EMAIL PROTECTED]> writes:

> Yep,
> The thing is that make uses /bin/sh and /bin/sh -> dash.
> Changing the link /bin/sh to point to bash solved the problem.

If you don't want to change your installation, put

SHELL=/bin/bash

at the top of your Makefile. This is probably a good idea for
portability if you don't trust the user's $SHELL to have all the
needed features.

Speaking of which, live and learn - I had no idea what dash was before
it was mentioned in this thread, so I read up for a few minutes (I
know of ash, I didn't realize they were related, nor did I know that
ash had a different echo(1)). I am not sure I am ready to consider
Debian's idea of keeping bash as the default interactive shell and
dash as "/bin/sh" (the default $SHELL) quite sane. i think it breaks
the "principle of least astonishment". Besides, Ubuntu is not exactly
intended for embedded use where the extra few dozen Kb or whatever or
whatever runtime savings you can get from builtin echo and test would
be important.

I wonder how much it screws up. I imagine there are quite a few
#!/bin/sh scripts and makefiles without explicit SHELL override and
what not that expect echo options, regular expressions, and other
stuff ash/dash does not provide. Yes, I realize that it is technically
careless. That's no excuse for keeping the default interactive shell
different from the default environment shell on a desktop system.

-- 
Oleg Goldshmidt | [EMAIL PROTECTED] | http://www.goldshmidt.org

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: echo inside Makefile

2007-11-22 Thread Ilya Konstantinov
Do note that this symlink is a result of a divert made by dash's
installation. The *right* solution is to either uninstall the 'dash' package
or at least to remove the divert (using the dpkg-divert utility).

On Nov 22, 2007 9:53 AM, Kfir Lavi <[EMAIL PROTECTED]> wrote:

> Yep,
> The thing is that make uses /bin/sh and /bin/sh -> dash.
> Changing the link /bin/sh to point to bash solved the problem.
> Thanks all for your help.
>


Re: echo inside Makefile

2007-11-21 Thread Kfir Lavi
Yep,
The thing is that make uses /bin/sh and /bin/sh -> dash.
Changing the link /bin/sh to point to bash solved the problem.
Thanks all for your help.
Kfir

On Nov 22, 2007 9:54 AM, Dotan Shavit <[EMAIL PROTECTED]> wrote:

> On Thursday 22 November 2007, Kfir Lavi wrote:
> >  make SHELL=/bin/bash
> > works.
> > But, my shell seems to be bash.
> > echo $SHELL
> > /bin/bash
> >
> > So what is the problem? Do I really run dash instead of bash, but it
> shows
> > bash?
> Try:
> all:
>echo $(SHELL)
>
> #
> > Thanks,
> > Kfir
> >
> > On Nov 21, 2007 8:26 PM, Valery Reznic <[EMAIL PROTECTED]> wrote:
> > > --- Dotan Shavit <[EMAIL PROTECTED]> wrote:
> > > > On Tuesday 20 November 2007, you wrote:
> > > > > Hi,
> > > > > I have a problem running echo inside Makefile.
> > > > > Here is the Makefile:
> > > > > all:
> > > > > @echo "string"
> > > > > @echo -e -n "string"
> > > > >
> > > > > The output is:
> > > > > string
> > > > > -e -n string
> > > > >
> > > > > The problem is the second @echo command. It prints
> > > >
> > > > '-e -n' instead of
> > > >
> > > > > interpreting those options.
> > > > > I have tested it on other comps and it works fine,
> > > >
> > > > so its an environment
> > > >
> > > > > problem in my comp.
> > > > > What var or file determine this behavior?
> > > >
> > > > The difference is your /bin/sh
> > > > In Ubuntu it's linked to /bin/dash which echo
> > > > (builtin command) accepts
> > > > only -n
> > > >
> > > > linking /bin/sh to /bin/bash will bypass this
> > > > behavior in *your* environment.
> > >
> > > make SHELL=/bin/bash
> > >
> > > should do the trick too.
> > >
> > > Valery.
> > >
> > > > A better solution will be to force make calling the
> > > > echo you want:
> > > >
> > > > ECHO=/bin/echo
> > > >
> > > > all:
> > > > @$(ECHO) -n -e "aaa"
> > > >
> > > >
> > > > #
> > > >
> > > > > Thanks,
> > > > > Kfir
> > >
> > > =
> > >
> > > > To unsubscribe, send mail to
> > > > [EMAIL PROTECTED] with
> > > > the word "unsubscribe" in the message body, e.g.,
> > > > run the command
> > > > echo unsubscribe | mail
> > > > [EMAIL PROTECTED]
> > >
> > >
> > >
> _
> > >___ Get easy, one-click access to your favorites.
> > > Make Yahoo! your homepage.
> > > http://www.yahoo.com/r/hs
>
>
>


Re: echo inside Makefile

2007-11-21 Thread Dotan Shavit
On Thursday 22 November 2007, Kfir Lavi wrote:
>  make SHELL=/bin/bash
> works.
> But, my shell seems to be bash.
> echo $SHELL
> /bin/bash
>
> So what is the problem? Do I really run dash instead of bash, but it shows
> bash?
Try:
all:
echo $(SHELL)

#
> Thanks,
> Kfir
>
> On Nov 21, 2007 8:26 PM, Valery Reznic <[EMAIL PROTECTED]> wrote:
> > --- Dotan Shavit <[EMAIL PROTECTED]> wrote:
> > > On Tuesday 20 November 2007, you wrote:
> > > > Hi,
> > > > I have a problem running echo inside Makefile.
> > > > Here is the Makefile:
> > > > all:
> > > > @echo "string"
> > > > @echo -e -n "string"
> > > >
> > > > The output is:
> > > > string
> > > > -e -n string
> > > >
> > > > The problem is the second @echo command. It prints
> > >
> > > '-e -n' instead of
> > >
> > > > interpreting those options.
> > > > I have tested it on other comps and it works fine,
> > >
> > > so its an environment
> > >
> > > > problem in my comp.
> > > > What var or file determine this behavior?
> > >
> > > The difference is your /bin/sh
> > > In Ubuntu it's linked to /bin/dash which echo
> > > (builtin command) accepts
> > > only -n
> > >
> > > linking /bin/sh to /bin/bash will bypass this
> > > behavior in *your* environment.
> >
> > make SHELL=/bin/bash
> >
> > should do the trick too.
> >
> > Valery.
> >
> > > A better solution will be to force make calling the
> > > echo you want:
> > >
> > > ECHO=/bin/echo
> > >
> > > all:
> > > @$(ECHO) -n -e "aaa"
> > >
> > >
> > > #
> > >
> > > > Thanks,
> > > > Kfir
> >
> > =
> >
> > > To unsubscribe, send mail to
> > > [EMAIL PROTECTED] with
> > > the word "unsubscribe" in the message body, e.g.,
> > > run the command
> > > echo unsubscribe | mail
> > > [EMAIL PROTECTED]
> >
> > 
> > _
> >___ Get easy, one-click access to your favorites.
> > Make Yahoo! your homepage.
> > http://www.yahoo.com/r/hs



=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: echo inside Makefile

2007-11-21 Thread Kfir Lavi
 make SHELL=/bin/bash
works.
But, my shell seems to be bash.
echo $SHELL
/bin/bash

So what is the problem? Do I really run dash instead of bash, but it shows
bash?
Thanks,
Kfir

On Nov 21, 2007 8:26 PM, Valery Reznic <[EMAIL PROTECTED]> wrote:

>
> --- Dotan Shavit <[EMAIL PROTECTED]> wrote:
>
> > On Tuesday 20 November 2007, you wrote:
> > > Hi,
> > > I have a problem running echo inside Makefile.
> > > Here is the Makefile:
> > > all:
> > > @echo "string"
> > > @echo -e -n "string"
> > >
> > > The output is:
> > > string
> > > -e -n string
> > >
> > > The problem is the second @echo command. It prints
> > '-e -n' instead of
> > > interpreting those options.
> > > I have tested it on other comps and it works fine,
> > so its an environment
> > > problem in my comp.
> > > What var or file determine this behavior?
> > The difference is your /bin/sh
> > In Ubuntu it's linked to /bin/dash which echo
> > (builtin command) accepts
> > only -n
> >
> > linking /bin/sh to /bin/bash will bypass this
> > behavior in *your* environment.
> make SHELL=/bin/bash
>
> should do the trick too.
>
> Valery.
>
> > A better solution will be to force make calling the
> > echo you want:
> >
> > ECHO=/bin/echo
> >
> > all:
> > @$(ECHO) -n -e "aaa"
> >
> >
> > #
> >
> > > Thanks,
> > > Kfir
> >
> >
> >
> >
> =
> > To unsubscribe, send mail to
> > [EMAIL PROTECTED] with
> > the word "unsubscribe" in the message body, e.g.,
> > run the command
> > echo unsubscribe | mail
> > [EMAIL PROTECTED]
> >
> >
>
>
>
>
>  
> 
> Get easy, one-click access to your favorites.
> Make Yahoo! your homepage.
> http://www.yahoo.com/r/hs
>


Re: echo inside Makefile

2007-11-21 Thread Dotan Shavit
On Tuesday 20 November 2007, you wrote:
> Hi,
> I have a problem running echo inside Makefile.
> Here is the Makefile:
> all:
> @echo "string"
> @echo -e -n "string"
>
> The output is:
> string
> -e -n string
>
> The problem is the second @echo command. It prints '-e -n' instead of
> interpreting those options.
> I have tested it on other comps and it works fine, so its an environment
> problem in my comp.
> What var or file determine this behavior?
The difference is your /bin/sh
In Ubuntu it's linked to /bin/dash which echo (builtin command) accepts 
only -n

linking /bin/sh to /bin/bash will bypass this behavior in *your* environment.
A better solution will be to force make calling the echo you want:

ECHO=/bin/echo

all:
@$(ECHO) -n -e "aaa"


#

> Thanks,
> Kfir



=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: echo inside Makefile

2007-11-21 Thread Kfir Lavi
On Nov 21, 2007 1:33 AM, Amos Shapira <[EMAIL PROTECTED]> wrote:

> On 20/11/2007, Kfir Lavi <[EMAIL PROTECTED]> wrote:
> > Ok,
> > make -d don't show much.
> > I have attached the two files: Makefile and make.log
>
> That's weird - your make.log says:
>
> Must remake target `all'.
> -e -n aaa
>
> (i.e. "echo" is missing").
>
> But running "make -d -n" on my machine (Debian Etch, make 3.81, bash
> 3.1.17, /bin/echo from GNU coreutils 5.97) I get:
>
> Must remake target `all'.
> echo -e -n "aaa"
>
> (i.e. "echo" is included).
>
> What was the exact command you executed to get "make.log"?
>

make -d 2>&1 | tee make.log


> Maybe add a space after the "@"?
>

Nope, this  doesn't  help.


>
> I also see in bash's man that "xpg_echo" shell option will tell the
> built-in echo to expand backslash-escape sequences by default. It's
> off in my bash.
>

By default this flag is 'off'. I have used 'shopt -s xpg_echo' to set it
'on'.
This didn't solve the problem.


> Another piece of documentation - the coreutils info page about echo says:
>
> 
>   If the `POSIXLY_CORRECT' environment variable is set, then when
> `echo''s first argument is not `-n' it outputs option-like arguments
> instead of treating them as options.  For example, `echo -ne hello'
> outputs `-ne hello' instead of plain `hello'.
>
>   POSIX does not require support for any options, and says that the
> behavior of `echo' is implementation-defined if any STRING contains a
> backslash or if the first argument is `-n'.  Portable programs can use
> the `printf' command if they need to omit trailing newlines or output
> control characters or backslashes.  *Note printf invocation::.
> 
>
> Do you have POSIXLY_CORRECT envariable set? How about trying to switch
> the -e and -n in Makefile?
>

POSIXLY_CORRECT doesn't help too:
$ make
aaa-e -n aaa
$ POSIXLY_CORRECT=1 make
-e -n aaa
-e -n aaa


> Cheers,
>
> --Amos
>
> =
> To unsubscribe, send mail to [EMAIL PROTECTED] with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail [EMAIL PROTECTED]
>
>


Re: echo inside Makefile

2007-11-21 Thread Kfir Lavi
$ type -a echo
echo is a shell builtin
echo is /bin/echo

$bash --version
GNU bash, version 3.2.25(1)-release (i486-pc-linux-gnu)

$/bin/echo --version
echo (GNU coreutils) 5.97


On Nov 20, 2007 8:11 PM, Oleg Goldshmidt <[EMAIL PROTECTED]> wrote:

> "Kfir Lavi" <[EMAIL PROTECTED]> writes:
>
> > Hi,
> > I have a problem running echo inside Makefile.
> > Here is the Makefile:
> > all:
> > @echo "string"
> > @echo -e -n "string"
> > The output is:
> > string
> > -e -n string
> > The problem is the second @echo command. It prints '-e -n' instead of
> > interpreting those options.
> > I have tested it on other comps and it works fine, so its an environment
> > problem in my comp.
> > What var or file determine this behavior?
>
> What does "type -a echo" say in the same environment under which you run
> make?
>
> Your makefile works properly for me, FWIW, but I am on Fedora, not Ubuntu.
>
> --
> Oleg Goldshmidt | [EMAIL PROTECTED] | http://www.goldshmidt.org
>
> To unsubscribe, send mail to [EMAIL PROTECTED] with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail [EMAIL PROTECTED]
>
>


Re: echo inside Makefile

2007-11-20 Thread Amos Shapira
On 20/11/2007, Kfir Lavi <[EMAIL PROTECTED]> wrote:
> Ok,
> make -d don't show much.
> I have attached the two files: Makefile and make.log

That's weird - your make.log says:

Must remake target `all'.
-e -n aaa

(i.e. "echo" is missing").

But running "make -d -n" on my machine (Debian Etch, make 3.81, bash
3.1.17, /bin/echo from GNU coreutils 5.97) I get:

Must remake target `all'.
echo -e -n "aaa"

(i.e. "echo" is included).

What was the exact command you executed to get "make.log"?

Maybe add a space after the "@"?

I also see in bash's man that "xpg_echo" shell option will tell the
built-in echo to expand backslash-escape sequences by default. It's
off in my bash.

Another piece of documentation - the coreutils info page about echo says:


   If the `POSIXLY_CORRECT' environment variable is set, then when
`echo''s first argument is not `-n' it outputs option-like arguments
instead of treating them as options.  For example, `echo -ne hello'
outputs `-ne hello' instead of plain `hello'.

   POSIX does not require support for any options, and says that the
behavior of `echo' is implementation-defined if any STRING contains a
backslash or if the first argument is `-n'.  Portable programs can use
the `printf' command if they need to omit trailing newlines or output
control characters or backslashes.  *Note printf invocation::.


Do you have POSIXLY_CORRECT envariable set? How about trying to switch
the -e and -n in Makefile?

Cheers,

--Amos

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: echo inside Makefile

2007-11-20 Thread Kfir Lavi
Ok,
make -d don't show much.
I have attached the two files: Makefile and make.log

On Nov 20, 2007 2:28 PM, Ilya Konstantinov <[EMAIL PROTECTED]>
wrote:

> You can run 'make -d' to get more insight into what Make does.
> There aren't supposed to be any internal Make commands. There are internal
> functions, but the syntax for calling them is $(function ...), e.g. $(info
> foobar)
>
>
> On Nov 20, 2007 2:16 PM, Kfir Lavi <[EMAIL PROTECTED]> wrote:
>
> > Does make uses internal echo command?
> > I ask this, because bash echo interprets -e -n and also /bin/echo. But
> > when running echo inside the Makefile it will not interpret -e -n.
> >
>
>


Makefile
Description: Binary data
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i486-pc-linux-gnu
Reading makefiles...
Reading makefile `Makefile'...
Updating makefiles
 Considering target file `Makefile'.
  Looking for an implicit rule for `Makefile'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `Makefile.o'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `Makefile.c'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `Makefile.cc'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `Makefile.C'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `Makefile.cpp'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `Makefile.p'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `Makefile.f'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `Makefile.F'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `Makefile.r'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `Makefile.s'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `Makefile.S'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `Makefile.mod'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `Makefile.sh'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `Makefile,v'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `RCS/Makefile,v'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `RCS/Makefile'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `s.Makefile'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `SCCS/s.Makefile'.
  Trying pattern rule with stem `Makefile'.
  Trying implicit prerequisite `Makefile.o'.
  Looking for a rule with intermediate file `Makefile.o'.
   Avoiding implicit rule recursion.
   Trying pattern rule with stem `Makefile'.
   Trying implicit prerequisite `Makefile.c'.
   Trying pattern rule with stem `Makefile'.
   Trying implicit prerequisite `Makefile.cc'.
   Trying pattern rule with stem `Makefile'.
   Trying implicit prerequisite `Makefile.C'.
   Trying pattern rule with stem `Makefile'.
   Trying implicit prerequisite `Makefile.cpp'.
   Trying pattern rule with stem `Makefile'.
   Trying implicit prerequisite `Makefile.p'.
   Trying pattern rule with stem `Makefile'.
   Trying implicit prerequisite `Makefile.f'.
   Trying pattern rule with stem `Makefile'.
   Trying implicit prerequisite `Makefile.F'.
   Trying pattern rule with stem `Makefile'.
   Trying implicit prerequisite `Makefile.r'.
   Trying pattern rule with stem `Makefile'.
   Trying implicit prerequisite `Makefile.s'.
   Trying pattern rule with stem `Makefile'.
   Trying implicit prerequisite `Makefile.S'.
   Trying pattern rule with stem `Makefile'.
   Trying implicit prerequisite `Makefile.mod'.
   Trying pattern rule with stem `Makefile.o'.
   Trying implicit prerequisite `Makefile.o,v'.
   Trying pattern rule with stem `Makefile.o'.
   Trying implicit prerequisite `RCS/Makefile.o,v'.
   Trying pattern rule with stem `Makefile.o'.
   Trying implicit prerequisite `RCS/Makefile.o'.
   Trying pattern rule with stem `Makefile.o'.
   Trying implicit prerequisite `s.Makefile.o'.
   Trying pattern rule with stem `Makefile.o'.
   Trying implicit prerequisite `SCCS/s.Makefile.o'.
   Trying pattern rule with stem `Makefile'.
   Trying implicit prerequisite `Makefile.c'.
   Looking for a rule with intermediate file `Makefile.c'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem `Makefile'.
Trying implicit prerequisite `Makefile.y'.
Trying pattern rule with stem `Makefile'.
Trying implicit prerequisite `Makefile.l'.
Trying pattern rule with stem `Makefile'.
Trying implicit prerequisite `Makefile.w'.
Trying pattern rule with stem `Makefile'.
Trying implicit prerequisite `Makefile.w'.
T

Re: echo inside Makefile

2007-11-20 Thread Oleg Goldshmidt
"Kfir Lavi" <[EMAIL PROTECTED]> writes:

> Hi,
> I have a problem running echo inside Makefile.
> Here is the Makefile:
> all:
>     @echo "string"
>     @echo -e -n "string"
> The output is:
> string
> -e -n string
> The problem is the second @echo command. It prints '-e -n' instead of
> interpreting those options.
> I have tested it on other comps and it works fine, so its an environment
> problem in my comp.
> What var or file determine this behavior?

What does "type -a echo" say in the same environment under which you run
make?

Your makefile works properly for me, FWIW, but I am on Fedora, not Ubuntu.

-- 
Oleg Goldshmidt | [EMAIL PROTECTED] | http://www.goldshmidt.org

To unsubscribe, 
send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: echo inside Makefile

2007-11-20 Thread Ilya Konstantinov
You can run 'make -d' to get more insight into what Make does.
There aren't supposed to be any internal Make commands. There are internal
functions, but the syntax for calling them is $(function ...), e.g. $(info
foobar)

On Nov 20, 2007 2:16 PM, Kfir Lavi <[EMAIL PROTECTED]> wrote:

> Does make uses internal echo command?
> I ask this, because bash echo interprets -e -n and also /bin/echo. But
> when running echo inside the Makefile it will not interpret -e -n.
>


Re: echo inside Makefile

2007-11-20 Thread Kfir Lavi
One more thing.
I can change the Makefile to work, using:
@/bin/echo -e -n "aaa"
But I do not want to change the Makefile. I want to find the problem in my
environment.

On Nov 20, 2007 2:16 PM, Kfir Lavi <[EMAIL PROTECTED]> wrote:

> Does make uses internal echo command?
> I ask this, because bash echo interprets -e -n and also /bin/echo. But
> when running echo inside the Makefile it will not interpret -e -n.
>
>
>
> On Nov 20, 2007 1:52 PM, Valery Reznic < [EMAIL PROTECTED]> wrote:
>
> >
> > --- Kfir Lavi <[EMAIL PROTECTED]> wrote:
> >
> > > I'm compiling embedded environment, and there is a
> > > Makefile in iproute2 an
> > > tc that have this line.
> > > I'm using bash as a shell, also the other comps I
> > > have used.
> > > I have read the echo entry in man bash, but didn't
> > > find nothing of
> > > importance.
> > > What I did found is that my echo version don't
> > > interpret any flags with --.
> > > echo --version
> > > --version
> > > I'm running Ubuntu 7.10
> > May be your bash for some reason running not it's
> > embedded echo, but external one .
> >
> > Anyway, what about printf, is it work for you ?
> >
> > Valery.
> >
> > >
> > > Kfir
> > >
> > > On Nov 20, 2007 1:22 PM, Valery Reznic
> > > < [EMAIL PROTECTED]> wrote:
> > >
> > > >
> > > >
> > > >
> > > >
> > > > --- Amos Shapira <[EMAIL PROTECTED]> wrote:
> > > >
> > > > > On 20/11/2007, Kfir Lavi <[EMAIL PROTECTED]>
> > > > > wrote:
> > > > > > Hi,
> > > > > > I have a problem running echo inside Makefile.
> > > > > > Here is the Makefile:
> > > > > > all:
> > > > > > @echo "string"
> > > > > > @echo -e -n "string"
> > > > You could try to use printf instead of echo.
> > > >
> > > > Valery
> > > >
> > > >
> > > > > >
> > > > > > The output is:
> > > > > > string
> > > > > > -e -n string
> > > > > >
> > > > > > The problem is the second @echo command. It
> > > prints
> > > > > '-e -n' instead of
> > > > > > interpreting those options.
> > > > > > I have tested it on other comps and it works
> > > fine,
> > > > > so its an environment
> > > > > > problem in my comp.
> > > > > > What var or file determine this behavior?
> > > > >
> > > > > It mostly depends on which shell is used. "echo"
> > > is
> > > > > a built-in command
> > > > > in many shells as well as there are stand-alone
> > > > > implementations
> > > > > (usually under /bin). And many of the different
> > > > > versions use different
> > > > > options.
> > > > > Do you use autoconf or do you write the Makefile
> > > > > directly? I'm pretty
> > > > > sure autoconf can interrogate the system and
> > > find
> > > > > the right
> > > > > combination of echo and flags for your needs
> > > (but I
> > > > > never got around
> > > > > to use it properly).
> > > > >
> > > > > --Amos
> > > > >
> > > > >
> > > >
> > >
> > =
> > > > > To unsubscribe, send mail to
> > > > > [EMAIL PROTECTED] with
> > > > > the word "unsubscribe" in the message body,
> > > e.g.,
> > > > > run the command
> > > > > echo unsubscribe | mail
> > > > > [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
> > 
> > > > Be a better sports nut!  Let your teams follow you
> > > > with Yahoo Mobile. Try it now.
> > > >
> > >
> > http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
> > > >
> > > >
> > >
> > =
> > > > To unsubscribe, send mail to
> > > [EMAIL PROTECTED] with
> > > > the word "unsubscribe" in the message body, e.g.,
> > > run the command
> > > > echo unsubscribe | mail
> > > [EMAIL PROTECTED]
> > > >
> > > >
> > >
> >
> >
> >
> >
> >  
> > 
> > Never miss a thing.  Make Yahoo your home page.
> > http://www.yahoo.com/r/hs
> >
>
>


Re: echo inside Makefile

2007-11-20 Thread Kfir Lavi
Does make uses internal echo command?
I ask this, because bash echo interprets -e -n and also /bin/echo. But when
running echo inside the Makefile it will not interpret -e -n.


On Nov 20, 2007 1:52 PM, Valery Reznic <[EMAIL PROTECTED]> wrote:

>
> --- Kfir Lavi <[EMAIL PROTECTED]> wrote:
>
> > I'm compiling embedded environment, and there is a
> > Makefile in iproute2 an
> > tc that have this line.
> > I'm using bash as a shell, also the other comps I
> > have used.
> > I have read the echo entry in man bash, but didn't
> > find nothing of
> > importance.
> > What I did found is that my echo version don't
> > interpret any flags with --.
> > echo --version
> > --version
> > I'm running Ubuntu 7.10
> May be your bash for some reason running not it's
> embedded echo, but external one .
>
> Anyway, what about printf, is it work for you ?
>
> Valery.
>
> >
> > Kfir
> >
> > On Nov 20, 2007 1:22 PM, Valery Reznic
> > <[EMAIL PROTECTED]> wrote:
> >
> > >
> > >
> > >
> > >
> > > --- Amos Shapira <[EMAIL PROTECTED]> wrote:
> > >
> > > > On 20/11/2007, Kfir Lavi <[EMAIL PROTECTED]>
> > > > wrote:
> > > > > Hi,
> > > > > I have a problem running echo inside Makefile.
> > > > > Here is the Makefile:
> > > > > all:
> > > > > @echo "string"
> > > > > @echo -e -n "string"
> > > You could try to use printf instead of echo.
> > >
> > > Valery
> > >
> > >
> > > > >
> > > > > The output is:
> > > > > string
> > > > > -e -n string
> > > > >
> > > > > The problem is the second @echo command. It
> > prints
> > > > '-e -n' instead of
> > > > > interpreting those options.
> > > > > I have tested it on other comps and it works
> > fine,
> > > > so its an environment
> > > > > problem in my comp.
> > > > > What var or file determine this behavior?
> > > >
> > > > It mostly depends on which shell is used. "echo"
> > is
> > > > a built-in command
> > > > in many shells as well as there are stand-alone
> > > > implementations
> > > > (usually under /bin). And many of the different
> > > > versions use different
> > > > options.
> > > > Do you use autoconf or do you write the Makefile
> > > > directly? I'm pretty
> > > > sure autoconf can interrogate the system and
> > find
> > > > the right
> > > > combination of echo and flags for your needs
> > (but I
> > > > never got around
> > > > to use it properly).
> > > >
> > > > --Amos
> > > >
> > > >
> > >
> >
> =
> > > > To unsubscribe, send mail to
> > > > [EMAIL PROTECTED] with
> > > > the word "unsubscribe" in the message body,
> > e.g.,
> > > > run the command
> > > > echo unsubscribe | mail
> > > > [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> >
>
> 
> > > Be a better sports nut!  Let your teams follow you
> > > with Yahoo Mobile. Try it now.
> > >
> >
> http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
> > >
> > >
> >
> =
> > > To unsubscribe, send mail to
> > [EMAIL PROTECTED] with
> > > the word "unsubscribe" in the message body, e.g.,
> > run the command
> > > echo unsubscribe | mail
> > [EMAIL PROTECTED]
> > >
> > >
> >
>
>
>
>
>  
> 
> Never miss a thing.  Make Yahoo your home page.
> http://www.yahoo.com/r/hs
>


Re: echo inside Makefile

2007-11-20 Thread Valery Reznic

--- Kfir Lavi <[EMAIL PROTECTED]> wrote:

> I'm compiling embedded environment, and there is a
> Makefile in iproute2 an
> tc that have this line.
> I'm using bash as a shell, also the other comps I
> have used.
> I have read the echo entry in man bash, but didn't
> find nothing of
> importance.
> What I did found is that my echo version don't
> interpret any flags with --.
> echo --version
> --version
> I'm running Ubuntu 7.10
May be your bash for some reason running not it's
embedded echo, but external one .

Anyway, what about printf, is it work for you ?

Valery.

> 
> Kfir
> 
> On Nov 20, 2007 1:22 PM, Valery Reznic
> <[EMAIL PROTECTED]> wrote:
> 
> >
> >
> >
> >
> > --- Amos Shapira <[EMAIL PROTECTED]> wrote:
> >
> > > On 20/11/2007, Kfir Lavi <[EMAIL PROTECTED]>
> > > wrote:
> > > > Hi,
> > > > I have a problem running echo inside Makefile.
> > > > Here is the Makefile:
> > > > all:
> > > > @echo "string"
> > > > @echo -e -n "string"
> > You could try to use printf instead of echo.
> >
> > Valery
> >
> >
> > > >
> > > > The output is:
> > > > string
> > > > -e -n string
> > > >
> > > > The problem is the second @echo command. It
> prints
> > > '-e -n' instead of
> > > > interpreting those options.
> > > > I have tested it on other comps and it works
> fine,
> > > so its an environment
> > > > problem in my comp.
> > > > What var or file determine this behavior?
> > >
> > > It mostly depends on which shell is used. "echo"
> is
> > > a built-in command
> > > in many shells as well as there are stand-alone
> > > implementations
> > > (usually under /bin). And many of the different
> > > versions use different
> > > options.
> > > Do you use autoconf or do you write the Makefile
> > > directly? I'm pretty
> > > sure autoconf can interrogate the system and
> find
> > > the right
> > > combination of echo and flags for your needs
> (but I
> > > never got around
> > > to use it properly).
> > >
> > > --Amos
> > >
> > >
> >
>
=
> > > To unsubscribe, send mail to
> > > [EMAIL PROTECTED] with
> > > the word "unsubscribe" in the message body,
> e.g.,
> > > run the command
> > > echo unsubscribe | mail
> > > [EMAIL PROTECTED]
> > >
> > >
> >
> >
> >
> >
> > 
>

> > Be a better sports nut!  Let your teams follow you
> > with Yahoo Mobile. Try it now.
> >
>
http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
> >
> >
>
=
> > To unsubscribe, send mail to
> [EMAIL PROTECTED] with
> > the word "unsubscribe" in the message body, e.g.,
> run the command
> > echo unsubscribe | mail
> [EMAIL PROTECTED]
> >
> >
> 



  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: echo inside Makefile

2007-11-20 Thread Kfir Lavi
I'm compiling embedded environment, and there is a Makefile in iproute2 an
tc that have this line.
I'm using bash as a shell, also the other comps I have used.
I have read the echo entry in man bash, but didn't find nothing of
importance.
What I did found is that my echo version don't interpret any flags with --.
echo --version
--version
I'm running Ubuntu 7.10

Kfir

On Nov 20, 2007 1:22 PM, Valery Reznic <[EMAIL PROTECTED]> wrote:

>
>
>
>
> --- Amos Shapira <[EMAIL PROTECTED]> wrote:
>
> > On 20/11/2007, Kfir Lavi <[EMAIL PROTECTED]>
> > wrote:
> > > Hi,
> > > I have a problem running echo inside Makefile.
> > > Here is the Makefile:
> > > all:
> > > @echo "string"
> > > @echo -e -n "string"
> You could try to use printf instead of echo.
>
> Valery
>
>
> > >
> > > The output is:
> > > string
> > > -e -n string
> > >
> > > The problem is the second @echo command. It prints
> > '-e -n' instead of
> > > interpreting those options.
> > > I have tested it on other comps and it works fine,
> > so its an environment
> > > problem in my comp.
> > > What var or file determine this behavior?
> >
> > It mostly depends on which shell is used. "echo" is
> > a built-in command
> > in many shells as well as there are stand-alone
> > implementations
> > (usually under /bin). And many of the different
> > versions use different
> > options.
> > Do you use autoconf or do you write the Makefile
> > directly? I'm pretty
> > sure autoconf can interrogate the system and find
> > the right
> > combination of echo and flags for your needs (but I
> > never got around
> > to use it properly).
> >
> > --Amos
> >
> >
> =
> > To unsubscribe, send mail to
> > [EMAIL PROTECTED] with
> > the word "unsubscribe" in the message body, e.g.,
> > run the command
> > echo unsubscribe | mail
> > [EMAIL PROTECTED]
> >
> >
>
>
>
>
>  
> 
> Be a better sports nut!  Let your teams follow you
> with Yahoo Mobile. Try it now.
> http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
>
> =
> To unsubscribe, send mail to [EMAIL PROTECTED] with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail [EMAIL PROTECTED]
>
>


Re: echo inside Makefile

2007-11-20 Thread Valery Reznic




--- Amos Shapira <[EMAIL PROTECTED]> wrote:

> On 20/11/2007, Kfir Lavi <[EMAIL PROTECTED]>
> wrote:
> > Hi,
> > I have a problem running echo inside Makefile.
> > Here is the Makefile:
> > all:
> > @echo "string"
> > @echo -e -n "string"
You could try to use printf instead of echo.

Valery


> >
> > The output is:
> > string
> > -e -n string
> >
> > The problem is the second @echo command. It prints
> '-e -n' instead of
> > interpreting those options.
> > I have tested it on other comps and it works fine,
> so its an environment
> > problem in my comp.
> > What var or file determine this behavior?
> 
> It mostly depends on which shell is used. "echo" is
> a built-in command
> in many shells as well as there are stand-alone
> implementations
> (usually under /bin). And many of the different
> versions use different
> options.
> Do you use autoconf or do you write the Makefile
> directly? I'm pretty
> sure autoconf can interrogate the system and find
> the right
> combination of echo and flags for your needs (but I
> never got around
> to use it properly).
> 
> --Amos
> 
>
=
> To unsubscribe, send mail to
> [EMAIL PROTECTED] with
> the word "unsubscribe" in the message body, e.g.,
> run the command
> echo unsubscribe | mail
> [EMAIL PROTECTED]
> 
> 



  

Be a better sports nut!  Let your teams follow you 
with Yahoo Mobile. Try it now.  
http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: echo inside Makefile

2007-11-20 Thread Amos Shapira
On 20/11/2007, Kfir Lavi <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a problem running echo inside Makefile.
> Here is the Makefile:
> all:
> @echo "string"
> @echo -e -n "string"
>
> The output is:
> string
> -e -n string
>
> The problem is the second @echo command. It prints '-e -n' instead of
> interpreting those options.
> I have tested it on other comps and it works fine, so its an environment
> problem in my comp.
> What var or file determine this behavior?

It mostly depends on which shell is used. "echo" is a built-in command
in many shells as well as there are stand-alone implementations
(usually under /bin). And many of the different versions use different
options.
Do you use autoconf or do you write the Makefile directly? I'm pretty
sure autoconf can interrogate the system and find the right
combination of echo and flags for your needs (but I never got around
to use it properly).

--Amos

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]