More table-driven changes for different toolchains:

* new bsd.own.mk variable OBJECT_FMT with values "a.out" or "ELF".
  * use OBJECT_FMT in Makefile tests that depend on toolchain.
  * Add new bsd.own.mk variable NOSHLIB that, if set indicates a given
    port doesnt yet do shared libraries. Set on powerpc.
  * Document new feature-test variables in src/share/mk/bsd.README.
Tested on i386, mips, fakedup Alpha environment.
This commit is contained in:
jonathan 1998-02-23 10:09:31 +00:00
parent c285c9fbfa
commit 5e0e8cec39
6 changed files with 49 additions and 25 deletions

View File

@ -1,6 +1,9 @@
# $NetBSD: Makefile,v 1.10 1997/10/25 06:18:27 cjs Exp $
# $NetBSD: Makefile,v 1.11 1998/02/23 10:09:32 jonathan Exp $
.if ${MACHINE} == "alpha"
.include <bsd.own.mk> # for OBJECT_FMT definition
.if ((${OBJECT_FMT} == "ELF") && !defined(NOSHLIB)) && \
(${MACHINE_ARCH} != "mips") # mips uses non-native ld.so
PROG= ld.elf_so
.endif

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.README,v 1.32 1998/02/04 07:08:56 mikel Exp $
# $NetBSD: bsd.README,v 1.33 1998/02/23 10:09:31 jonathan Exp $
# @(#)bsd.README 8.2 (Berkeley) 4/2/94
This is the README file for the new make "include" files for the BSD
@ -215,10 +215,18 @@ NOPROFILE Do not build profiled versions of system libraries
NOPIC Do not build PIC versions of system libraries, and
do not build shared libraries. [set if ${MACHINE_ARCH}
is "mips", "vax", "alpha" or "arm32", unset otherwise.]
is "vax" "powerpc", unset otherwise.]
NOLINT Do not build lint libraries. [set, set unconditionally]
NOSHLIB Do not build shared libraries [set if ${MACHINE_ARCH}
is "powerpc", unset otherwise].
OBJECT_FMAT Object file format. [set to "ELF" on ports that use
ELF -- currently if ${MACHINE_ARCH} is "alpha", "mips"
or "powerpc" or set to "a.out" on other ports].
bsd.own.mk is generally useful when building your own Makefiles so that
they use the same default owners etc. as the rest of the tree.

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.lib.mk,v 1.124 1998/02/18 08:14:31 jonathan Exp $
# $NetBSD: bsd.lib.mk,v 1.125 1998/02/23 10:09:31 jonathan Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.if !target(__initialized__)
@ -32,7 +32,7 @@ SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor
# Data-driven table using make variables to control how shared libraries
# are built for different platforms and object formats.
# SHLIB_TYPE: currently either "ELF" or "a.out".
# OBJECT_FMT: currently either "ELF" or "a.out", from <bsd.own.mk>
# SHLIB_SOVERSION: version number to be compiled into a shared library
# via -soname. Usualy ${SHLIB_MAJOR} on ELF.
# NetBSD/pmax used to use ${SHLIB_MAJOR}.{SHLIB-MINOR}.
@ -50,7 +50,6 @@ SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor
.if (${MACHINE_ARCH} == "alpha")
# Alpha-specific shared library flags
SHLIB_TYPE=ELF
SHLIB_LDSTARTFILE= ${DESTDIR}/usr/lib/crtbeginS.o
SHLIB_LDENDFILE= ${DESTDIR}/usr/lib/crtendS.o
@ -60,7 +59,6 @@ CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS ?=
.elif (${MACHINE_ARCH} == "mips")
# mips-specific shared library flags
SHLIB_TYPE=ELF
# Still use gnu-derived ld.so on pmax; don't have or need lib<>.so support.
SHLIB_LDSTARTFILE=
SHLIB_LDENDFILE=
@ -79,13 +77,12 @@ AS+= -KPIC
.else
# Platform-independent flags for NetBSD a.out shared libraries
SHLIB_TYPE=a.out
# Platform-independent flags for NetBSD a.out shared libraries (and PowerPC)
SHLIB_LDSTARTFILE=
SHLIB_LDENDFILE=
SHLIB_SHFLAGS= -Bshareable -Bforcearchive
SHLIB_SHFLAGS=
SHLIB_SOVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
SHLIB_WHOLE=
SHLIB_WHOLE=-Bforcearchive
SHLIB_NOWHOLE=
CPICFLAGS?= -fpic -DPIC
CPPPICFLAGS?= -DPIC
@ -95,11 +92,11 @@ APICFLAGS?= -k
.endif
# Platform-independent linker flags for ELF shared libraries
.if (${SHLIB_TYPE} == "ELF")
.if (${OBJECT_FMT} == "ELF")
SHLIB_WHOLE=--whole-archive
SHLIB_NOWHOLE=--no-whole-archive
SHLIB_SOVERSION=${SHLIB_MAJOR}
SHLIB_SHFLAGS=-shared -soname lib${LIB}.so.${SHLIB_SOVERSION}
SHLIB_SHFLAGS=-soname lib${LIB}.so.${SHLIB_SOVERSION}
.endif
CFLAGS+= ${COPTS}
@ -229,7 +226,7 @@ lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}_pic.a ${DPADD} \
${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
@echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
@rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
$(LD) -x ${SHLIB_SHFLAGS} -o ${.TARGET} \
$(LD) -x -Bshareable ${SHLIB_SHFLAGS} -o ${.TARGET} \
${SHLIB_LDSTARTFILE} \
${SHLIB_WHOLE} lib${LIB}_pic.a ${SHLIB_NOWHOLE} ${LDADD} \
${SHLIB_LDENDFILE}
@ -307,7 +304,7 @@ ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: .MADE
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} \
${.TARGET}
.if (${SHLIB_TYPE} == "ELF")
.if (${OBJECT_FMT} == "ELF")
rm -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
ln -s lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.own.mk,v 1.58 1998/01/15 09:37:25 agc Exp $
# $NetBSD: bsd.own.mk,v 1.59 1998/02/23 10:09:31 jonathan Exp $
.if defined(MAKECONF) && exists(${MAKECONF})
.include "${MAKECONF}"
@ -72,14 +72,30 @@ STRIPFLAG?= -s
NOPIC=
.endif
# Data-driven table using make variables to control how
# toolchain-dependent targets and shared libraries are built
# for different platforms and object formats.
# OBJECT_FMT: currently either "ELF" or "a.out".
# SHLIB_TYPE: "ELF" or "a.out" or "" to force static libraries.
#
.if (${MACHINE_ARCH} == "alpha") || \
(${MACHINE_ARCH} == "mips") || \
(${MACHINE_ARCH} == "powerpc")
OBJECT_FMT?=ELF
.else
OBJECT_FMT?=a.out
.endif
# No lint, for now.
.if !defined(NONOLINT)
NOLINT=
.endif
# Profiling doesn't work on PowerPC yet.
# Profiling and shared libraries don't work on PowerPC yet.
.if (${MACHINE_ARCH} == "powerpc")
NOPROFILE=
NOSHLIB=
.endif
TARGETS+= all clean cleandir depend includes install lint obj regress \

