help-make
[Top][All Lists]
Advanced

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

RE: Make: Filtering prerequisites


From: Smirnov Dmitry
Subject: RE: Make: Filtering prerequisites
Date: Fri, 7 Apr 2006 20:53:41 +0400

Is the any new feature in 3.81 that addresses and simplifies solution
for this issue?

Well, the case when the source list can contain files with equal name I
will try to do myself :) Just because it is not blocking me right now...

Best regards,
Dmitry

-----Original Message-----
From: Paul Smith [mailto:address@hidden On Behalf Of Paul D. Smith
Sent: Friday, April 07, 2006 8:43 PM
To: Smirnov Dmitry
Cc: address@hidden
Subject: RE: Make: Filtering prerequisites

%% "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




reply via email to

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