2013年8月28日星期三

How to use the SHELL makefile custom functions

For example, I opened a SHELL, defines such a function function myls {ls-l;}, and then build a MAKEFILE, reads as follows:
all:
myls
Then I run make will be prompted to make: myls: Command not found

Please help facie, thank you!
------ Solution ---------------------------------------- ----
makefile inside SHELL = / bin / bash
------ For reference only ----------------- ----------------------
define myls
ls-l
endef

all:
$ (myls)
------ For reference only ------------------------ ---------------
Thank you to answer, but I want to be able to directly use the SHELL function is not redefined in the Makefile, or directly to me like ls-l .
------ For reference only -------------------------------------- -
all:
source cmd_file; myls
------ For reference only ----------------------- ----------------
crux of the problem is that there is no way to directly use the SHELL function already defined, rather than in the Makefile think of any way to rebuild the function.
I actually want to use Andrews mmm, found directly in the Makefile can not directly use, I can go to source the script file, but the script starts a little slow, so do not want to do so, can directly use the defined function SHELL best, do not support this feature?
------ For reference only -------------------------------------- -
shell terminal export-f myls
------ For reference only ----------------------- ----------------
this method for the re-opening SHELL be useful, but Makefile invalid
------ For reference only ----- ----------------------------------
fact, I want to answer that, do not know the current SHELL What's in a function, makefile in use can be inherited, just as an environment variable, but so far no such answer, you first so be it.

没有评论:

发表评论