System static library dependency
vshab opened this issue · 6 comments
Hello, Christophe!
I really like this project and want to say thank you for your work! But I wasn't able to find how to specify static libraries for the product. I mean how to pass -L and -l options to the linker?
This depends on the extension. When you set PRODUCTS
to foo.lib
, you get a static library. If you set it to foo.dll
, then it builds a shared library. And for a program, you use foo.exe
.
The rules for building these are defined in config.gnu.mk
, check MAKE_LIB
, MAKE_DLL
and MAKE_EXE
. The actual extension for the product is set in LIB_EXT
, DLL_EXT
and EXE_EXT
in the same file.
I've updated the documentation to clarify this feature, see 8bbf812. Please re-open if you are not satisfied with the answer.
I forgot to mention, if you need to specify the path for libraries to link, use the LIBRARIES
variable.
Thanks for quick response. Not exactly what I meant.
I want to statically link system library to my program. For example libboost_system.so
.
My current Makefile is:
BUILD=build/
SOURCES=main.cpp
PRODUCTS=program.exe
INCLUDES=/usr/local/include
LIBRARIES=/usr/local/lib/
include $(BUILD)rules.mk
Where to put boost_system
library dependence so that linker would link it?
And sorry, seems like I can't reopen this issue.
Oh, that would be LDFLAGS
then.
By the way, LIBRARIES
should use full library paths, and is intended to build dependent libraries in hierarchical projects. For example, the top could have
LIBRARIES=foo/foo.a bar/bar.a
The difference between SUBDIRS
and LIBRARIES
being that SUBDIRS
are always rebuilt, whereas LIBRARIES
are only rebuilt if they are missing, unless you specify a "deep" build.
Okay, thank you. Now it's clear.