*BSD News Article 69931


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.hawaii.edu!ames!agate!howland.reston.ans.net!news.cac.psu.edu!news.math.psu.edu!chi-news.cic.net!nntp.coast.net!oleane!francenet.fr!itesec!keltia.frmug.fr.net!not-for-mail
From: roberto@keltia.freenix.fr (Ollivier Robert)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Problem compiling a shared object
Date: 1 Jun 1996 09:25:21 GMT
Organization: Usenet Canal Historique
Lines: 28
Message-ID: <4op2a1$12f@keltia.freenix.fr>
References: <31AE9987.6F59@marben.be>
NNTP-Posting-Host: keltia.freenix.fr
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

 [courtesy cc of this posting sent to cited author via email]

In article <31AE9987.6F59@marben.be>,
Jean-Pierre Morant  <jpm@marben.be> wrote:
> gcc  -g -shared webcall.c ./display.o ./chaine.o ./frmdate.o
> ./pathfile.o ./des.o ./util.o -o ./webcall.so -I.

Look into /usr/share/mk/bsd.lib.mk to see how a shared library is created:

.if !defined(PICFLAG)
PICFLAG=-fpic
.endif

.c.so:
	${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
	@${LD} -O ${.TARGET} -x -r ${.TARGET}

SOBJS+= ${OBJS:.o=.so}
lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: ${SOBJS}
	@${ECHO} building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
	@rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
	@${LD} -Bshareable -x \
	    -o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
	    `lorder ${SOBJS} | tsort` ${LDDESTDIR} ${LDADD}

-- 
Ollivier ROBERT  -=- FreeBSD: The daemon is FREE! -=-  roberto@freebsd.org
-=-=-=-=-=-=-=-=-=-=- FreeBSD 2.x FAQ maintainer -=-=-=-=-=-=-=-=-=-=-=-=-