help-make
[Top][All Lists]
Advanced

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

Multiple target patterns


From: Boris Godin
Subject: Multiple target patterns
Date: Wed, 11 Jun 2008 10:43:32 -0300
User-agent: Thunderbird 2.0.0.14 (Windows/20080421)

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.

reply via email to

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