[Top][All Lists]

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

Re: shell functions from env not available in make?

From: Soren A
Subject: Re: shell functions from env not available in make?
Date: Thu, 12 Dec 2002 14:51:45 +0000 (UTC)
User-agent: Xnews/L5

gk <address@hidden> wrote around 25 Oct 2002

> I have just found the answer to the problem:
> export -f function_name

Good work!

You'd also want to be aware of `declare -F' and `declare -f', which
print the functions defined in the current shell (no distinction about
whether they are exported or not, AFAIK) respectively without and with
the bodies of the functions appearing. You could even use this early in
your Makefile to ensure that the shell function you want is even
defined, before going any further. You could use a $(warning ...) or
even an $(error ...) if it isn't defined.

> The confusing thing is that 'set' command shows the function as a
> 'shell variable' in subshells, even without the export command.
> But 'env' command does not show the function name until you use export
> -f That is what make requires apparently.
> My /bin/sh is a link to /bin/bash

This worries me just a tiny bit. AFAICR, bash is written so as to behave
a bit differently if invoked as 'sh' instead of 'bash'. Just HOW so, I
do not recall (RTFM). But as long as you are going to such lengths <g>
anyway in your Makefile, why not explicitly set the shell you need so
that you don't have to worry about it:

 SHELL = /bin/bash

                Soren A

"Better the pride that resides, in a citizen of the world.
 Than the pride that divides, when a colorful rag is unfurled."
                           -- Neil Peart of Rush

reply via email to

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