Mon Dec 14 06:21:12 2009 UTC ()
merge the new src/compat build into the place it was actually born.
this replaces the old src/compat with a method that re-traverses the
library directories with a different set of flags, and is capable of
building more than one compat ABI.
(mrg)
diff -r1.1.8.1 -r1.1.8.2 src/compat/Makefile
diff -r0 -r1.1.2.1 src/compat/Makefile.common
diff -r0 -r1.1.2.1 src/compat/Makefile.m32
diff -r0 -r1.1.2.1 src/compat/Makefile.md_subdir
diff -r1.3.8.1 -r1.3.8.2 src/compat/Makefile.compat
diff -r1.2 -r1.2.6.1 src/compat/README
diff -r1.4 -r0 src/compat/build-makefiles
diff -r0 -r1.1.2.2 src/compat/amd64/i386/Makefile
diff -r0 -r1.1.2.2 src/compat/amd64/i386/bsd.i386.mk
diff -r0 -r1.1.2.2 src/compat/dirshack/Makefile
diff -r1.1.2.1 -r0 src/compat/external/bsd/openldap/lib/Makefile
diff -r1.4 -r0 src/compat/external/bsd/openldap/lib/liblber/Makefile
diff -r1.4 -r0 src/compat/external/bsd/openldap/lib/libldap/Makefile
diff -r1.4 -r0 src/compat/external/bsd/openldap/lib/libldap_r/Makefile
diff -r1.4 -r0 src/compat/external/bsd/openldap/lib/liblutil/Makefile
diff -r1.1.2.1 -r0 src/compat/gnu/lib/Makefile
diff -r1.4 -r0 src/compat/gnu/lib/crtstuff4/Makefile
diff -r1.4 -r0 src/compat/gnu/lib/libbfd/Makefile
diff -r1.1.2.1 -r0 src/compat/gnu/lib/libgcc4/Makefile
diff -r1.1 -r0 src/compat/gnu/lib/libgcc4/Makefile.inc
diff -r1.4 -r0 src/compat/gnu/lib/libgcc4/libgcc/Makefile
diff -r1.4 -r0 src/compat/gnu/lib/libgcc4/libgcc_eh/Makefile
diff -r1.4 -r0 src/compat/gnu/lib/libgcc4/libgcc_s/Makefile
diff -r1.4 -r0 src/compat/gnu/lib/libgcc4/libgcov/Makefile
diff -r1.4 -r0 src/compat/gnu/lib/libiberty/Makefile
diff -r1.4 -r0 src/compat/gnu/lib/libmalloc/Makefile
diff -r1.4 -r0 src/compat/gnu/lib/libobjc4/Makefile
diff -r1.4 -r0 src/compat/gnu/lib/libopcodes/Makefile
diff -r1.4 -r0 src/compat/gnu/lib/libstdc++-v3_4/Makefile
diff -r1.2 -r0 src/compat/gnu/lib/libstdc++-v3_4/include/Makefile
diff -r1.4 -r0 src/compat/gnu/lib/libsupc++4/Makefile
diff -r1.1.2.1 -r0 src/compat/lib/Makefile
diff -r1.1 -r0 src/compat/lib/Makefile.inc
diff -r1.3.8.1 -r0 src/compat/lib/csu/Makefile
diff -r1.2 -r0 src/compat/lib/csu/Makefile.real
diff -r1.4 -r0 src/compat/lib/csu/i386_elf/Makefile
diff -r1.1 -r0 src/compat/lib/csu/i386_elf/crt0.c
diff -r1.1.2.1 -r0 src/compat/lib/csu/mips/Makefile
diff -r1.1.2.1 -r0 src/compat/lib/csu/mips/crt0.c
diff -r1.4 -r0 src/compat/lib/csu/sparc_elf/Makefile
diff -r1.1 -r0 src/compat/lib/csu/sparc_elf/crt0.c
diff -r1.1.2.1 -r0 src/compat/lib/i18n_module/Makefile
diff -r1.1 -r0 src/compat/lib/i18n_module/Makefile.inc
diff -r1.4 -r0 src/compat/lib/i18n_module/BIG5/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/DECHanyu/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/EUC/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/EUCTW/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/GBK2K/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/HZ/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/ISO2022/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/JOHAB/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/MSKanji/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/UES/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/UTF1632/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/UTF7/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/UTF8/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/VIQR/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/ZW/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/iconv_none/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/iconv_std/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/mapper_646/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/mapper_none/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/mapper_parallel/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/mapper_serial/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/mapper_std/Makefile
diff -r1.4 -r0 src/compat/lib/i18n_module/mapper_zone/Makefile
diff -r1.4 -r0 src/compat/lib/libarch/Makefile
diff -r1.4 -r0 src/compat/lib/libasn1/Makefile
diff -r1.4 -r0 src/compat/lib/libatf-c/Makefile
diff -r1.4 -r0 src/compat/lib/libatf-c++/Makefile
diff -r1.4 -r0 src/compat/lib/libbind9/Makefile
diff -r1.4 -r0 src/compat/lib/libbluetooth/Makefile
diff -r1.4 -r0 src/compat/lib/libbsdmalloc/Makefile
diff -r1.4 -r0 src/compat/lib/libbz2/Makefile
diff -r1.4 -r0 src/compat/lib/libc/Makefile
diff -r1.1 -r0 src/compat/lib/libc/Makefile.inc
diff -r1.4 -r0 src/compat/lib/libcom_err/Makefile
diff -r1.4 -r0 src/compat/lib/libcompat/Makefile
diff -r1.4 -r0 src/compat/lib/libcrypt/Makefile
diff -r1.4 -r0 src/compat/lib/libcrypto/Makefile
diff -r1.1.2.2 -r0 src/compat/lib/libcrypto_idea/Makefile
diff -r1.1.2.2 -r0 src/compat/lib/libcrypto_mdc2/Makefile
diff -r1.1.2.2 -r0 src/compat/lib/libcrypto_rc5/Makefile
diff -r1.4 -r0 src/compat/lib/libcurses/Makefile
diff -r1.1 -r0 src/compat/lib/libcurses/PSD.doc/Makefile
diff -r1.4 -r0 src/compat/lib/libdes/Makefile
diff -r1.4 -r0 src/compat/lib/libdns/Makefile
diff -r1.4 -r0 src/compat/lib/libedit/Makefile
diff -r1.1 -r0 src/compat/lib/libedit/readline/Makefile
diff -r1.4 -r0 src/compat/lib/libevent/Makefile
diff -r1.4 -r0 src/compat/lib/libform/Makefile
diff -r1.4 -r0 src/compat/lib/libgssapi/Makefile
diff -r1.4 -r0 src/compat/lib/libhdb/Makefile
diff -r1.4 -r0 src/compat/lib/libheimntlm/Makefile
diff -r1.4 -r0 src/compat/lib/libhx509/Makefile
diff -r1.4 -r0 src/compat/lib/libintl/Makefile
diff -r1.4 -r0 src/compat/lib/libipsec/Makefile
diff -r1.4 -r0 src/compat/lib/libisc/Makefile
diff -r1.4 -r0 src/compat/lib/libisccc/Makefile
diff -r1.4 -r0 src/compat/lib/libisccfg/Makefile
diff -r1.4 -r0 src/compat/lib/libiscsi/Makefile
diff -r1.4 -r0 src/compat/lib/libkadm5clnt/Makefile
diff -r1.4 -r0 src/compat/lib/libkadm5srv/Makefile
diff -r1.4 -r0 src/compat/lib/libkafs/Makefile
diff -r1.4 -r0 src/compat/lib/libkrb5/Makefile
diff -r1.4 -r0 src/compat/lib/libkvm/Makefile
diff -r1.4 -r0 src/compat/lib/libl/Makefile
diff -r1.4 -r0 src/compat/lib/liblwres/Makefile
diff -r1.4 -r0 src/compat/lib/libm/Makefile
diff -r1.4 -r0 src/compat/lib/libmagic/Makefile
diff -r1.4 -r0 src/compat/lib/libmenu/Makefile
diff -r1.4 -r0 src/compat/lib/libossaudio/Makefile
diff -r1.1 -r0 src/compat/lib/libp2k/Makefile
diff -r1.4 -r0 src/compat/lib/libpam/Makefile
diff -r1.1 -r0 src/compat/lib/libpam/Makefile.inc
diff -r1.1 -r0 src/compat/lib/libpam/libpam/Makefile
diff -r1.1.2.1 -r0 src/compat/lib/libpam/modules/Makefile
diff -r1.3 -r0 src/compat/lib/libpam/modules/pam_afslog/Makefile
diff -r1.3 -r0 src/compat/lib/libpam/modules/pam_chroot/Makefile
diff -r1.3 -r0 src/compat/lib/libpam/modules/pam_deny/Makefile
diff -r1.3 -r0 src/compat/lib/libpam/modules/pam_echo/Makefile
diff -r1.3 -r0 src/compat/lib/libpam/modules/pam_exec/Makefile
diff -r1.3 -r0 src/compat/lib/libpam/modules/pam_ftpusers/Makefile
diff -r1.3 -r0 src/compat/lib/libpam/modules/pam_group/Makefile
diff -r1.2 -r0 src/compat/lib/libpam/modules/pam_guest/Makefile
diff -r1.3 -r0 src/compat/lib/libpam/modules/pam_krb5/Makefile
diff -r1.3 -r0 src/compat/lib/libpam/modules/pam_ksu/Makefile
diff -r1.3 -r0 src/compat/lib/libpam/modules/pam_lastlog/Makefile
diff -r1.2 -r0 src/compat/lib/libpam/modules/pam_login_access/Makefile
diff -r1.3 -r0 src/compat/lib/libpam/modules/pam_nologin/Makefile
diff -r1.2 -r0 src/compat/lib/libpam/modules/pam_permit/Makefile
diff -r1.3 -r0 src/compat/lib/libpam/modules/pam_radius/Makefile
diff -r1.2 -r0 src/compat/lib/libpam/modules/pam_rhosts/Makefile
diff -r1.2 -r0 src/compat/lib/libpam/modules/pam_rootok/Makefile
diff -r1.2 -r0 src/compat/lib/libpam/modules/pam_securetty/Makefile
diff -r1.2 -r0 src/compat/lib/libpam/modules/pam_self/Makefile
diff -r1.3 -r0 src/compat/lib/libpam/modules/pam_skey/Makefile
diff -r1.3 -r0 src/compat/lib/libpam/modules/pam_ssh/Makefile
diff -r1.3 -r0 src/compat/lib/libpam/modules/pam_unix/Makefile
diff -r1.4 -r0 src/compat/lib/libpcap/Makefile
diff -r1.4 -r0 src/compat/lib/libpci/Makefile
diff -r1.4 -r0 src/compat/lib/libpmc/Makefile
diff -r1.4 -r0 src/compat/lib/libposix/Makefile
diff -r1.4 -r0 src/compat/lib/libprop/Makefile
diff -r1.4 -r0 src/compat/lib/libpthread/Makefile
diff -r1.4 -r0 src/compat/lib/libpthread_dbg/Makefile
diff -r1.4 -r0 src/compat/lib/libpuffs/Makefile
diff -r1.4 -r0 src/compat/lib/libradius/Makefile
diff -r1.1 -r0 src/compat/lib/librefuse/Makefile
diff -r1.4 -r0 src/compat/lib/libresolv/Makefile
diff -r1.4 -r0 src/compat/lib/librmt/Makefile
diff -r1.4 -r0 src/compat/lib/libroken/Makefile
diff -r1.4 -r0 src/compat/lib/librpcsvc/Makefile
diff -r1.4 -r0 src/compat/lib/librt/Makefile
diff -r1.4 -r0 src/compat/lib/librump/Makefile
diff -r1.4 -r0 src/compat/lib/librumpnet/Makefile
diff -r1.4 -r0 src/compat/lib/librumpuser/Makefile
diff -r1.4 -r0 src/compat/lib/libsdp/Makefile
diff -r1.4 -r0 src/compat/lib/libskey/Makefile
diff -r1.4 -r0 src/compat/lib/libsl/Makefile
diff -r1.4 -r0 src/compat/lib/libss/Makefile
diff -r1.4 -r0 src/compat/lib/libssh/Makefile
diff -r1.4 -r0 src/compat/lib/libssl/Makefile
diff -r1.4 -r0 src/compat/lib/libtelnet/Makefile
diff -r1.4 -r0 src/compat/lib/libterm/Makefile
diff -r1.4 -r0 src/compat/lib/libukfs/Makefile
diff -r1.4 -r0 src/compat/lib/libusbhid/Makefile
diff -r1.4 -r0 src/compat/lib/libutil/Makefile
diff -r1.4 -r0 src/compat/lib/libvers/Makefile
diff -r1.4 -r0 src/compat/lib/libwrap/Makefile
diff -r1.4 -r0 src/compat/lib/liby/Makefile
diff -r1.4 -r0 src/compat/lib/libz/Makefile
diff -r1.1.2.1.4.1 -r0 src/compat/libexec/ld.elf_so/Makefile
diff -r0 -r1.1.2.2 src/compat/mips64/64/Makefile
diff -r0 -r1.1.2.2 src/compat/mips64/64/bsd.64.mk
diff -r0 -r1.1.2.2 src/compat/mips64/o32/Makefile
diff -r0 -r1.1.2.2 src/compat/mips64/o32/bsd.o32.mk
diff -r0 -r1.1.2.2 src/compat/sparc64/sparc/Makefile
diff -r0 -r1.1.2.2 src/compat/sparc64/sparc/bsd.sparc.mk
--- src/compat/Makefile 2009/09/13 21:21:16 1.1.8.1
+++ src/compat/Makefile 2009/12/14 06:20:58 1.1.8.2
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1.8.1 2009/09/13 21:21:16 matt Exp $
+# $NetBSD: Makefile,v 1.1.8.2 2009/12/14 06:20:58 mrg Exp $
# Build 32-bit compat versions of:
# src/gnu/lib/libgcc4 into ${DESTDIR}/usr/lib/<32arch>
@@ -9,20 +9,14 @@
.include <bsd.own.mk>
-.if ${MKCOMPAT} != "no" && \
- (${MACHINE} == "sparc64" || ${MACHINE} == "amd64") || \
- (${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el")
-
+.if ${MKCOMPAT} != "no"
.if !make(includes)
-SUBDIR= gnu/lib/crtstuff4 .WAIT \
- lib/csu .WAIT \
- gnu/lib/libgcc4 .WAIT \
- lib/libc .WAIT \
- lib/libutil .WAIT \
- lib gnu/lib .WAIT \
- libexec/ld.elf_so
-.endif
+.include "Makefile.md_subdir"
+
+SUBDIR= dirshack .WAIT ${MD_SUBDIR}
+
+.endif
.endif
.include <bsd.subdir.mk>
# $NetBSD: Makefile.common,v 1.1.2.1 2009/12/14 06:20:58 mrg Exp $
# Build netbsd libraries.
.include <bsd.own.mk>
.if ${MKCOMPAT} != "no"
.if !make(includes)
# make sure we get an objdir built early enough
.include <bsd.prog.mk>
# XXX make this use MAKEOBJDIR
MAKEDIRTARGETENV= MAKEOBJDIRPREFIX=${.OBJDIR} MKOBJDIRS=yes MKSHARE=no BSD_MK_COMPAT_FILE=${BSD_MK_COMPAT_FILE}
.if defined(BOOTSTRAP_SUBDIRS)
SUBDIR= ${BOOTSTRAP_SUBDIRS}
.else
SUBDIR= ../../../gnu/lib/crtstuff4 .WAIT \
../../../lib/csu .WAIT \
../../../gnu/lib/libgcc4 .WAIT \
../../../lib/libc .WAIT \
../../../lib/libutil .WAIT \
../../../lib ../../../gnu/lib \
../../../libexec/ld.elf_so
.endif
.include <bsd.subdir.mk>
.endif
.endif
# $NetBSD: Makefile.m32,v 1.1.2.1 2009/12/14 06:20:58 mrg Exp $
#
# Makefile fragment to help implement a set of 'cc -m32' libraries.
#
COPTS+= -m32
CPUFLAGS+= -m32
LDADD+= -m32
LDFLAGS+= -m32
MKDEPFLAGS+= -m32
.include "Makefile.compat"
# $NetBSD: Makefile.md_subdir,v 1.1.2.1 2009/12/14 06:20:58 mrg Exp $
# list of subdirs
.if ${MACHINE} == "sparc64"
MD_SUBDIR= sparc64/sparc
.endif
.if ${MACHINE} == "amd64"
MD_SUBDIR= amd64/i386
.endif
.if (${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el")
MD_SUBDIR= mips64/64 mips64/o32
.endif
--- src/compat/Makefile.compat 2009/09/13 21:21:16 1.3.8.1
+++ src/compat/Makefile.compat 2009/12/14 06:20:58 1.3.8.2
@@ -1,71 +1,42 @@
-# $NetBSD: Makefile.compat,v 1.3.8.1 2009/09/13 21:21:16 matt Exp $
+# $NetBSD: Makefile.compat,v 1.3.8.2 2009/12/14 06:20:58 mrg Exp $
-# XXX ugly
-.if ${MACHINE} == "sparc64"
-LD+= -m elf32_sparc
-LDFLAGS+= -m32
-LD32DIR= sparc
-ARCH32DIR= sparc
-COPTS+= -m32
-CPUFLAGS+= -m32
-LDADD+= -m32
-MKDEPFLAGS+= -m32
+#
+# Makefile fragment to help implement a multilib set of libraries
+#
+# expects MLIBDIR to be set to the extra path component
+#
-.elif ${MACHINE} == "amd64"
-LD+= -m elf_i386
-LDFLAGS+= -m32
-LD32DIR= i386
-ARCH32DIR= i386
-COPTS+= -m32
-CPUFLAGS+= -m32
-LDADD+= -m32
-MKDEPFLAGS+= -m32
+.ifndef _COMPAT_OPTIONS_MK_ # {
+_COMPAT_OPTIONS_MK_=1
-.elif ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
-LD+= -m elf64${MACHINE_ARCH:S/mips64e//}tsmip
-LDFLAGS+= -mabi=64
-LD32DIR= lib64
-ARCH32DIR= ${MACHINE_ARCH}
-COPTS+= -mabi=64
-CPUFLAGS+= -mabi=64
-LDADD+= -mabi=64
-MKDEPFLAGS+= -mabi=64
+LIBDIR= /usr/lib/${MLIBDIR}
+SHLIBDIR= /usr/lib/${MLIBDIR}
+SHLIBINSTALLDIR= /usr/lib/${MLIBDIR}
-.endif
+_GCC_CRTBEGIN= ${DESTDIR}/usr/lib/${MLIBDIR}/crtbegin.o
+_GCC_CRTBEGINS= ${DESTDIR}/usr/lib/${MLIBDIR}/crtbeginS.o
+_GCC_CRTEND= ${DESTDIR}/usr/lib/${MLIBDIR}/crtend.o
+_GCC_CRTENDS= ${DESTDIR}/usr/lib/${MLIBDIR}/crtendS.o
+_GCC_CRTDIR= ${DESTDIR}/usr/lib/${MLIBDIR}
+_GCC_LIBGCCDIR= ${DESTDIR}/usr/lib/${MLIBDIR}
-LIBDIR= /usr/lib/${LD32DIR}
-SHLIBDIR= /usr/lib/${LD32DIR}
-SHLIBINSTALLDIR= /usr/lib/${LD32DIR}
-
-COMMON_MACHINE_ARCH= ${LD32DIR}
-LIBC_MACHINE_ARCH= ${LD32DIR}
-BFD_MACHINE_ARCH= ${LD32DIR}
-CRYPTO_MACHINE_CPU= ${LD32DIR}
-KVM_MACHINE_ARCH= ${LD32DIR}
-PTHREAD_MACHINE_ARCH= ${LD32DIR}
-LDELFSO_MACHINE_CPU= ${LD32DIR}
-
-_GCC_CRTBEGIN?= ${DESTDIR}/usr/lib/${LD32DIR}/crtbegin.o
-_GCC_CRTBEGINS?= ${DESTDIR}/usr/lib/${LD32DIR}/crtbeginS.o
-_GCC_CRTEND?= ${DESTDIR}/usr/lib/${LD32DIR}/crtend.o
-_GCC_CRTENDS?= ${DESTDIR}/usr/lib/${LD32DIR}/crtendS.o
-_GCC_CRTDIR?= ${DESTDIR}/usr/lib/${LD32DIR}
-_GCC_LIBGCCDIR?= ${DESTDIR}/usr/lib/${LD32DIR}
-
NOSHARE= # defined
-NONLS= # defined
+NOLINT= # defined
+NONLS= # defined
+NOMAN= # defined
+NOINFO= # defined
NOCHECKVER= # defined
-LIBC_DIR= ${NETBSDSRCDIR}/compat/lib/libc
-
# ld.elf_so
SHLINKINSTALLDIR= /usr/libexec
# XXX
EXTRALIBDIRS= ${DESTDIR}${LIBDIR} ${DESTDIR}${LIBDIR}/i18n ${DESTDIR}${LIBDIR}/security
.PRECIOUS: ${EXTRALIBDIRS}
-install: ${EXTRALIBDIRS} .WAIT
+# XXX this should be "install:" but that doesn't work for some reason
+obj: ${EXTRALIBDIRS}
${EXTRALIBDIRS}: .EXEC
+ @if [ -z "${MLIBDIR}" ]; then echo "BAH"; false; fi
@if [ ! -d ${.TARGET} ] ; then \
${_MKSHMSG_CREATE} ${.TARGET}; \
${_MKSHECHO} ${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} -m 755 \
@@ -75,3 +46,5 @@
fi
# Make sure the base dir is created first.
${DESTDIR}${LIBDIR}/i18n ${DESTDIR}${LIBDIR}/security: ${DESTDIR}${LIBDIR}
+
+.endif # _COMPAT_OPTIONS_MK_ }
--- src/compat/README 2008/10/27 07:22:22 1.2
+++ src/compat/README 2009/12/14 06:20:58 1.2.6.1
@@ -1,43 +1,85 @@
-$NetBSD: README,v 1.2 2008/10/27 07:22:22 mrg Exp $
+$NetBSD: README,v 1.2.6.1 2009/12/14 06:20:58 mrg Exp $
-This directory contains Makefile fragments that will build all of the
-NetBSD libraries in 32-bit mode and install them into /usr/lib/<arch>
-and also install a /usr/libexec/ld.elf_so-<arch>.
-This is current only supported for the amd64 and sparc64 platforms,
-where <arch> is "i386" or "sparc" respectively. (It could be used to
-build MIPS o32 libraries on n32 system, but not both n32 and o32 on
-a n64 system. It only supports one extra target.)
+Building multi- ABI libraries for NetBSD platforms.
-Most of the makefiles here were built with the "build-makefiles" script.
-The expections are lib/csu/Makefile and ld.elf_so/Makefile.
+src/compat has a framework to (re)build the libraries shipped with
+NetBSD for a different ABI than the default for that platform. This
+allow 32-bit libraries for the amd64 and sparc64 ports, and enables
+the mips64 port to support all three of old-style 32-bit ("o32"), the
+new 32-bit (default, "n32", 64-bit CPU required) or the 64-bit ABI.
-The method used is the:
- - evaluate some local variables
- - switch .CURDIR
- - include original Makefile,
- - evaluate some variables
- - switch .CURDIR back
-that is used by crunchgen to build eg, installer media or /rescue.
+The basic premise is to re-set $MAKEOBJDIRPREFIX to fresh subdirectory
+underneath src/compat and rebuild the libraries with a different set
+of options. Each platform wanting support should create their port
+subdirectory directly in src/compat, and then one subdirectory in here
+for each ABI required. e.g., src/compat/amd64/i386 is where we build
+the 32-bit compat libraries for the amd64port. In each of these
+subdirs, a small Makefile and makefile fragment should exist. The
+Makefile should set BSD_MK_COMPAT_FILE to equal the fragment, and then
+include "../../Makefile.common". Eg, amd64/i386/Makefile has:
+ # $NetBSD: README,v 1.2.6.1 2009/12/14 06:20:58 mrg Exp $
+ BSD_MK_COMPAT_FILE=${.CURDIR}/bsd.i386.mk
+ .include "../../Makefile.common"
+
+In the makefile fragment any changes to ABI flags are passed here
+and the MLIBDIR variable must be set to the subdirectory in /usr/lib
+where libraries for the ABI will be installed. There are a couple of
+helper Makefile's around. amd64/i386/bsd.i386.mk looks like:
+
+
+ # $NetBSD: README,v 1.2.6.1 2009/12/14 06:20:58 mrg Exp $
+
+ LD+= -m elf_i386
+ MLIBDIR= i386
+
+ .include "${NETBSDSRCDIR}/compat/Makefile.m32"
+
+and the referenced Makefile.m32 looks like:
+
+ # $NetBSD: README,v 1.2.6.1 2009/12/14 06:20:58 mrg Exp $
+
+ #
+ # Makefile fragment to help implement a set of 'cc -m32' libraries.
+ #
+
+ COPTS+= -m32
+ CPUFLAGS+= -m32
+ LDADD+= -m32
+ LDFLAGS+= -m32
+ MKDEPFLAGS+= -m32
+
+ .include "Makefile.compat"
+
+
+Makefile.common holds the list of subdirectories (the libraries and
+ld.elf_so) to build with this ABI.
+
+Makefile.md_subdir holds the list of subdirectories for each port.
+
+Makefile.compat has the basic framework to force the right paths for
+library and ld.elf_so linkage. It contains a hack to create subdirs
+in the build that should be fixed.
+
+dirshack/Makefile is a hack to get objdirs created timely, and should
+be fixed in a better way.
+
+
TODO:
- - some yacc issue -- libc, libipsec and libpcap need "make" run
- to generate headers properly, otherwise it complains about
- no way to get to foo.h. this is currently hacked by putting
- a rule "foo.h: foo.c" in the (generated) makefiles
- - there's an ugly hack to make libpam build correctly again the
- right libc. ld.elf_so has a similar (but less ugly hack)
- - not sure that /usr/lib/{i386,sparc}{,/i18n} are created
- properly yet
-Future work
+- fix MLIBDIR in ld.elf_so arch-subdirs to be generic since it now is:
+ .if defined(MLIBDIR)
+ CPPFLAGS+= -DRTLD_ARCH_SUBDIR=\"${MLIBDIR}\"
+ .endif
+- check this part in ld.elf_so Makefile. it may be right now:
+ # XXXX this needs to find the right one some how yet.
+ CLIBOBJ!= cd ${NETBSDSRCDIR}/lib/libc && ${PRINTOBJDIR}
-Ideally this should be able to handle any number of compat targets.
+
-Perhaps using a "force MAKEOBJDIR, and run-run make" solution will
+mrg@eterna.com.au
-work, but my initial attempts got me no where. If not, perhaps
+december 2009
-build-makefiles could be expanded to be used at run-time in such
-a per-compat target obj-dir.
# $NetBSD: Makefile,v 1.1.2.2 2009/12/14 06:20:58 mrg Exp $
BSD_MK_COMPAT_FILE=${.CURDIR}/bsd.i386.mk
.include "../../Makefile.common"
# $NetBSD: bsd.i386.mk,v 1.1.2.2 2009/12/14 06:20:58 mrg Exp $
LD+= -m elf_i386
MLIBDIR= i386
LIBC_MACHINE_ARCH= ${MLIBDIR}
COMMON_MACHINE_ARCH= ${MLIBDIR}
KVM_MACHINE_ARCH= ${MLIBDIR}
PTHREAD_MACHINE_ARCH= ${MLIBDIR}
BFD_MACHINE_ARCH= ${MLIBDIR}
CSU_MACHINE_ARCH= ${MLIBDIR}
CRYPTO_MACHINE_CPU= ${MLIBDIR}
LDELFSO_MACHINE_CPU= ${MLIBDIR}
.include "${NETBSDSRCDIR}/compat/Makefile.m32"
# $NetBSD: Makefile,v 1.1.2.2 2009/12/14 06:20:58 mrg Exp $
# hacky method to get compat multilib base objdirs created before
# make tries to go create the subdirs used for builds.
# the problem is that make handles objdir creation for subdirs before it
# handles this current directory, so when make cd's into $arch/$libtype
# and from there into the ../../lib dirs, it ends up setting the forced
# MAKEOBJDIRPREFIX to something based upon ${.CURDIR}, since the objdir
# doesn't exist yet.
#
# our solution is simple - from this Makefile we traverse the same list
# of $arch/$libtype's with "BOOTSTRAP_SUBDIR=". then the compat/Makefile
# handles these subdirs as normal, with the base objdir created.
.include <bsd.own.mk>
.if ${MKCOMPAT} != "no"
.if make(obj)
.include "../Makefile.md_subdir"
MAKEDIRTARGETENV= BOOTSTRAP_SUBDIRS=
SUBDIR= ${MD_SUBDIR:C/^/..\//}
.endif # make(obj)
.endif # MKCOMPAT != no
.include <bsd.subdir.mk>
# $NetBSD: Makefile,v 1.1.2.2 2009/12/14 06:21:11 mrg Exp $
BSD_MK_COMPAT_FILE=${.CURDIR}/bsd.64.mk
.include "../../Makefile.common"
# $NetBSD: bsd.64.mk,v 1.1.2.2 2009/12/14 06:21:11 mrg Exp $
LD+= -m elf64_mipsn64
MLIBDIR= 64
COPTS+= -mabi=64
CPUFLAGS+= -mabi=64
LDADD+= -mabi=64
LDFLAGS+= -mabi=64
MKDEPFLAGS+= -mabi=64
.include "${NETBSDSRCDIR}/compat/Makefile.compat"
# $NetBSD: Makefile,v 1.1.2.2 2009/12/14 06:21:11 mrg Exp $
BSD_MK_COMPAT_FILE=${.CURDIR}/bsd.o32.mk
.include "../../Makefile.common"
# $NetBSD: bsd.o32.mk,v 1.1.2.2 2009/12/14 06:21:11 mrg Exp $
LD+= -m elf32_mipso32
MLIBDIR= o32
#.include "${NETBSDSRCDIR}/compat/Makefile.m32"
COPTS+= -mabi=32 -march=mips3
CPUFLAGS+= -mabi=32 -march=mips3
LDADD+= -mabi=32 -march=mips3
LDFLAGS+= -mabi=32 -march=mips3
MKDEPFLAGS+= -mabi=32 -march=mips3
.include "${NETBSDSRCDIR}/compat/Makefile.compat"
# $NetBSD: Makefile,v 1.1.2.2 2009/12/14 06:21:11 mrg Exp $
BSD_MK_COMPAT_FILE=${.CURDIR}/bsd.sparc.mk
.include "../../Makefile.common"
# $NetBSD: bsd.sparc.mk,v 1.1.2.2 2009/12/14 06:21:11 mrg Exp $
LD+= -m elf32_sparc
MLIBDIR= sparc
LIBC_MACHINE_ARCH= ${MLIBDIR}
COMMON_MACHINE_ARCH= ${MLIBDIR}
KVM_MACHINE_ARCH= ${MLIBDIR}
PTHREAD_MACHINE_ARCH= ${MLIBDIR}
BFD_MACHINE_ARCH= ${MLIBDIR}
CSU_MACHINE_ARCH= ${MLIBDIR}
CRYPTO_MACHINE_CPU= ${MLIBDIR}
LDELFSO_MACHINE_CPU= ${MLIBDIR}
.include "${NETBSDSRCDIR}/compat/Makefile.m32"