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:
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
@-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!