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: Thu, 12 Jun 2008 11:04:06 -0300
User-agent: Thunderbird 2.0.0.14 (Windows/20080421)

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.

reply via email to

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