Dear Paul,

Many thanks for your so prompt and helpful response!

Paul Smith (2017/03/21 08:31 -0400):
> On Tue, 2017-03-21 at 13:18 +0100, Sébastien Hinderer wrote:
> > define INCLUDE
> >   curdir := $(1)
> >   include $(1)/Makefile
> >   unset curdir

(That should have been undefine, by the way)

> > 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.

Okay.

> You need eval for that:
> 
>   $(foreach d,$(subdirectories),$(eval $(call INCLUDE,$(d))))

Ah, thanks! Actually I was aware of eeval but did not realise its link
with what I was trying to do. Reading its documentation with this new
light makes everything much clearer. Thaks again!

Sébastien.

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

Reply via email to