help-make
[Top][All Lists]
Advanced

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

Re: make manual and 5.3.1 Using One Shell


From: Philip Guenther
Subject: Re: make manual and 5.3.1 Using One Shell
Date: Tue, 28 Dec 2010 22:24:50 -0800

On Tue, Dec 28, 2010 at 9:59 PM, ali hagigat <address@hidden> wrote:
> 5.3.1 Using One Shell
> Second, you might want newlines to be included in your recipe command (for
> example perhaps you are using a very different interpreter as your SHELL).
> ------------------------------------------------------
> A different interpreter as SHELL or as /bin/sh?

Your default assumption should be that the manual means what it says.
It says SHELL, therefore it means SHELL.


> I do not understand the meaning of the sentence.

The normal (and default) SHELL is /bin/sh.  In /bin/sh, newline
doesn't have any unique syntactic functions: while you can separate
commands with newlines, you can also separate them with semicolons.
Ergo, the ability to pass a bare newline to the shell is not that
important: you can just use semicolons instead right now and .ONESHELL
isn't required.

However, some other so-called "scripting" languages do treat newline
uniquely, such that there a scripts you cannot write without using
literal newlines.  For example, that's true of csh.  Without
.ONESHELL, you cannot write those scripts as recipes.  With .ONESHELL,
you can.

So, .ONESHELL may be more useful or interesting to someone who is
interested in setting SHELL=/bin/csh or similar.



> Another question is weather i can use newline after each command for /bin/sh?
> In make 3.81, it must see <tab> character at the beginning of each
> line or it complains.

.ONESHELL is described as changing how the gathered recipe lines are
processed.  It does *NOT* say _anything_ about changing how makefiles
are otherwise parsed.  Ergo: no, the rules for how makefile are parsed
are *NOT* modified by .ONESHELL and you MUST precede each recipe line
with a tab.



Philip Guenther



reply via email to

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