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 [EMAIL PROTECTED]
)

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* <http://www.mailscanner.info/>, and is
believed to be clean.
------------------------------------------------------------------------

_______________________________________________
Help-make mailing list
Help-make@gnu.org
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: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.
------------------------------------------------------------------------

_______________________________________________
Help-make mailing list
Help-make@gnu.org
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: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

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

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

Reply via email to