Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Apr 2002 11:26:51 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Peter Wemm <peter@wemm.org>, "David O'Brien" <obrien@FreeBSD.org>, "M. Warner Losh" <imp@village.org>
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   PROG_CXX (was: Re: cvs commit: src/gnu/usr.bin/gperf Makefile src/gnu/usr.bin/groff/src/devices/grodvi Makefile src/gnu/usr.bin/groff/src/devices/grohtml Makefile src/gnu/usr.bin/groff/src/devices/grolbp Makefile sr)
Message-ID:  <20020412082651.GB75003@sunbay.com>
In-Reply-To: <20020411.201930.119969734.imp@village.org> <20020411215117.20D553810@overcee.wemm.org>
References:  <20020411051528.8663638FD@overcee.wemm.org> <20020411093353.GA42484@sunbay.com> <20020411135740.A13856@dragon.nuxi.com> <20020411.201930.119969734.imp@village.org> <20020411135740.A13856@dragon.nuxi.com> <20020411215117.20D553810@overcee.wemm.org>

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

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

> In message: <20020411135740.A13856@dragon.nuxi.com>
>             "David O'Brien" <obrien@FreeBSD.org> writes:
> > On Thu, Apr 11, 2002 at 12:33:53PM +0300, Ruslan Ermilov wrote:
> > > +.if defined(PROG_CXX)
> > > +PROG=3D	${PROG_CXX}
> > > +DPADD+=3D	${LIBSTDCPLUSPLUS}
> > > +LDADD+=3D	-lstdc++
> > > +.endif
> >=20
> > We really should not be doing this part -- we do not do it for libc.
> > Making too many assumptions about how G++ expects the linking to be is
> > bad.  Rather if PROG_GXX is set, 'g++' should be used for linking rather
> > than 'gcc' [as Peter mentioned].  We really should just be letting g++ =
do
> > its job.

On Thu, Apr 11, 2002 at 02:51:17PM -0700, Peter Wemm wrote:
>=20
> That's what I did, except I used c++.  (we use "cc" not "gcc", we shouldn=
't
> use "g++" either).  The main point is that this can be changed behind the
> scenes without affecting the groff/gperf makefiles anymore.  This is now
> an implementation detail.  I can finish my build testing and commit the
> stuff that uses c++ etc to do the final link.
>=20
I also thought about this last night.  Linking with c++ is _required_ for
static linkage of C++ programs to work; libstdc++.a depends on libm.a, and
c++ is "smart" enough to call linker with -lstdc++ -lm (it should probably
be doing this in the -static case only anyway).  Should be fixed in 1.108.

This brings another question [for BDE].  Should be convert all usages of
-lfoo to ${MINUSLFOO}, similar to the way we do it for ${MINUSLPAM}, to
avoid doing this extra work in each individual makefile when it fails to
compile statically.

On Thu, Apr 11, 2002 at 08:19:30PM -0600, M. Warner Losh wrote:
>=20
> +.if defined(PROG_CXX)
> +PROG=3D	${PROG_CXX}
> +.endif
>=20
> Is almost right, but we have:
>=20
> ${PROG}: ${OBJS}
> 	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD}
>=20
> Redefining CC to be g++ isnt' right, because it uses CFLAGS rather
> than CXXFLAGS.  In the current setup, it doesn't matter.
>=20
> So we'd need
>=20
>  ${PROG}: ${OBJS}
> +.if defined(PROG_CXX)
> +	${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDAD=
D}
> +.else
> 	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD}
> +.endif
>=20
> to be more correct, but we need that in at least two places in
> bsd.prog.mk since we duplicate the code.  Oh, wait, the second one
> isn't quite right either, since we need to also support PROG_CXX w/o
> defining SRCS.
>=20
I've fixed the unnecessary duplication as well.


Cheers,
--=20
Ruslan Ermilov		Sysadmin and DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

--MfFXiAuoTsnnDAfZ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org

iD8DBQE8tppKUkv4P6juNwoRAq2+AJsFiGyO8YtxehECi7EgP3Jou43BNACeIria
wptQOEpPhORgXlffVCLUypo=
=NifZ
-----END PGP SIGNATURE-----

--MfFXiAuoTsnnDAfZ--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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