[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Make: Filtering prerequisites
From: |
Paul D. Smith |
Subject: |
RE: Make: Filtering prerequisites |
Date: |
Fri, 7 Apr 2006 12:42:56 -0400 |
%% "Smirnov Dmitry" <address@hidden> writes:
sd> Let's increase complexity: suppose I have few different source lists and
sd> compiled object should be placed in different directories (we need 2
sd> rules obviously? dir3/subdir3/%.o and dir4/subdir4/%.o)
sd> Those source lists MAY contain files that have equal file names.
sd> How could I use VPATH in this case?
You can't. In this situation you'll have to use a bigger hammer.
I think you'll need to move to eval in this case. Something like:
SOURCES_1 = ...
SOURCES_2 = ...
COMPILE = $(CC) $(CFLAGS) -c -o $@ $<
$(foreach S,$(SOURCES_1),$(eval dir3/subdir3/$(basename $(notdir $(S))).o :
$(S) ; $(value COMPILE)))
$(foreach S,$(SOURCES_2),$(eval dir4/subdir4/$(basename $(notdir $(S))).o :
$(S) ; $(value COMPILE)))
(Note: not tested!) Of course you can also use $(call ...) and define
and make an outer loop for the dir3, dir4 stuff, which might be cleaner.
You'll have to play with the escaping needed to get what you want
though.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist