tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: PCC in build.sh
On Thu, Aug 14, 2008 at 01:00:45PM +1000, Gregory McGarry wrote:
> The build system currently doesn't provide itself with hooks for an
> alternative compiler. Here's what I did for PCC:
>
> - HAVE_GCC and HAVE_PCC variables control which compiler will be
> used. defaults to HAVE_GCC = 4
I'll note that support for gcc 3 isn't supported anymore.
> - MKPCC variable controls whether PCC is compiled during the build
>
> For build.sh:
>
> - PCC compiles the do-gnu-lib-crtstuff4 target, although this code
> actually appears to be NetBSD code, not GNU code.
> - there are no c++ nor objc compilers in PCC, so these host tools use
> false(1)
> - a directory tools/pcc is created to build a host tool
>
> It seems to work reasonably well. Is there a fundamental problem
> with this approach?
See below.
> Index: Makefile
> ===================================================================
> RCS file: /cvsroot/src/Makefile,v
> retrieving revision 1.255
> diff -u -r1.255 Makefile
> --- Makefile 29 Jul 2008 13:17:40 -0000 1.255
> +++ Makefile 13 Aug 2008 23:02:20 -0000
> @@ -84,6 +84,8 @@
> # do-libgcc: builds and installs prerequisites from
> # gnu/lib/crtstuff${LIBGCC_EXT} (if necessary) and
> # gnu/lib/libgcc${LIBGCC_EXT}.
> +# do-libpcc: builds and install prerequisites from
> +# ??? (if necessary) and ???.
> # do-lib-libc: builds and installs prerequisites from lib/libc.
> # do-lib: builds and installs prerequisites from lib.
> # do-gnu-lib: builds and installs prerequisites from gnu/lib.
> @@ -179,11 +181,13 @@
> #
> # Targets (in order!) called by "make build".
> #
IMHO the following part should be changed, since gcc3 isn't supported anymore.
> -.if ${HAVE_GCC} == "3"
> +.if defined(HAVE_GCC)
> +.if (${HAVE_GCC} == "3")
> LIBGCC_EXT=3
> .else
> LIBGCC_EXT=4
> .endif
> +.endif
[..]
> @@ -358,20 +369,48 @@
> @true
> .endfor
>
The following patch isn't correct, gnu/lib/crtstuff4 and gnu/lib/libgcc4 have
to be keept in that order. And LIBGCC_EXT isn't needed anymore, where removing
the gcc3 support should be done in another step.
I would add something like this before the 'for dir' loop (not tested):
.if defined(HAVE_GCC)
BUILD_CC_LIB= gnu/lib/libgcc${LIBGCC_EXT}
.elif defined(HAVE_PCC)
BUILD_CC_LIB= dist/pcc-libs
.endif
and then keep the crtstuff entry and use ${BUILD_CC_LIB} instead of
gnu/lib/libgcc${LIBGCC_EXT}
Alternative use this to replace 'gnu/lib/crtstuff${LIBGCC_EXT}
gnu/lib/libgcc${LIBGCC_EXT}':
.if defined(HAVE_GCC)
BUILD_CC_LIB= gnu/lib/crtstuff${LIBGCC_EXT}
BUILD_CC_LIB+= gnu/lib/libgcc${LIBGCC_EXT}
.elif defined(HAVE_PCC)
BUILD_CC_LIB= gnu/lib/crtstuff${LIBGCC_EXT}
BUILD_CC_LIB+= dist/pcc-libs
.endif
> -.for dir in tools tools/compat lib/csu gnu/lib/crtstuff${LIBGCC_EXT}
> gnu/lib/libgcc${LIBGCC_EXT} lib/libc lib/libdes lib gnu/lib external/
> lib sys/rump/fs/lib
> +.for dir in tools tools/compat lib/csu lib/libc lib/libdes lib
> external/lib sys/rump/fs/lib
> do-${dir:S/\//-/g}: .PHONY .MAKE
> .for targ in dependall install
> ${MAKEDIRTARGET} ${dir} ${targ}
> .endfor
> .endfor
This part isn't needed anymore with the above change:
> +.if defined(HAVE_GCC)
> +.for dir in gnu/lib/crtstuff${LIBGCC_EXT} gnu/lib/libgcc$
> {LIBGCC_EXT} gnu/lib
> +do-${dir:S/\//-/g}: .PHONY .MAKE
> +.for targ in dependall install
> + ${MAKEDIRTARGET} ${dir} ${targ}
> +.endfor
> +.endfor
> +.endif
> +
> +.if defined(HAVE_PCC)
> +.for dir in gnu/lib/crtstuff4 dist/pcc-libs
> +do-${dir:S/\//-/g}: .PHONY .MAKE
> +.for targ in dependall install
> + ${MAKEDIRTARGET} ${dir} ${targ}
> +.endfor
> +.endfor
> +.endif
> +
You haven't changed gnu/lib/Makefile for adding HAVE_PCC support there, since
crtstuff4 is needed in the non MKGCC case.
Bernd
Home |
Main Index |
Thread Index |
Old Index