help-make
[Top][All Lists]
Advanced

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

RE : A way to emulate "Directory Search for Link Libraries"


From: patrice.elasri
Subject: RE : A way to emulate "Directory Search for Link Libraries"
Date: Thu, 28 Feb 2008 15:29:14 +0100

In fact, the « ls –d » command must be replaced py the macro realpath because « ls » sort the list of filepaths :

 

FileSearchLibPath = $(foreach __lib, $(1:-l%=%), \
  $(firstword $(realpath \
      $(foreach __pattern, $(.LIBPATTERNS), \
        $(foreach __dir, . $(subst :, , $(VPATH)) /lib /usr/lib $(prefix)/lib, $
(__dir)/$(shell echo "$(__pattern)" | sed "s,%,$(__lib),")) \
       ))))

 

 

-----Message d'origine-----
De : ELASRI Patrice SOFRECOM
Envoyé : jeudi 28 février 2008 14:42
À : 'address@hidden'
Objet : RE : A way to emulate "Directory Search for Link Libraries"

 

I found a surrounding solution by writting a macro which emulates the "Directory Search for Link Libraries" :

 

FileSearchLibPath = $(foreach __lib, $(1:-l%=%), \
  $(shell \
    ls -d \
      $(foreach __pattern, $(.LIBPATTERNS), \
        $(foreach __dir, . $(subst :, , $(VPATH)) /lib /usr/lib $(prefix)/lib, $
(__dir)/$(shell echo "$(__pattern)" | sed "s,%,$(__lib),")) \
       ) 2>/dev/null | sed "1s,//,/,g; q"))

 

Now, my rule looks like the following :

 

exe_target_file: object $(filter %.a, $(call FileSearchLibPath, $(LDLIBS))) | $(LDLIBS)

 

It seems not necessary to call the macro with filter-out to get dynamic libraries, because gmake removes prerequisites which already exist on the dependences line.

 

However, this solution increases greatly the processing time.

 

 

-----Message d'origine-----
De : ELASRI Patrice SOFRECOM
Envoyé : jeudi 28 février 2008 11:49
À : 'address@hidden'
Objet : A way to emulate "Directory Search for Link Libraries"

 

Hello,

 

In order not to recompile the target when one dynamic library has changed, I decided to separate dynamic from static libraries in the rule’s prerequisites, as following :

 

exe_target_file: object static_libraries | dynamic_libraries

 

However, the library list is stored in a unique variable $(LDLIBS), under the following form “-lname”.

So my problem is to filter the static libraries from the result of the "Directory Search for Link Libraries", applied to this variable content.

To do that, I need to emulate/perform this operation before applying the filter function :

 

exe_target_file: object $(filter %.a, $(dir_search $(LDLIBS))) | $(filter-out %.a, $(dir_search $(LDLIBS)))

Does someone have any idea to resolve this problem ?


reply via email to

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