bug-bash
[Top][All Lists]
Advanced

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

Re: How to call a new bash function within a makefile


From: Paul D. Smith
Subject: Re: How to call a new bash function within a makefile
Date: 14 Nov 2005 00:20:56 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

%% OnMyWayHome <blank@blank.org> writes:

  o> I don't have gnu.bash on my newsgroup server, so I'm posting this here.
  o> Here is an example GNU makefile:

  o> function DoThis()
  o> {
  o>      echo $0
  o> }

  o> all :
  o>      DoThis "Test"

  o> I've seen this done before where a bash function is defined within a
  o> makefile, and can be subsequently called when a target is matched.

You must have been imagining things :-)

This is not, and never has been supported.  At least, not in GNU make.
Makefiles must contain make syntax.  They cannot contain shell
functions.


I mean, I guess you could do something like this:

    defineDoThis = function DoThis() { echo $0; }

    all:
            $(defineDoThis); DoThis "Test"

but I doubt that's what you're looking for.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@gnu.org>          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]