Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Dec 2009 15:06:22 +0100
From:      Roland Smith <rsmith@xs4all.nl>
To:        Matthew Fleming <matthew.fleming@isilon.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Compiling only shared libraries?
Message-ID:  <20091222140622.GA50797@slackbox.xs4all.nl>
In-Reply-To: <06D5F9F6F655AD4C92E28B662F7F853E035236DA@seaxch09.desktop.isilon.com>
References:  <06D5F9F6F655AD4C92E28B662F7F853E035236DA@seaxch09.desktop.isilon.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--u3/rZRmxL6MmkK24
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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.
>=20
> Is this even possible?

Just write your own Makefile. See the snippets below;

BASENAME =3D foo
VERSION_MAJOR =3D 1
VERSION_MINOR =3D 0
=2E..
OBJS =3D bar.o baz.o ...
=2E..
SHARED            =3D lib$(BASENAME).so.$(VERSION_MAJOR).$(VERSION_MINOR)
=2E..
# 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
--=20
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)

--u3/rZRmxL6MmkK24
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (FreeBSD)

iEYEARECAAYFAksw0l0ACgkQEnfvsMMhpyXSigCfY4uzMXpgbERwl1QsLE8xZylh
XGcAoKcc3MW9Ecs7NshmQxCD+WEi4Y2n
=4f76
-----END PGP SIGNATURE-----

--u3/rZRmxL6MmkK24--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091222140622.GA50797>