On Tue, 2017-03-21 at 13:18 +0100, Sébastien Hinderer wrote:
> define INCLUDE
>   curdir := $(1)
>   include $(1)/Makefile
>   unset curdir
> endef
> 
> # List of subdirectories containing a Makefile that should be included
> 
> subdirectories := foo bar baz
> 
> # Include all the specified sub-makefiles
> $(foreach subdirectory, $(subdirectories), $(call INCLUDE, $(subdirectory)))

The expansion of the foreach loop has to be a valid single line of
makefile syntax; it will be considered a logical line.  You can't use
call to invoke a multiline function containing make syntax like this.

You need eval for that:

  $(foreach d,$(subdirectories),$(eval $(call INCLUDE,$(d))))


_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to