|
From: | Maxim Yegorushkin |
Subject: | Re: Request for review of failing makefile |
Date: | Fri, 18 Dec 2009 18:10:19 +0000 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20090922 Fedora/3.0-3.9.b4.fc12 Thunderbird/3.0b4 |
On 18/12/09 14:04, David Aldrich wrote:
Hi Maxim and Bart Thanks very much for reviewing my makefile. Your suggestion of an extra command did indeed solve my problem. That's great.
Pleasure.
My reason for not replying sooner is that I am testing other parts of the makefile. What I sent was actually a simplified version. The real version had: .PHONY : release release : $(OBJDIR_R)/$(EXEFILE) <snip> $(OBJDIR_R)/$(EXEFILE) : $(ARCHIVES_R) $(CXX) -o $(OBJDIR_R)/$(EXEFILE) -ldl -Wl,-whole-archive,-export-dynamic $(ARCHIVES_R) $(EXTRA_LIBS_R) <snip> $(ARCHIVES_R) $(ARCHIVES_D) : versioninfo $(STATIC_LIBS) $(DYNAMIC_LIBS) Now $(ARCHIVES_R) contains the paths of the static libraries. I can see no reason why this should depend on $(DYNAMIC_LIBS) (some code of the program is linked in dynamic libraries so that we can selectively load it). So I think better rules would be: .PHONY : release release : $(OBJDIR_R)/$(EXEFILE) $(DYNAMIC_LIBS) versioninfo <snip> $(OBJDIR_R)/$(EXEFILE) : $(ARCHIVES_R) $(CXX) -o $(OBJDIR_R)/$(EXEFILE) -ldl -Wl,-whole-archive,-export-dynamic $(ARCHIVES_R) $(EXTRA_LIBS_R) <snip> $(ARCHIVES_R) $(ARCHIVES_D) : $(STATIC_LIBS)
Well, whether your static libraries depend on the dynamic libraries depends on whether this dependency really exists. It is conceivable that any of your static libraries could load any of the dynamic libraries at run-time, so that in this case such a dependency does exist. However, it is likely that this dependency have already been specified in the makefile that builds the static and dynamic libraries as it should, so that it does not need to be repeated in another makefile.
(versionInfo is a small utility that we also want built.
versionInfo could simply be a plain text file with versions of executables and shared libraries. The link rule would extract the corresponding version of the binary being linked from that text file (grep, sed, awk, ...) and embed that version into the binary. Updating this text file would trigger a relink (a complete relink though, so it should not be updated too often). Something like:
lib/libsome.so 1.2.3 bin/some_app 2.3.4 -- Max
[Prev in Thread] | Current Thread | [Next in Thread] |