Cannot call bash function inside makefile
bash, gnu-make, makefile
Solution
Use `$*` in your BASH script:
functions.sh
_my_function() {
echo $1
}
# Allows to call a function based on arguments passed to the script
$*
Makefile
test:
./functions.sh _my_function "hello!"
Running example:
$ make test
./functions.sh _my_function "hello!"
hello!
Problem
I have an impression that I can call bash function inside GNU makefile, but seems wrong. Here is a simple test, I have this function defined: ``` >type lsc lsc is a function lsc () { ls --color=auto --color=tty } ``` Here is my Makefile: ``` >cat Makefile all: lsc ``` Here is what I get in running make: ``` >make lsc make: lsc: Command not found make: *** [all] Error 127 ``` Is my impression wrong? Or is there any env setup issue? I can run "lsc" at the command line.