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
À : '[email protected]'
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
À : '[email protected]'
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 ?

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

Reply via email to