86 lines
2.3 KiB
Groff
86 lines
2.3 KiB
Groff
.\" $NetBSD: cpuflags.1,v 1.17 2006/07/28 23:22:37 heinz Exp $
|
|
.Dd May 31, 2001
|
|
.Dt CPUFLAGS 1
|
|
.Os
|
|
.Sh NAME
|
|
.Nm cpuflags
|
|
.Nd determine compiler flags to best target current cpu
|
|
.Sh SYNOPSIS
|
|
.Nm
|
|
.Op cc_pathname
|
|
.Sh DESCRIPTION
|
|
.Nm
|
|
detemines the current cpu type and gcc version, then outputs appropriate
|
|
compiler options to best target code for that cpu. If no options exist
|
|
to target the current cpu then nothing is output.
|
|
.Pp
|
|
In the event of the cpu not being recognised, a warning is sent to stderr.
|
|
.Pp
|
|
If
|
|
.Pa cc_pathname
|
|
is not specified it defaults to the first
|
|
.Pa cc
|
|
found in the path.
|
|
.Sh ENVIRONMENT
|
|
The BSD makefile fragment
|
|
.Pa @PREFIX@/share/mk/cpuflags.mk
|
|
will set the following
|
|
.Xr make 1
|
|
variables, plus add CPU_FLAGS and CPU_DIR to .MAKEFLAGS for sub-makes.
|
|
.Pp
|
|
.Bl -tag -width CPU_FLAGS -compact
|
|
.It CPU_FLAGS
|
|
The output of cpuflags
|
|
.It CPU_DIR
|
|
CPU_FLAGS with spaces stripped (eg: for use in PACKAGES)
|
|
.It CFLAGS
|
|
Has CPU_FLAGS appended
|
|
.It CXXFLAGS
|
|
Has CPU_FLAGS appended
|
|
.El
|
|
.Sh FILES
|
|
.Bl -tag -width @PREFIX@/share/mk/optimize_gcc.mk -compact
|
|
.It @PREFIX@/share/mk/cpuflags.mk
|
|
Set appropriate compiler flags based on the output from
|
|
.Nm .
|
|
Suitable for inclusion in /etc/mk.conf
|
|
.It @PREFIX@/share/mk/optimize_gcc.mk
|
|
Attempt to set additional -mXXX gcc flags based on gcc version and packages
|
|
being compiled. Note: This is experimental and not supported.
|
|
.El
|
|
.Sh EXAMPLES
|
|
.Nm
|
|
can be used to set default flags for building entries from pkgsrc
|
|
and recompiling the
|
|
.Nx
|
|
kernel or userland by adding the following to
|
|
.Pa /etc/mk.conf :
|
|
.Bd -literal -offset indent
|
|
.sinclude "@PREFIX@/share/mk/cpuflags.mk"
|
|
.Ed
|
|
.Pp
|
|
To experiment with optimisations that can break generated code there is
|
|
optimize_gcc.mk. This is unsupported, but for full effect add the following to
|
|
.Pa /etc/mk.conf :
|
|
.Bd -literal -offset indent
|
|
.sinclude "@PREFIX@/share/mk/cpuflags.mk"
|
|
.sinclude "@PREFIX@/share/mk/optimize_gcc.mk"
|
|
.Ed
|
|
.Pp
|
|
On all except low memory machines compliation can be speeded up by adding the
|
|
following to /etc/mk.conf. (Note this will not affect the binaries produced)
|
|
.Bd -literal -offset indent
|
|
COPTS?= -pipe ${DEFCOPTS}
|
|
CFLAGS+=-pipe
|
|
.Ed
|
|
.Sh BUGS
|
|
.Nm
|
|
still needs to learn about more cpu types - updates welcomed
|
|
to
|
|
.Aq abs@NetBSD.org .
|
|
Also the Makefile fragments and examples are BSD make
|
|
specific - gmake examples welcomed.
|
|
.Pp
|
|
Currently
|
|
.Nm
|
|
is also gcc specific.
|