[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: make and c++ exceptions

From: Paul D. Smith
Subject: Re: make and c++ exceptions
Date: Sat, 6 Sep 2003 22:26:36 -0400

%% Steve Hutton <address@hidden> writes:

  >> Finally, I don't understand why you used a "similar" script to test
  >> the standalone behavior rather than the _exact_ script.

  sh> The reason I did that is because when I copied the script verbatim
  sh> it didn't run in bash.  This led me to believe that shell language
  sh> automake generates is not bash compatible (e.g. make seems to
  sh> treat "$$" in it's scripts the same way bash treats "$")

Certainly.  A "$" by itself is assumed to be the beginning of a make
variable.  If you want a literal "$" to appear in your shell script you
escape it by using "$$".  Make will reduce the "$$" to "$" when it
invokes the shell (GNU make will print out the command that it invokes
just before invoking it).

  sh> I was therefore wondering if make might use it's own shell
  sh> interpreter.

Definitely not.  What a waste that would be, to reimplement the entire
shell inside make!

  sh> You seem to be saying that make forwards to the shell


  sh> (which one, the default shell of the user?

Definitely not.  If it did that, makefiles would break for every user
who didn't have the same shell as that makefile author.

It uses the contents of the make variable SHELL, which is set to /bin/sh
unless overridden in the makefile (or command line).

  sh> Does it preprocess first to convert $$ to $?)

Well, it handles escape characters, so yes certainly.

Check the GNU make manual.

  sh> Ok, this is about as simple an example as I can create - should
  sh> only take a few seconds for anyone to compile and make:

Hm.  Your catch/throw example works fine on my system: from both the
shell and make it exits with 0.

I tried it with GNU make 3.79.1 on a Debian GNU/Linux system with GCC
3.3.1, glibc 2.3.2, and bash 2.05(b).0.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

[Prev in Thread] Current Thread [Next in Thread]