help-make
[Top][All Lists]
Advanced

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

Re: Multiple target patterns


From: Boris Godin
Subject: Re: Multiple target patterns
Date: Wed, 11 Jun 2008 13:00:20 -0300
User-agent: Thunderbird 2.0.0.14 (Windows/20080421)

Guys, i have a new problem:
this code transforms all into one single line,

$(foreach DIR,$(DIRS_SOURCES),\
store/$(DIR)/%.c: src1/$(DIR)/%.c src2/$(DIR)/%.c;  \
       @echo make combination to $@;\
)

in this case

store/./%.c: src1/./%.c src2/./%.c;  @echo make combination to $@; store/dir1/%.c: src1/dir1/%.c src2/dir1/%.c;  @echo make combination to $@; store/dir2/%.c: src1/dir2/%.c src2/dir2/%.c;  @echo make combination to $@;

so make thinks that I'm specifying 1 multiple target pattern. Is it possible to insert line break, or some symbol so the make could know that this are 3 multiple target pattern and not 1?

Awaiting for comments xD


Boris Godin wrote:
Figured it out!!!
as $foreach process all into one single string there is need to put ; after depending files, like this:

$(foreach DIR,$(DIRS_SOURCES),\
store/$(DIR)/%.c: src1/$(DIR)/%.c src2/$(DIR)/%.c ; \
       @echo make combination to address@hidden
)

Cheers.


Boris Godin wrote:
Hi,
I have a problem creating makefile with multple target patterns.
Suppose we 2 source folders with files and folders with same names:
  src1/a.c               src2/a.c
  src1/dir1/foo.c     src2/dir1/foo.c
  src1/dir2/bar.c     src2/dir2/bar.c
Suppose we need somehow to combine every par of files we have there into a 3rd directory, say store (directories dir1 and dir2 are already created inside store).

My idea was to use multiple target patterns, using foreach for directories.

DIRS_SOURCES = . dir1 dir2

$(foreach DIR,$(DIRS_SOURCES),\
store/$(DIR)/%.c: src1/$(DIR)/%.c src2/$(DIR)/%.c
       @echo make combination to $@
)

But this is not working. How can I create such generic makefile without writing

store/%.c: src1/%.c src2/%.c
store/dir1/%.c: src1/dir1/%.c src2/dir1/%.c
store/dir2/%.c: src1/dir2/%.c src2/dir2/%.c

because, i already have many directories inside src1 and src2, and maybe i need to add some other directory fast.
Anyone? xD
Thanks.


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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


--
Boris Godin
Java Developer - Gameloft COR
Paraná 560, Nueva Córdoba (CP 5000)
Tel.: (+54 0351) 460 26 26 int. 111
MSN:
address@hidden

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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


--
Boris Godin
Java Developer - Gameloft COR
Paraná 560, Nueva Córdoba (CP 5000)
Tel.: (+54 0351) 460 26 26 int. 111
MSN:
address@hidden

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

reply via email to

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