diff --git a/share/mk/Makefile b/share/mk/Makefile index 9d16a3b2f3c6..a312c7e422ce 100644 --- a/share/mk/Makefile +++ b/share/mk/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.36 2003/01/05 23:37:02 sommerfeld Exp $ +# $NetBSD: Makefile,v 1.37 2003/05/31 20:33:17 thorpej Exp $ # @(#)Makefile 8.1 (Berkeley) 6/8/93 NOOBJ= # defined @@ -7,10 +7,10 @@ NOOBJ= # defined .if ${MKSHARE} != "no" FILES= bsd.README bsd.doc.mk bsd.dep.mk bsd.endian.mk bsd.files.mk \ - bsd.hostlib.mk bsd.hostprog.mk bsd.inc.mk bsd.info.mk bsd.init.mk \ - bsd.kernobj.mk bsd.kinc.mk bsd.kmod.mk bsd.lib.mk bsd.links.mk \ - bsd.man.mk bsd.nls.mk bsd.obj.mk bsd.own.mk bsd.prog.mk bsd.rpc.mk \ - bsd.shlib.mk bsd.subdir.mk bsd.sys.mk sys.mk + bsd.gcc.mk bsd.hostlib.mk bsd.hostprog.mk bsd.inc.mk bsd.info.mk \ + bsd.init.mk bsd.kernobj.mk bsd.kinc.mk bsd.kmod.mk bsd.lib.mk \ + bsd.links.mk bsd.man.mk bsd.nls.mk bsd.obj.mk bsd.own.mk bsd.prog.mk \ + bsd.rpc.mk bsd.shlib.mk bsd.subdir.mk bsd.sys.mk sys.mk FILESDIR=/usr/share/mk .endif diff --git a/share/mk/bsd.README b/share/mk/bsd.README index dd66cc2d6dc7..5e32791a6ab6 100644 --- a/share/mk/bsd.README +++ b/share/mk/bsd.README @@ -1,4 +1,4 @@ -# $NetBSD: bsd.README,v 1.112 2003/05/30 18:43:24 thorpej Exp $ +# $NetBSD: bsd.README,v 1.113 2003/05/31 20:33:16 thorpej Exp $ # @(#)bsd.README 8.2 (Berkeley) 4/2/94 This is the README file for the new make "include" files for the BSD @@ -425,6 +425,32 @@ SHLINKDIR Path to use for shared linker when building a program. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +The include file computes various parameters related to GCC +support libraries. It defines no targets. MUST be included +before bsd.gcc.mk. + +The primary users of bsd.gcc.mk are and , each +of which need to know where to find certain GCC support libraries. + +The behavior of bsd.gcc.mk is influenced by the EXTERNAL_TOOLCHAIN variable, +which is generally set by the user. If EXTERNAL_TOOLCHAIN it set, then +the compiler is asked where to find the support libraries, otherwise the +support libraries are found in ${DESTDIR}/usr/lib. + +bsd.gcc.mk sets the following variables: + +_GCC_CRTBEGIN The full path name to crtbegin.o. + +_GCC_CRTBEGINS The full path name to crtbeginS.o. + +_GCC_CRTEND The full path name to crtend.o. + +_GCC_CRTENDS The full path name to crtendS.o. + +_GCC_LIBGCCDIR The directory where libgcc.a is located. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + The include file handles building programs from one or more source files, along with their manual pages. It has a limited number of suffixes, consistent with the current needs of the BSD tree. bsd.prog.mk diff --git a/share/mk/bsd.gcc.mk b/share/mk/bsd.gcc.mk new file mode 100644 index 000000000000..a33bdb2353ca --- /dev/null +++ b/share/mk/bsd.gcc.mk @@ -0,0 +1,20 @@ +# $NetBSD: bsd.gcc.mk,v 1.1 2003/05/31 20:33:15 thorpej Exp $ + +.if !defined(_BSD_GCC_MK_) +_BSD_GCC_MK_=1 + +.if defined(EXTERNAL_TOOLCHAIN) +_GCC_CRTBEGIN!= ${CC} --print-file-name=crtbegin.o +_GCC_CRTBEGINS!= ${CC} --print-file-name=crtbeginS.o +_GCC_CRTEND!= ${CC} --print-file-name=crtend.o +_GCC_CRTENDS!= ${CC} --print-file-name=crtendS.o +_GCC_LIBGCCDIR!= dirname `${CC} --print-libgcc-file-name` +.else +_GCC_CRTBEGIN= ${DESTDIR}/usr/lib/crtbegin.o +_GCC_CRTBEGINS= ${DESTDIR}/usr/lib/crtbeginS.o +_GCC_CRTEND= ${DESTDIR}/usr/lib/crtend.o +_GCC_CRTENDS= ${DESTDIR}/usr/lib/crtendS.o +_GCC_LIBGCCDIR= ${DESTDIR}/usr/lib +.endif + +.endif # ! defined(_BSD_GCC_MK_) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 257f1a6e419f..8734ae147fc0 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -1,8 +1,9 @@ -# $NetBSD: bsd.lib.mk,v 1.218 2003/05/27 19:32:18 wiz Exp $ +# $NetBSD: bsd.lib.mk,v 1.219 2003/05/31 20:33:16 thorpej Exp $ # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 .include .include +.include ##### Basic targets .PHONY: checkver cleanlib libinstall @@ -152,14 +153,8 @@ MKSHLIBOBJS= no .if ${OBJECT_FMT} == "ELF" SHLIB_SOVERSION= ${SHLIB_MAJOR} SHLIB_SHFLAGS= -soname lib${LIB}.so.${SHLIB_SOVERSION} -SHLIB_LDSTARTFILE?= ${DESTDIR}/usr/lib/crti.o ${DESTDIR}/usr/lib/crtbeginS.o -# Some platforms require additional endfile support. -.if ${MACHINE_ARCH} == "powerpc" && defined(HAVE_GCC3) -SHLIB_LDENDFILE?= ${DESTDIR}/usr/lib/crtsavres.o \ - ${DESTDIR}/usr/lib/crtendS.o ${DESTDIR}/usr/lib/crtn.o -.else -SHLIB_LDENDFILE?= ${DESTDIR}/usr/lib/crtendS.o ${DESTDIR}/usr/lib/crtn.o -.endif +SHLIB_LDSTARTFILE?= ${DESTDIR}/usr/lib/crti.o ${_GCC_CRTBEGINS} +SHLIB_LDENDFILE?= ${_GCC_CRTENDS} ${DESTDIR}/usr/lib/crtn.o .endif CFLAGS+= ${COPTS} diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 4d67cde700d2..d986d9c359c2 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -1,10 +1,11 @@ -# $NetBSD: bsd.prog.mk,v 1.166 2003/05/18 07:36:23 lukem Exp $ +# $NetBSD: bsd.prog.mk,v 1.167 2003/05/31 20:33:16 thorpej Exp $ # @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94 .ifndef HOSTPROG .include .include +.include ##### Basic targets .PHONY: cleanextra cleanobjs cleanprog proginstall scriptsinstall @@ -22,16 +23,11 @@ CFLAGS+= -mcmodel=medlow # ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o .if ${OBJECT_FMT} == "ELF" .ifndef LIBCRTBEGIN -LIBCRTBEGIN= ${DESTDIR}/usr/lib/crti.o ${DESTDIR}/usr/lib/crtbegin.o +LIBCRTBEGIN= ${DESTDIR}/usr/lib/crti.o ${_GCC_CRTBEGIN} .MADE: ${LIBCRTBEGIN} .endif .ifndef LIBCRTEND -.if ${MACHINE_ARCH} == "powerpc" && defined(HAVE_GCC3) -LIBCRTEND= ${DESTDIR}/usr/lib/crtsavres.o \ - ${DESTDIR}/usr/lib/crtend.o ${DESTDIR}/usr/lib/crtn.o -.else -LIBCRTEND= ${DESTDIR}/usr/lib/crtend.o ${DESTDIR}/usr/lib/crtn.o -.endif +LIBCRTEND= ${_GCC_CRTEND} ${DESTDIR}/usr/lib/crtn.o .MADE: ${LIBCRTEND} .endif _SHLINKER= ${SHLINKDIR}/ld.elf_so @@ -150,7 +146,7 @@ _CCLINK= ${CC} ${PROG}: .gdbinit ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD} .if !commands(${PROG}) - ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib ${_PROGLDOPTS} ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD} -L${DESTDIR}/usr/lib ${_SUPCXX} -lgcc -lc -lgcc ${LIBCRTEND} + ${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib ${_PROGLDOPTS} ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD} -L${_GCC_LIBGCCDIR} -L${DESTDIR}/usr/lib ${_SUPCXX} -lgcc -lc -lgcc ${LIBCRTEND} .endif .else