bsd.cpu.mk confusion

Ulrich Spoerlein spoerlein at informatik.uni-wuerzburg.de
Wed Jun 29 14:15:59 GMT 2005


On Wed, 29.06.2005 at 15:04:12 +0200, Björn König wrote:
> Ulrich Spoerlein wrote:
> 
> >[...]
> >Here's a minimal Makefile
> >CPUTYPE=pentium-m
> >CC=     icc
> >.include <bsd.prog.mk>
> >.include <bsd.cpu.mk>
> >Then
> >% make -V CFLAGS
> >-O2 -fno-strict-aliasing -pipe -march=pentium-m  -tpp6 -xiMK
> 
> You have overlooked that sys.mk will be processed "before any other 
> file, including makefile and Makefile" (make(1)). /usr/share/mk/sys.mk 
> includes already bsd.cpu.mk once at a time where CC has not been set to 
> 'icc'. Therefore ${_CPUCFLAGS} will be added to CFLAGS in bsd.cpu.mk. 
> Afterwards you include bsd.cpu.mk twice.

Hmm, but since CPUTYPE isn't set at that time too, there shouldn't be
the gcc-only -march flag, no?
Or is it the late macro expansion, that always confuses me.

Anyway, putting CC and CPUTYPE into make.conf solves my problems. But
the thing is, I only want these flags on some specific programs, not
all (especially CC=icc).

Looking at MAKEFILE_LIST, it looks like I'm SOL

% make -V .MAKEFILE_LIST|tr ' ' \\n|sed '/\.\./d'
/usr/share/mk/sys.mk
/etc/make.conf
/usr/share/mk/bsd.compat.mk
/usr/share/mk/bsd.cpu.mk
Makefile
/usr/share/mk/bsd.prog.mk
/usr/share/mk/bsd.init.mk
/usr/share/mk/bsd.compat.mk
/usr/share/mk/bsd.own.mk
/usr/share/mk/bsd.libnames.mk
/usr/share/mk/bsd.nls.mk
/usr/share/mk/bsd.files.mk
/usr/share/mk/bsd.incs.mk
/usr/share/mk/bsd.links.mk
/usr/share/mk/bsd.man.mk
/usr/share/mk/bsd.dep.mk
/usr/share/mk/bsd.obj.mk
/usr/share/mk/bsd.own.mk
/usr/share/mk/bsd.subdir.mk
/usr/share/mk/bsd.init.mk
/usr/share/mk/bsd.sys.mk

Well, I could delete CFLAGS and force loading bsd.cpu.mk again, so this
Makefile kinda works:

CFLAGS=
CC=icc
CPUTYPE=pentium-m

.include <bsd.prog.mk>
.include <bsd.cpu.mk>
% make -V CFLAGS
  -tpp6 -xiMK
% make -V .MAKEFILE_LIST|tr ' ' \\n|sed '/\.\./d'
/usr/share/mk/sys.mk
/etc/make.conf
/usr/share/mk/bsd.compat.mk
/usr/share/mk/bsd.cpu.mk
Makefile
/usr/share/mk/bsd.prog.mk
/usr/share/mk/bsd.init.mk
/usr/share/mk/bsd.compat.mk
/usr/share/mk/bsd.own.mk
/usr/share/mk/bsd.libnames.mk
/usr/share/mk/bsd.nls.mk
/usr/share/mk/bsd.files.mk
/usr/share/mk/bsd.incs.mk
/usr/share/mk/bsd.links.mk
/usr/share/mk/bsd.man.mk
/usr/share/mk/bsd.dep.mk
/usr/share/mk/bsd.obj.mk
/usr/share/mk/bsd.own.mk
/usr/share/mk/bsd.subdir.mk
/usr/share/mk/bsd.init.mk
/usr/share/mk/bsd.sys.mk
/usr/share/mk/bsd.cpu.mk

Am I asking for trouble using this construct? Thanks anyway for
pointing me to make(1), d'oh!

Ulrich Spoerlein
-- 
 PGP Key ID: F0DB9F44				Encrypted mail welcome!
Fingerprint: F1CE D062 0CA9 ADE3 349B  2FE8 980A C6B5 F0DB 9F44
Ok, which part of "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn."
didn't you understand?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20050629/9406c134/attachment.bin


More information about the freebsd-current mailing list