From owner-freebsd-arch@FreeBSD.ORG Sat Mar 15 16:59:32 2014 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BA6A7820 for ; Sat, 15 Mar 2014 16:59:32 +0000 (UTC) Received: from mail-ie0-f179.google.com (mail-ie0-f179.google.com [209.85.223.179]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 85B14D4A for ; Sat, 15 Mar 2014 16:59:32 +0000 (UTC) Received: by mail-ie0-f179.google.com with SMTP id lx4so3880224iec.10 for ; Sat, 15 Mar 2014 09:59:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=kZ76/iE/I3hjksKskQDX7bDR7usKPDj3wvBQUy1wyL8=; b=MRExCIENZ5A8OQoRoPL7GvMM+M176v4WpnM5Lhx+QnJKlCXUVk/Ud91H9W0IIP6s8F Tw/AaBHYvt0ZTwvpMQIjHWhV5BTJ4uNDSBGR1VZGJdbU9udE/xZ3R5BLtSjYhoGsKDsk ouHzIgCNxgK7gnsHk9wDuDJ2vEhH5zjCXdtvsL4RPA3k8pIhxwbeMw7DKfFF6+WKXmsI CTPeBLFUh7jc2DQYXWCAv6SOmpJTAJvfI7CRflGHO1FDRlr1CcNvxBKwPn66v0B9iuP7 krDT8/4+Y/E2ecqTl672M/lHYdTXBKHPxvZkHN8w2tKgyRBNFkTtmQyy3aC1D4f7ihnO 0kZg== X-Gm-Message-State: ALoCoQlDpXbd6wD16pBadzR1ZaUubitgBSS900BJjQtX3T5MY7yREfngazOfQVOdfpm9WJLmgsfe X-Received: by 10.42.62.196 with SMTP id z4mr2343761ich.49.1394902765753; Sat, 15 Mar 2014 09:59:25 -0700 (PDT) Received: from netflix-mac.bsdimp.com (50-78-194-198-static.hfc.comcastbusiness.net. [50.78.194.198]) by mx.google.com with ESMTPSA id kb5sm7186252igb.1.2014.03.15.09.59.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 15 Mar 2014 09:59:25 -0700 (PDT) Sender: Warner Losh Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Subject: Re: Per-arch CFLAGS From: Warner Losh In-Reply-To: <1394893695.1149.553.camel@revolution.hippie.lan> Date: Sat, 15 Mar 2014 10:59:23 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <0EBF508F-6504-414A-A2A0-39C5C2EEA6D0@bsdimp.com> References: <1394893695.1149.553.camel@revolution.hippie.lan> To: Ian Lepore X-Mailer: Apple Mail (2.1874) Cc: freebsd-arch X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Mar 2014 16:59:32 -0000 On Mar 15, 2014, at 8:28 AM, Ian Lepore wrote: > I've run into a situation where I need to pass architecture specific > CFLAGS to the world stage of a cross-build but not have those flags in > effect for the build-tools and cross-tools that run on the build host.=20= >=20 > I tried several things based on $TARGET_ARCH and manipulating the > environment in Makefile.inc1 but everything I tried either didn't work > or had unhappy side effects such as overriding automatically-supplied > internal flags with the user-supplied flags, usually resulting in = build > failure because some crucial CPUTYPE stuff would be missing. >=20 > After consulting with Warner a bit I came up with the attached rather > simple change that does the job perfectly. It adds support for a > CFLAGS.arch variable that can be set in make.conf or the command line = or > environment. Any objections to this? This looks good to me. I like it better than earlier patches, and = includes the TARGET_ARCH->MACHINE_ARCH change I was going to suggest after thinking about our last conversation. Warner > -- Ian >=20 > Index: share/mk/bsd.cpu.mk > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- share/mk/bsd.cpu.mk (revision 263112) > +++ share/mk/bsd.cpu.mk (working copy) > @@ -260,3 +260,7 @@ CFLAGS +=3D -G0 > .if !defined(NO_CPU_CFLAGS) > CFLAGS +=3D ${_CPUCFLAGS} > .endif > + > +# Add in any architecture-specific CFLAGS. =20 > +# These come from make.conf or the command line or the environment. > +CFLAGS +=3D ${CFLAGS.${MACHINE_ARCH}} > Index: share/examples/etc/make.conf > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- share/examples/etc/make.conf (revision 263112) > +++ share/examples/etc/make.conf (working copy) > @@ -60,6 +60,12 @@ > # nonstandard optimization settings > # before submitting bug reports without patches to the developers. > # > +# CFLAGS.arch provides a mechanism for applying CFLAGS only when = building=20 > +# the given architecture. This is useful primarily on a system used = for=20 > +# cross-building, when you have a set of flags to apply to the = TARGET_ARCH=20 > +# being cross-built but don't want those settings applied to building = the=20 > +# cross-tools or other components that run on the build host machine. = =20 > +# > # CXXFLAGS controls the compiler settings used when compiling C++ = code. > # Note that CXXFLAGS is initially set to the value of CFLAGS. If you = wish > # to add to CXXFLAGS value, "+=3D" must be used rather than "=3D". = Using "=3D" > @@ -71,6 +77,7 @@ > # > # CFLAGS+=3D -msse3 > # CXXFLAGS+=3D -msse3 > +# CFLAGS.armv6+=3D -mfloat-abi=3Dsoftfp > # > # MAKE_SHELL controls the shell used internally by make(1) to process = the > # command scripts in makefiles. Three shells are supported, sh, ksh, = and > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to = "freebsd-arch-unsubscribe@freebsd.org"