diff options
Diffstat (limited to 'share/mk')
-rw-r--r-- | share/mk/bsd.cpu.mk | 45 | ||||
-rw-r--r-- | share/mk/bsd.port.subdir.mk | 4 | ||||
-rw-r--r-- | share/mk/bsd.stand.mk | 24 | ||||
-rw-r--r-- | share/mk/bsd.subdir.mk | 8 | ||||
-rw-r--r-- | share/mk/local.meta.sys.mk | 7 | ||||
-rw-r--r-- | share/mk/src.libnames.mk | 3 | ||||
-rw-r--r-- | share/mk/sys.mk | 21 |
7 files changed, 98 insertions, 14 deletions
diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk index 6ba87cc..112c2d5 100644 --- a/share/mk/bsd.cpu.mk +++ b/share/mk/bsd.cpu.mk @@ -150,6 +150,7 @@ _CPUCFLAGS = -mcpu=ultrasparc3 # unordered list to make it easy for client makefiles to test for the # presence of a CPU feature. +########## i386 . if ${MACHINE_CPUARCH} == "i386" . if ${CPUTYPE} == "bdver4" MACHINE_CPU = xop avx2 avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586 @@ -218,6 +219,7 @@ MACHINE_CPU = 3dnow mmx MACHINE_CPU = mmx . endif MACHINE_CPU += i486 +########## amd64 . elif ${MACHINE_CPUARCH} == "amd64" . if ${CPUTYPE} == "bdver4" MACHINE_CPU = xop avx2 avx sse42 sse41 ssse3 sse4a sse3 @@ -253,10 +255,12 @@ MACHINE_CPU = ssse3 sse3 MACHINE_CPU = sse3 . endif MACHINE_CPU += amd64 sse2 sse mmx +########## powerpc . elif ${MACHINE_ARCH} == "powerpc" . if ${CPUTYPE} == "e500" -MACHINE_CPU = booke +MACHINE_CPU = booke softfp . endif +########## sparc64 . elif ${MACHINE_ARCH} == "sparc64" . if ${CPUTYPE} == "v9" MACHINE_CPU = v9 @@ -272,8 +276,24 @@ MACHINE_CPU = v9 ultrasparc ultrasparc3 CFLAGS += -G0 .endif +########## arm +.if ${MACHINE_CPUARCH} == "arm" +MACHINE_CPU += arm +. if ${MACHINE_ARCH:Marmv6*} != "" +MACHINE_CPU += armv6 +. endif +# armv6 is a hybrid. It uses the softfp ABI, but doesn't emulate +# floating point in the general case, so don't define softfp for +# it at this time. arm and armeb are pure softfp, so define it +# for them. +. if ${MACHINE_ARCH:Marmv6*} == "" +MACHINE_CPU += softfp +. endif .if ${MACHINE_ARCH} == "armv6" -_CPUCFLAGS += -mfloat-abi=softfp +# Needs to be CFLAGS not _CPUCFLAGS because it's needed for the ABI +# not a nice optimization. +CFLAGS += -mfloat-abi=softfp +.endif .endif # NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk @@ -282,6 +302,27 @@ _CPUCFLAGS += -mfloat-abi=softfp CFLAGS += ${_CPUCFLAGS} .endif +# +# Prohibit the compiler from emitting SIMD instructions. +# These flags are added to CFLAGS in areas where the extra context-switch +# cost outweighs the advantages of SIMD instructions. +# +# gcc: +# Setting -mno-mmx implies -mno-3dnow +# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3 and -mfpmath=387 +# +# clang: +# Setting -mno-mmx implies -mno-3dnow and -mno-3dnowa +# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and +# -mno-sse42 +# (-mfpmath= is not supported) +# +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +CFLAGS_NO_SIMD.clang= -mno-avx +CFLAGS_NO_SIMD= -mno-mmx -mno-sse +.endif +CFLAGS_NO_SIMD += ${CFLAGS_NO_SIMD.${COMPILER_TYPE}} + # Add in any architecture-specific CFLAGS. # These come from make.conf or the command line or the environment. CFLAGS += ${CFLAGS.${MACHINE_ARCH}} diff --git a/share/mk/bsd.port.subdir.mk b/share/mk/bsd.port.subdir.mk index 8e608a1..380983d 100644 --- a/share/mk/bsd.port.subdir.mk +++ b/share/mk/bsd.port.subdir.mk @@ -10,8 +10,12 @@ _PORTSDIR= ${.CURDIR}/${RELPATH} .endif .endfor _PORTSDIR?= /usr/ports +.if defined(.PARSEDIR) +PORTSDIR= ${_PORTSDIR:tA} +.else # fmake doesn't have :tA PORTSDIR!= realpath ${_PORTSDIR} .endif +.endif BSDPORTSUBDIRMK?= ${PORTSDIR}/Mk/bsd.port.subdir.mk diff --git a/share/mk/bsd.stand.mk b/share/mk/bsd.stand.mk new file mode 100644 index 0000000..965171b --- /dev/null +++ b/share/mk/bsd.stand.mk @@ -0,0 +1,24 @@ +# $FreeBSD$ +# +# Common definitons for programs building in the stand-alone environment +# and/or using libstand. +# + +CFLAGS+= -ffreestanding -Wformat +CFLAGS+= ${CFLAGS_NO_SIMD} -msoft-float -D_STANDALONE + +.if ${MACHINE_CPUARCH} == "i386" +CFLAGS.gcc+= -mpreferred-stack-boundary=2 +.endif +.if ${MACHINE_CPUARCH} == "amd64" +CFLAGS+= -fPIC -mno-red-zone +.endif +.if ${MACHINE} == "pc98" +CFLAGS+= -Os +.endif +.if ${MACHINE_CPUARCH} == "aarch64" +CFLAGS+= -mgeneral-regs-only +.endif +.if ${MACHINE_CPUARCH} == "mips" +CFLAGS+= -G0 -fno-pic -mno-abicalls +.endif diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk index e1b1276..8fab656 100644 --- a/share/mk/bsd.subdir.mk +++ b/share/mk/bsd.subdir.mk @@ -16,7 +16,8 @@ # # SUBDIR A list of subdirectories that should be built as well. # Each of the targets will execute the same target in the -# subdirectories. +# subdirectories. SUBDIR.yes is automatically appeneded +# to this list. # # +++ targets +++ # @@ -43,6 +44,11 @@ _SUBDIR: .endif .if !target(_SUBDIR) +.if defined(SUBDIR) +SUBDIR:=${SUBDIR} ${SUBDIR.yes} +SUBDIR:=${SUBDIR:u} +.endif + DISTRIBUTION?= base .if !target(distribute) distribute: .MAKE diff --git a/share/mk/local.meta.sys.mk b/share/mk/local.meta.sys.mk index f927b67..09805dd 100644 --- a/share/mk/local.meta.sys.mk +++ b/share/mk/local.meta.sys.mk @@ -13,11 +13,14 @@ MK_INSTALL_AS_USER= yes .warning MAKEOBJDIRPREFIX not supported; setting MAKEOBJDIR... # put things approximately where they want OBJROOT:=${MAKEOBJDIRPREFIX}${SRCTOP:S,/src,,}/ +MAKEOBJDIRPREFIX= +.export MAKEOBJDIRPREFIX +.endif +.if empty(MAKEOBJDIR) || ${MAKEOBJDIR:M*/*} == "" # OBJTOP set below MAKEOBJDIR=$${.CURDIR:S,$${SRCTOP},$${OBJTOP},} -MAKEOBJDIRPREFIX= # export but do not track -.export-env MAKEOBJDIRPREFIX MAKEOBJDIR +.export-env MAKEOBJDIR # now for our own use MAKEOBJDIR= ${.CURDIR:S,${SRCTOP},${OBJTOP},} .endif diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index 4db46ab..e3d5bae 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -298,9 +298,6 @@ DPADD_gssapi_krb5+= ${DPADD_pthread} LDADD_gssapi_krb5+= ${LDADD_pthread} .for _l in ${LIBADD} -.if ${_PRIVATELIBS:M${_l}} -USEPRIVATELIB+= ${_l} -.endif DPADD+= ${DPADD_${_l}:Umissing-dpadd_${_l}} LDADD+= ${LDADD_${_l}} .endfor diff --git a/share/mk/sys.mk b/share/mk/sys.mk index d23d1d7..22d0e0a 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -33,16 +33,23 @@ __DEFAULT_DEPENDENT_OPTIONS= \ # early include for customization # see local.sys.mk below -.-include <local.sys.env.mk> +# Not included when building in fmake compatibility mode (still needed +# for older system support) +.if defined(.PARSEDIR) +.sinclude <local.sys.env.mk> .if ${MK_META_MODE} == "yes" -.-include <meta.sys.mk> -.elif ${MK_META_FILES} == "yes" && ${.MAKEFLAGS:U:M-B} == "" +.sinclude <meta.sys.mk> +.elif ${MK_META_FILES} == "yes" && defined(.MAKEFLAGS) +.if ${.MAKEFLAGS:M-B} == "" .MAKE.MODE= meta verbose .endif +.endif .if ${MK_AUTO_OBJ} == "yes" # This needs to be done early - before .PATH is computed -.-include <auto.obj.mk> +.sinclude <auto.obj.mk> +.endif + .endif # If the special target .POSIX appears (without prerequisites or @@ -167,6 +174,7 @@ MAKE ?= make .if !defined(%POSIX) NM ?= nm +NMFLAGS ?= OBJC ?= cc OBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} -Wno-import @@ -361,7 +369,7 @@ __MAKE_CONF?=/etc/make.conf .endif # late include for customization -.-include <local.sys.mk> +.sinclude <local.sys.mk> .if defined(__MAKE_SHELL) && !empty(__MAKE_SHELL) SHELL= ${__MAKE_SHELL} @@ -378,11 +386,12 @@ SHELL= ${__MAKE_SHELL} # when running target scripts, this is a problem for many makefiles here. # So define a shell that will do what FreeBSD expects. .ifndef WITHOUT_SHELL_ERRCTL +__MAKE_SHELL?=/bin/sh .SHELL: name=sh \ quiet="set -" echo="set -v" filter="set -" \ hasErrCtl=yes check="set -e" ignore="set +e" \ echoFlag=v errFlag=e \ - path=${__MAKE_SHELL:U/bin/sh} + path=${__MAKE_SHELL} .endif .include <bsd.cpu.mk> |