View File

@ -1,7 +1,8 @@
# $NetBSD: Makefile,v 1.80 1998/02/23 01:03:25 jonathan Exp $
# $NetBSD: Makefile,v 1.81 1998/02/23 10:09:32 jonathan Exp $
# from: @(#)Makefile 8.3 (Berkeley) 1/7/94
.include <bsd.own.mk> # for EXPORTABLE_SYSTEM definition
# # and OBJECT_FMT definition
SUBDIR= apply apropos asa at audioctl banner basename bdes \
biff cal calendar cap_mkdb checknr chflags chpass \
@ -40,8 +41,7 @@ SUBDIR+=telnet
# Don't use the standard a.out tool chain on non-aout (ELF) platforms.
# On ELF platforms, build the ELF ldd.
.if (${MACHINE_ARCH} != "alpha" && ${MACHINE_ARCH} != "mips" && \
${MACHINE_ARCH} != "powerpc")
.if (${OBJECT_FMT} != "ELF")
SUBDIR+= ar nm ranlib size strip
.else
SUBDIR+= ldd

View File

@ -1,9 +1,9 @@
# $NetBSD: Makefile,v 1.22 1998/02/23 01:04:08 jonathan Exp $
# $NetBSD: Makefile,v 1.23 1998/02/23 10:09:32 jonathan Exp $
# @(#)Makefile 8.1 (Berkeley) 6/29/93
# XXX not ELF?
.if (${MACHINE_ARCH} != "alpha" && ${MACHINE_ARCH} != "mips" && \
${MACHINE_ARCH} != "powerpc")
.include <bsd.own.mk> # for OBJECT_FMT definition
.if (${OBJECT_FMT} == "a.out")
PROG= gprof
.endif