From 32f8ca450d4ca5b61179f4212991b2d21fd16d8f Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Fri, 2 Aug 2002 18:04:22 +0000 Subject: [PATCH] TARGET_CPUTYPE should exist solely in Makefile.inc1, similar to TARGET_ARCH and TARGET. This is problematic when one has the = (unconditional) type of assigment for CPUTYPE in /etc/make.conf. (This would override what was set on the command line to "make buildworld".) Add a (horrible) kludge to Makefile.inc1 to check the type of assignment for CPUTYPE (only for those who attempts to set it to a different value). Fix an example make.conf. Fix the kernel's build-tools target (aicasm only at the moment) to catch up with bsd.cpu.mk,v 1.15 (BOOTSTRAPPING replaced with NO_CPU_CFLAGS in Makefile.inc1's BMAKE). Reviewed by: jhb --- Makefile.inc1 | 9 +++++++-- share/examples/etc/make.conf | 4 +++- share/mk/bsd.cpu.mk | 8 +------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 9bb522f088ff..37b80e5d96dc 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -126,11 +126,15 @@ MAKEOBJDIRPREFIX?= /usr/obj TARGET_ARCH?= ${MACHINE_ARCH} .if ${TARGET_ARCH} == ${MACHINE_ARCH} TARGET?= ${MACHINE} -TARGET_CPUTYPE?= ${CPUTYPE} +TARGET_CPUTYPE?=${CPUTYPE} .else TARGET?= ${TARGET_ARCH} TARGET_CPUTYPE?= .endif +_CPUTYPE!= cd ${.CURDIR}; ${MAKE} CPUTYPE=${TARGET_CPUTYPE} -V CPUTYPE +.if ${_CPUTYPE} != ${TARGET_CPUTYPE} +.error CPUTYPE global should be set with ?=. +.endif .if make(buildworld) BUILD_ARCH!= sysctl -n hw.machine_arch .if ${MACHINE_ARCH} != ${BUILD_ARCH} @@ -175,6 +179,7 @@ INSTALLTMP!= /usr/bin/mktemp -d -u -t install CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ MACHINE_ARCH=${TARGET_ARCH} \ MACHINE=${TARGET} \ + CPUTYPE=${TARGET_CPUTYPE} \ OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \ GROFF_BIN_PATH=${WORLDTMP}/usr/bin \ GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \ @@ -476,7 +481,7 @@ buildkernel: .endif cd ${KRNLOBJDIR}/${_kernel}; \ MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx/aicasm \ - ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/aic7xxx/aicasm/Makefile + ${MAKE} -DNO_CPU_CFLAGS -f ${KRNLSRCDIR}/dev/aic7xxx/aicasm/Makefile .if !defined(NO_KERNELDEPEND) cd ${KRNLOBJDIR}/${_kernel}; \ ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend diff --git a/share/examples/etc/make.conf b/share/examples/etc/make.conf index 0c3f1d4f76f5..023a45f9f489 100644 --- a/share/examples/etc/make.conf +++ b/share/examples/etc/make.conf @@ -29,7 +29,9 @@ # Alpha/AXP architecture: ev6 pca56 ev56 ev5 ev45 ev4 # Intel ia64 architecture: itanium # -#CPUTYPE=i686 +# (?= allows to buildworld for a different CPUTYPE.) +# +#CPUTYPE?=i686 #NO_CPU_CFLAGS= true # Don't add -march= to CFLAGS automatically #NO_CPU_COPTFLAGS=true # Don't add -march= to COPTFLAGS automatically # diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk index 7a9d7e241e8f..1fd7427af6a2 100644 --- a/share/mk/bsd.cpu.mk +++ b/share/mk/bsd.cpu.mk @@ -1,16 +1,10 @@ # $FreeBSD$ -# Allow TARGET_CPUTYPE to override CPUTYPE to handle the cross-build case. - -.if defined(TARGET_CPUTYPE) -CPUTYPE = ${TARGET_CPUTYPE} -.endif - # Set default CPU compile flags and baseline CPUTYPE for each arch. The # compile flags must support the minimum CPU type for each architecture but # may tune support for more advanced processors. -.if !defined(CPUTYPE) || ${CPUTYPE} == "" +.if !defined(CPUTYPE) || empty(CPUTYPE) . if ${MACHINE_ARCH} == "i386" _CPUCFLAGS = -mcpu=pentiumpro CPUTYPE = i386