2015-05-26 21:44:15 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
|
|
|
|
# local configuration specific to meta mode
|
|
|
|
# XXX some of this should be in meta.sys.mk
|
2015-11-14 03:24:48 +00:00
|
|
|
# we assume that MK_DIRDEPS_BUILD=yes
|
2015-05-26 21:44:15 +00:00
|
|
|
|
2015-06-13 19:52:35 +00:00
|
|
|
# we need this until there is an alternative
|
|
|
|
MK_INSTALL_AS_USER= yes
|
|
|
|
|
2015-09-17 04:01:05 +00:00
|
|
|
_default_makeobjdir=$${.CURDIR:S,^$${SRCTOP},$${OBJTOP},}
|
2015-09-16 19:58:04 +00:00
|
|
|
|
2015-06-11 13:51:52 +00:00
|
|
|
.if empty(OBJROOT) || ${.MAKE.LEVEL} == 0
|
2016-03-31 00:26:40 +00:00
|
|
|
.if defined(MAKEOBJDIRPREFIX) && !empty(MAKEOBJDIRPREFIX)
|
2015-06-20 21:48:07 +00:00
|
|
|
# put things approximately where they want
|
2015-09-17 04:01:05 +00:00
|
|
|
OBJROOT:=${MAKEOBJDIRPREFIX}${SRCTOP}/
|
2015-09-11 00:19:49 +00:00
|
|
|
MAKEOBJDIRPREFIX=
|
|
|
|
.export MAKEOBJDIRPREFIX
|
|
|
|
.endif
|
2015-09-16 18:02:04 +00:00
|
|
|
.if empty(MAKEOBJDIR)
|
2015-06-20 21:48:07 +00:00
|
|
|
# OBJTOP set below
|
2015-09-16 18:02:04 +00:00
|
|
|
MAKEOBJDIR=${_default_makeobjdir}
|
2015-06-20 21:48:07 +00:00
|
|
|
# export but do not track
|
2015-09-11 00:19:49 +00:00
|
|
|
.export-env MAKEOBJDIR
|
2015-09-17 00:17:32 +00:00
|
|
|
# Expand for our own use
|
|
|
|
MAKEOBJDIR:= ${MAKEOBJDIR}
|
2015-06-20 21:48:07 +00:00
|
|
|
.endif
|
2015-05-26 21:44:15 +00:00
|
|
|
.if !empty(SB)
|
|
|
|
SB_OBJROOT ?= ${SB}/obj/
|
|
|
|
# this is what we use below
|
|
|
|
OBJROOT ?= ${SB_OBJROOT}
|
|
|
|
.endif
|
2015-09-18 18:57:09 +00:00
|
|
|
OBJROOT ?= /usr/obj${SRCTOP}/
|
2015-05-26 21:44:15 +00:00
|
|
|
.if ${OBJROOT:M*/} != ""
|
2015-09-16 20:58:43 +00:00
|
|
|
OBJROOT:= ${OBJROOT:H:tA}/
|
2015-05-26 21:44:15 +00:00
|
|
|
.else
|
|
|
|
OBJROOT:= ${OBJROOT:H:tA}/${OBJROOT:T}
|
|
|
|
.endif
|
|
|
|
.export OBJROOT SRCTOP
|
|
|
|
|
|
|
|
# we need HOST_TARGET etc below.
|
|
|
|
.include <host-target.mk>
|
|
|
|
.export HOST_TARGET
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# from src/Makefile (for universe)
|
2016-05-18 06:01:18 +00:00
|
|
|
TARGET_ARCHES_arm?= arm armeb armv6
|
2015-09-16 23:59:53 +00:00
|
|
|
TARGET_ARCHES_arm64?= aarch64
|
|
|
|
TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 mipsn32el
|
Create a new MACHINE_ARCH for Freescale PowerPC e500v2
Summary:
The Freescale e500v2 PowerPC core does not use a standard FPU.
Instead, it uses a Signal Processing Engine (SPE)--a DSP-style vector processor
unit, which doubles as a FPU. The PowerPC SPE ABI is incompatible with the
stock powerpc ABI, so a new MACHINE_ARCH was created to deal with this.
Additionaly, the SPE opcodes overlap with Altivec, so these are mutually
exclusive. Taking advantage of this fact, a new file, powerpc/booke/spe.c, was
created with the same function set as in powerpc/powerpc/altivec.c, so it
becomes effectively a drop-in replacement. setjmp/longjmp were modified to save
the upper 32-bits of the now-64-bit GPRs (upper 32-bits are only accessible by
the SPE).
Note: This does _not_ support the SPE in the e500v1, as the e500v1 SPE does not
support double-precision floating point.
Also, without a new MACHINE_ARCH it would be impossible to provide binary
packages which utilize the SPE.
Additionally, no work has been done to support ports, work is needed for this.
This also means no newer gcc can yet be used. However, gcc's powerpc support
has been refactored which would make adding a powerpcspe-freebsd target very
easy.
Test Plan:
This was lightly tested on a RouterBoard RB800 and an AmigaOne A1222
(P1022-based) board, compiled against the new ABI. Base system utilities
(/bin/sh, /bin/ls, etc) still function appropriately, the system is able to boot
multiuser.
Reviewed By: bdrewery, imp
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D5683
2016-10-22 01:57:15 +00:00
|
|
|
TARGET_ARCHES_powerpc?= powerpc powerpc64 powerpcspe
|
2016-11-16 15:21:32 +00:00
|
|
|
TARGET_ARCHES_riscv?= riscv64 riscv64sf
|
2015-05-26 21:44:15 +00:00
|
|
|
|
|
|
|
# some corner cases
|
|
|
|
BOOT_MACHINE_DIR.amd64 = boot/i386
|
|
|
|
MACHINE_ARCH.host = ${_HOST_ARCH}
|
|
|
|
|
|
|
|
# the list of machines we support
|
2017-01-28 02:22:15 +00:00
|
|
|
ALL_MACHINE_LIST?= amd64 arm arm64 i386 mips powerpc riscv sparc64
|
2015-05-26 21:44:15 +00:00
|
|
|
.for m in ${ALL_MACHINE_LIST:O:u}
|
|
|
|
MACHINE_ARCH_LIST.$m?= ${TARGET_ARCHES_${m}:U$m}
|
|
|
|
MACHINE_ARCH.$m?= ${MACHINE_ARCH_LIST.$m:[1]}
|
|
|
|
BOOT_MACHINE_DIR.$m ?= boot/$m
|
|
|
|
.endfor
|
2015-06-13 19:20:56 +00:00
|
|
|
|
2015-05-26 21:44:15 +00:00
|
|
|
.ifndef _TARGET_SPEC
|
|
|
|
.if empty(MACHINE_ARCH)
|
|
|
|
.if !empty(TARGET_ARCH)
|
|
|
|
MACHINE_ARCH= ${TARGET_ARCH}
|
|
|
|
.else
|
|
|
|
MACHINE_ARCH= ${MACHINE_ARCH.${MACHINE}}
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
MACHINE_ARCH?= ${MACHINE_ARCH.${MACHINE}}
|
|
|
|
MACHINE_ARCH:= ${MACHINE_ARCH}
|
|
|
|
.else
|
|
|
|
# we got here via dirdeps
|
|
|
|
MACHINE_ARCH:= ${MACHINE_ARCH.${MACHINE}}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# now because for universe we want to potentially
|
|
|
|
# build for multiple MACHINE_ARCH per MACHINE
|
|
|
|
# we need more than MACHINE in TARGET_SPEC
|
|
|
|
TARGET_SPEC_VARS= MACHINE MACHINE_ARCH
|
|
|
|
# see dirdeps.mk
|
|
|
|
.if ${TARGET_SPEC:Uno:M*,*} != ""
|
|
|
|
_tspec := ${TARGET_SPEC:S/,/ /g}
|
|
|
|
MACHINE := ${_tspec:[1]}
|
|
|
|
MACHINE_ARCH := ${_tspec:[2]}
|
|
|
|
# etc.
|
|
|
|
# We need to stop that TARGET_SPEC affecting any submakes
|
|
|
|
# and deal with MACHINE=${TARGET_SPEC} in the environment.
|
|
|
|
TARGET_SPEC=
|
|
|
|
# export but do not track
|
|
|
|
.export-env TARGET_SPEC
|
|
|
|
.export ${TARGET_SPEC_VARS}
|
|
|
|
.for v in ${TARGET_SPEC_VARS:O:u}
|
|
|
|
.if empty($v)
|
|
|
|
.undef $v
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
# make sure we know what TARGET_SPEC is
|
|
|
|
# as we may need it to find Makefile.depend*
|
|
|
|
TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,}
|
|
|
|
|
|
|
|
# to be consistent with src/Makefile just concatenate with '.'s
|
|
|
|
TARGET_OBJ_SPEC:= ${TARGET_SPEC:S;,;.;g}
|
|
|
|
OBJTOP:= ${OBJROOT}${TARGET_OBJ_SPEC}
|
|
|
|
|
2015-09-16 19:58:04 +00:00
|
|
|
.if defined(MAKEOBJDIR)
|
|
|
|
.if ${MAKEOBJDIR:M*/*} == ""
|
|
|
|
.error Cannot use MAKEOBJDIR=${MAKEOBJDIR}${.newline}Unset MAKEOBJDIR to get default: MAKEOBJDIR='${_default_makeobjdir}'
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2015-05-26 21:44:15 +00:00
|
|
|
HOST_OBJTOP ?= ${OBJROOT}${HOST_TARGET}
|
|
|
|
|
|
|
|
.if ${OBJTOP} == ${HOST_OBJTOP} || ${REQUESTED_MACHINE:U${MACHINE}} == "host"
|
|
|
|
MACHINE= host
|
|
|
|
.if ${TARGET_MACHINE:Uno} == ${HOST_TARGET}
|
|
|
|
# not what we want
|
|
|
|
TARGET_MACHINE= host
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
.if ${MACHINE} == "host"
|
|
|
|
OBJTOP := ${HOST_OBJTOP}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if ${.MAKE.LEVEL} == 0
|
|
|
|
PYTHON ?= /usr/local/bin/python
|
2015-06-13 19:20:56 +00:00
|
|
|
.export PYTHON
|
2015-05-26 21:44:15 +00:00
|
|
|
# this works best if share/mk is ready for it.
|
|
|
|
BUILD_AT_LEVEL0= no
|
2016-03-11 23:45:23 +00:00
|
|
|
# _SKIP_BUILD is not 100% as it requires wrapping all 'all:' targets to avoid
|
|
|
|
# building in MAKELEVEL0. Just prohibit 'all' entirely in this case to avoid
|
|
|
|
# problems.
|
|
|
|
.if ${MK_DIRDEPS_BUILD} == "yes" && \
|
|
|
|
${.MAKE.LEVEL} == 0 && ${BUILD_AT_LEVEL0:Uyes:tl} == "no"
|
|
|
|
.MAIN: dirdeps
|
|
|
|
.if make(all)
|
|
|
|
.error DIRDEPS_BUILD: Please run '${MAKE}' instead of '${MAKE} all'.
|
|
|
|
.endif
|
|
|
|
.endif
|
2015-05-26 21:44:15 +00:00
|
|
|
|
|
|
|
# we want to end up with a singe stage tree for all machines
|
|
|
|
.if ${MK_STAGING} == "yes"
|
|
|
|
.if empty(STAGE_ROOT)
|
|
|
|
STAGE_ROOT?= ${OBJROOT}stage
|
|
|
|
.export STAGE_ROOT
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if ${MK_STAGING} == "yes"
|
|
|
|
.if ${MACHINE} == "host"
|
|
|
|
STAGE_MACHINE= ${HOST_TARGET}
|
|
|
|
.else
|
|
|
|
STAGE_MACHINE:= ${TARGET_OBJ_SPEC}
|
|
|
|
.endif
|
|
|
|
STAGE_OBJTOP:= ${STAGE_ROOT}/${STAGE_MACHINE}
|
|
|
|
STAGE_COMMON_OBJTOP:= ${STAGE_ROOT}/common
|
2015-12-08 17:56:40 +00:00
|
|
|
STAGE_TARGET_OBJTOP:= ${STAGE_ROOT}/${TARGET_OBJ_SPEC}
|
2015-05-26 21:44:15 +00:00
|
|
|
STAGE_HOST_OBJTOP:= ${STAGE_ROOT}/${HOST_TARGET}
|
2015-12-08 17:56:40 +00:00
|
|
|
# These are exported for hooking in out-of-tree builds. They will always
|
|
|
|
# be overridden in sub-makes above when building in-tree.
|
|
|
|
.export STAGE_OBJTOP STAGE_TARGET_OBJTOP STAGE_HOST_OBJTOP
|
2015-05-26 21:44:15 +00:00
|
|
|
|
2015-11-25 19:10:28 +00:00
|
|
|
# Use tools/install.sh which can avoid the need for xinstall for simple cases.
|
|
|
|
INSTALL?= sh ${SRCTOP}/tools/install.sh
|
|
|
|
# This is for stage-install to pickup from the environment.
|
|
|
|
REAL_INSTALL:= ${INSTALL}
|
|
|
|
.export REAL_INSTALL
|
|
|
|
STAGE_INSTALL= sh ${.PARSEDIR:tA}/stage-install.sh OBJDIR=${.OBJDIR:tA}
|
|
|
|
|
2015-05-26 21:44:15 +00:00
|
|
|
STAGE_LIBDIR= ${STAGE_OBJTOP}${_LIBDIR:U${LIBDIR:U/lib}}
|
|
|
|
STAGE_INCLUDEDIR= ${STAGE_OBJTOP}${INCLUDEDIR:U/usr/include}
|
|
|
|
# this is not the same as INCLUDEDIR
|
|
|
|
STAGE_INCSDIR= ${STAGE_OBJTOP}${INCSDIR:U/include}
|
|
|
|
# the target is usually an absolute path
|
|
|
|
STAGE_SYMLINKS_DIR= ${STAGE_OBJTOP}
|
|
|
|
|
2016-04-04 23:15:57 +00:00
|
|
|
LDFLAGS_LAST+= -Wl,-rpath-link,${STAGE_LIBDIR}
|
2015-06-13 19:20:56 +00:00
|
|
|
.if ${MK_SYSROOT} == "yes"
|
2015-09-23 22:23:59 +00:00
|
|
|
SYSROOT?= ${STAGE_OBJTOP}
|
2015-05-26 21:44:15 +00:00
|
|
|
.else
|
|
|
|
LDFLAGS_LAST+= -L${STAGE_LIBDIR}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.endif # MK_STAGING
|
|
|
|
|
|
|
|
# this is sufficient for most of the tree.
|
|
|
|
.MAKE.DEPENDFILE_DEFAULT = ${.MAKE.DEPENDFILE_PREFIX}
|
|
|
|
|
|
|
|
# but if we have a machine qualified file it should be used in preference
|
|
|
|
.MAKE.DEPENDFILE_PREFERENCE = \
|
|
|
|
${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \
|
|
|
|
${.MAKE.DEPENDFILE_PREFIX}
|
|
|
|
|
|
|
|
.undef .MAKE.DEPENDFILE
|
|
|
|
|
|
|
|
.include "sys.dependfile.mk"
|
|
|
|
|
|
|
|
.if ${.MAKE.LEVEL} > 0 && ${MACHINE} == "host" && ${.MAKE.DEPENDFILE:E} != "host"
|
|
|
|
# we can use this but should not update it.
|
|
|
|
UPDATE_DEPENDFILE= NO
|
|
|
|
.endif
|
|
|
|
|
2015-06-13 19:20:56 +00:00
|
|
|
# define the list of places that contain files we are responsible for
|
2015-05-26 21:44:15 +00:00
|
|
|
.MAKE.META.BAILIWICK = ${SB} ${OBJROOT} ${STAGE_ROOT}
|
|
|
|
|
|
|
|
CSU_DIR.${MACHINE_ARCH} ?= csu/${MACHINE_ARCH}
|
|
|
|
CSU_DIR := ${CSU_DIR.${MACHINE_ARCH}}
|
|
|
|
|
|
|
|
.if !empty(TIME_STAMP)
|
|
|
|
TRACER= ${TIME_STAMP} ${:U}
|
|
|
|
.endif
|
2016-08-31 19:30:52 +00:00
|
|
|
.if !defined(_RECURSING_PROGS) && !defined(_RECURSING_CRUNCH) && \
|
|
|
|
!make(print-dir)
|
2016-02-19 22:28:45 +00:00
|
|
|
WITH_META_STATS= t
|
2016-03-09 03:22:23 +00:00
|
|
|
.endif
|
2015-05-26 21:44:15 +00:00
|
|
|
|
|
|
|
# toolchains can be a pain - especially bootstrappping them
|
|
|
|
.if ${MACHINE} == "host"
|
|
|
|
MK_SHARED_TOOLCHAIN= no
|
|
|
|
.endif
|
2016-07-27 14:58:15 +00:00
|
|
|
TOOLCHAIN_VARS= AS AR CC CLANG_TBLGEN CXX CPP LD NM OBJCOPY RANLIB \
|
2015-12-31 14:39:45 +00:00
|
|
|
STRINGS SIZE LLVM_TBLGEN
|
2015-12-01 05:19:02 +00:00
|
|
|
_toolchain_bin_CLANG_TBLGEN= /usr/bin/clang-tblgen
|
2015-12-31 14:39:45 +00:00
|
|
|
_toolchain_bin_LLVM_TBLGEN= /usr/bin/llvm-tblgen
|
2015-12-01 05:19:02 +00:00
|
|
|
_toolchain_bin_CXX= /usr/bin/c++
|
2015-05-26 21:44:15 +00:00
|
|
|
.ifdef WITH_TOOLSDIR
|
|
|
|
TOOLSDIR?= ${HOST_OBJTOP}/tools
|
2015-12-01 05:19:02 +00:00
|
|
|
.elif defined(STAGE_HOST_OBJTOP)
|
2015-05-26 21:44:15 +00:00
|
|
|
TOOLSDIR?= ${STAGE_HOST_OBJTOP}
|
|
|
|
.endif
|
2016-05-21 01:31:44 +00:00
|
|
|
# Only define if it exists in case user didn't run bootstrap-tools. Otherwise
|
|
|
|
# the tool will be built during the build. Building it assumes it is
|
|
|
|
# TARGET==MACHINE.
|
|
|
|
.if exists(${HOST_OBJTOP}/tools${.CURDIR})
|
2016-05-09 22:21:09 +00:00
|
|
|
BTOOLSPATH= ${HOST_OBJTOP}/tools${.CURDIR}
|
2016-05-21 01:31:44 +00:00
|
|
|
.endif
|
2016-05-09 22:21:09 +00:00
|
|
|
|
2015-12-01 05:19:02 +00:00
|
|
|
# Don't use the bootstrap tools logic on itself.
|
|
|
|
.if ${.TARGETS:Mbootstrap-tools} == "" && \
|
2015-12-08 17:09:17 +00:00
|
|
|
!make(showconfig) && \
|
2015-12-01 05:19:02 +00:00
|
|
|
!defined(BOOTSTRAPPING_TOOLS) && !empty(TOOLSDIR) && ${.MAKE.LEVEL} == 0
|
|
|
|
.for dir in /sbin /bin /usr/sbin /usr/bin
|
|
|
|
PATH:= ${TOOLSDIR}${dir}:${PATH}
|
|
|
|
.endfor
|
2015-05-26 21:44:15 +00:00
|
|
|
.export PATH
|
2015-12-01 05:19:02 +00:00
|
|
|
# Prefer the TOOLSDIR version of the toolchain if present vs the host version.
|
|
|
|
.for var in ${TOOLCHAIN_VARS}
|
|
|
|
_toolchain_bin.${var}= ${TOOLSDIR}${_toolchain_bin_${var}:U/usr/bin/${var:tl}}
|
|
|
|
.if exists(${_toolchain_bin.${var}})
|
|
|
|
HOST_${var}?= ${_toolchain_bin.${var}}
|
2016-03-11 23:45:13 +00:00
|
|
|
.export HOST_${var}
|
2015-05-26 21:44:15 +00:00
|
|
|
.endif
|
2015-12-01 05:19:02 +00:00
|
|
|
.endfor
|
2015-09-23 22:36:01 +00:00
|
|
|
.endif
|
2015-05-26 21:44:15 +00:00
|
|
|
|
2015-12-01 05:19:02 +00:00
|
|
|
.for var in ${TOOLCHAIN_VARS}
|
|
|
|
HOST_${var}?= ${_toolchain_bin_${var}:U/usr/bin/${var:tl}}
|
|
|
|
.endfor
|
2015-12-01 00:53:17 +00:00
|
|
|
|
|
|
|
.if ${MACHINE} == "host"
|
2015-12-01 05:19:02 +00:00
|
|
|
.for var in ${TOOLCHAIN_VARS}
|
|
|
|
${var}= ${HOST_${var}}
|
|
|
|
.endfor
|
2015-11-11 23:52:08 +00:00
|
|
|
.endif
|
|
|
|
|
2015-05-26 21:44:15 +00:00
|
|
|
.if ${MACHINE:Nhost:Ncommon} != "" && ${MACHINE} != ${HOST_MACHINE}
|
|
|
|
# cross-building
|
|
|
|
.if !defined(FREEBSD_REVISION)
|
|
|
|
FREEBSD_REVISION!= sed -n '/^REVISION=/{s,.*=,,;s,",,g;p; }' ${SRCTOP}/sys/conf/newvers.sh
|
|
|
|
.export FREEBSD_REVISION
|
|
|
|
.endif
|
|
|
|
CROSS_TARGET_FLAGS= -target ${MACHINE_ARCH}-unknown-freebsd${FREEBSD_REVISION}
|
|
|
|
CFLAGS+= ${CROSS_TARGET_FLAGS}
|
|
|
|
ACFLAGS+= ${CROSS_TARGET_FLAGS}
|
|
|
|
LDFLAGS+= -Wl,-m -Wl,elf_${MACHINE_ARCH}_fbsd
|
|
|
|
.endif
|
2016-06-05 23:04:42 +00:00
|
|
|
|
|
|
|
META_MODE+= missing-meta=yes
|
|
|
|
.if empty(META_MODE:Mnofilemon)
|
|
|
|
META_MODE+= missing-filemon=yes
|
|
|
|
.endif
|