[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: how to improve compactness?

From: Warlich, Christof
Subject: RE: how to improve compactness?
Date: Fri, 4 May 2012 06:44:55 +0200

Hi Matej,

> In my Makefile, I have a series of lines like this:
>       dir := src/foo-01
>       include $(dir)/
>       dir := src/foo-02
>       include $(dir)/
>       dir := src/foo-03
>       include $(dir)/
>       ...
> As I add new and new foo-directories, I have to add new entries to the
> Makefile.
> At "make time", I can enumerate existing foo-directories with
>       $(wildcard src/foo-*)
> but I do not know how to generate those Makefile directives because
> parametrical variables and $(foreach ...) can only expand to one-line
> text where I need expansion to two lines.

Multi-line variables will do the trick, something along the lines:

define DIRS
    dir := src/%1
    include $(dir)/

$(foreach i,foo-01 foo-02 foo-03,$(eval $(call DIRS,$i)))

Hope this helps. Cheers,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]