Compiling only shared libraries?
Roland Smith
rsmith at xs4all.nl
Tue Dec 22 14:06:25 UTC 2009
On Mon, Dec 21, 2009 at 03:00:27PM -0800, Matthew Fleming wrote:
> We have a bunch of libraries to support our product and as far as I know
> we only link to the shared library version. I'd like to skip the build
> of the static version of our libraries to speed up our builds and save
> on disk space, but I don't see any way to do that via directives in the
> Makefiles. I didn't see anything in bsd.lib.mk which would indicate
> this can be done.
>
> Is this even possible?
Just write your own Makefile. See the snippets below;
BASENAME = foo
VERSION_MAJOR = 1
VERSION_MINOR = 0
...
OBJS = bar.o baz.o ...
...
SHARED = lib$(BASENAME).so.$(VERSION_MAJOR).$(VERSION_MINOR)
...
# build the shared library
$(SHARED): $(OBJS)
cc -shared -Wl,-soname,lib$(BASENAME).so.$(VERSION_MAJOR) \
-o $(SHARED) $(OBJS) $(LIBS)
strip -g --strip-unneeded $(SHARED)
Roland
--
R.F.Smith http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20091222/f471f87e/attachment.pgp
More information about the freebsd-questions
mailing list