Another problem  :-(  :
this code

store/$(DIR)/%.c: src1/$(DIR)/%.c src2/$(DIR)/%.c


assumes that both files

src1/$(DIR)/%.c and src2/$(DIR)/%.c


exist. In my case some file in src1 or src2 may not exist (*** no rule to make 
target src1(or 2)/$(DIR)/somefile.c error ***). How can I write some generic 
rule to indicate that store/$(DIR)/%.c depends only on one of 2 files in the 
source folders?
Thanks for your help guys.

Dave Korn wrote:
Boris Godin wrote on 11 June 2008 17:00:

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 $@;\
)

  Yep.  Look up how to use 'define' to make a multi-line variable
definition.  Then use a function call to insert each value of dir into it.
It'll end up looking something roughly like this (untested):

define make_store

store/$(1)/%.c: src1/$(1)/%.c src2/$(1)/%.c;
        @echo make combination to $@;

endef

$(eval $(foreach DIR,$(DIRS_SOURCES),$(call make_store,$(DIR))))


    cheers,
      DaveK

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

_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to