help-make
[Top][All Lists]
Advanced

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

Re: Make Manual Example -- Please Explain


From: Paul D. Smith
Subject: Re: Make Manual Example -- Please Explain
Date: Thu, 15 Jul 2004 19:07:22 -0400

%% hotquietday <address@hidden> writes:

  h> 1. What does "@set -e;" do?  Is that a shell command
  h> or make command?  I couldn't find anything in man
  h> about it.

It's a shell command (it has to be, because all commands in the command
script are passed to the shell).

It turns on error mode where the first error encountered causes the
script to exit.

  h> 2. What is "address@hidden;"?  I know that "$@", when used
  h> alone, represents the target, but what's with all
  h> those dollar signs?

If you want a plain $ in the shell script you have to escape it, so
"$$$$" is passed to the shell as "$$" which (if you check your shell man
page) expands to the PID of the shell.  It's just a simple way to create
a unique filename.

  h> 3. Can someone break down the sed command:

  h> sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < address@hidden > $@;

  h> I've never seen sed used this way before.  Eg, I can't
  h> see how the commas are specifying a range,

They aren't... why would they be?  Probably you missed the feature of
sed where the first character after the "s" command is the delimiter,
REGARDLESS of what it is.  Traditionally people use "/" but you don't
have to: any character works.

If your replacement string might contain "/" then it's best to pick a
different separator so you can avoid escaping all the "/" characters.
In this case the $* variable could expand to a filename with embedded
"/" so we avoid the whole escaping problem by choosing a different
separator.  The above will work... unless your filename contains a ","!!

  h> and there is no -e flag.

-e is optional if there's only one pattern.  You can add it in if it's
more readable for you.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "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]