I have been googling around and either my google foo is weak today or there isn't a clear cut answer to my question out there.
I've got a few libraries that I link with when compiling my code and it looks something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
XLIBS += `pkg-config glibmm-2.4 --libs`
INCLUDES += -I../../Interfaces/myinterfaces
INCLUDES += -I../../Components/mylib
INCLUDES += -I../../Components/myotherlib
INCLUDES += -I../../Components/vpxlib
VPATH += ../../../../builds/latest/$(CFG)/libs
LIBS += -lmylib
LIBS += -lmyotherlib
LIBS += -lboost_thread
LIBS += -lboost_system
LIBS += -lvpx
LIBS += -lrt
FILES += Globals.cpp
FILES += MNDNetworkSettingsDlg.cpp
FILES += MTDNetworkDevice.cpp
OBJECTS = $(patsubst %.cpp,$(CFG)/%.o,$(FILES))
OUTDIR = ../../../../builds/latest/$(CFG)/
TARGET = $(OUTDIR)/dev_networkdevice.so
CTARGETS += $(DIRRES)/dev_networkdevice.mrf
.PHONY: clean all banner
all: depends target
clean:
@-rm -f *.gch $(CFG)/* $(TARGET) $(CTARGETS)
target: banner $(TARGET) $(CTARGETS)
$(TARGET): $(OBJECTS) $(LIBS)
@mkdir -p $(OUTDIR)
$(CXX) -shared -fPIC -g -Wl,--version-script=networkdevice.ver,-z,defs -o $@ -pthread $^ $(XLIBS) */
|
(Sorry for the weird c++ style comment error there...)
I've omitted a few minor details, let me know if I need to explain anything or give more sample code.
Anyway, my question is this: When I link with $(LIBS), the linker (or GNU Make or something...) translates -lmylib and -lmyotherlib to /pathtolib/libmylib.a and /pathtolib/libmyotherlib.a which is good, these are static libraries that I want to link with. There is no libmylib.so or libmyotherlib.so file in that directory (or anywhere else). Now I want to link with libboost_system.a, libboost_thread.a, libvpx.a and librt.a, but the folders where those libraries are located contain both libboost_system.a and libboost_system.so (same with the other libraries) and for some reason specifying -lboost_system always picks the .so file over the .a file.
I want -lboost_system to pick the .a file instead of the .so file without having to specify /usr/lib/libboost_system.a. Is that possible??
Please let me know if I'm being unclear or if you have any questions.
Any ideas, thoughts or input is welcome!
Thank you.