I have sourced a function 'xmsubdirs' into my current shell and was expecting it to be available from a makefile rule but it is not.
The Gnu make manual doesn't seem to address this issue; it simply addresses the use of shell environmental variables.
Functions are exported to subshells in bash; why isn't make able to access them?

--- Makefile:

.PHONY: foo goo boo moo

boo :
@xmsubdirs

# i tried treating xmsubdirs like a variable
moo :
@$(xmsubdirs)

foo :
@echo $(shell $(xmsubdirs))

goo :
@echo $$(xmsubdirs)

--- output

[greg@p3 test]$ xmsubdirs
foo.html.xm goo junkme moo.xm project
[greg@p3 test]$ make boo
make: xmsubdirs: Command not found
make: *** [boo] Error 127
[greg@p3 test]$ make moo
make: Nothing to be done for `moo'.
[greg@p3 test]$ make foo

[greg@p3 test]$ make goo
/bin/sh: xmsubdirs: command not found

--- function source

function xmsubdirs(){
[ -z "$1" ] && set .
XMLMAKE_BUILD_EXCLUDE_DIRS_RE='(^CVS$)|(^trash$)'
if [[ ! -z "$XMLMAKE_BUILD_EXCLUDE_DIRS_RE" ]]
then
export CURRENT_SUBDIRS=$(find "$1" -name '*' -type d -maxdepth 1| xargs --replace=d basename d | grep -v -E $XMLMAKE_BUILD_EXCLUDE_DIRS_RE)
else
export CURRENT_SUBDIRS=$(find "$1" -name '*' -type d -maxdepth 1| xargs --replace=d basename d )
fi
echo ${CURRENT_SUBDIRS}
}

Thanks,
Greg Keraunen



_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to