mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-08 22:37:27 +00:00
[BUILD] add the CPU=native and ARCH=32/64 build options
Hank A. Paulson suggested to add CPU=native to optimize the code for the build machine. This makes sense in a lot of situations. Since it is often possible to have both 32 and 64 bits supported on recent systems, the ARCH=32 and ARCH=64 build options were also added.
This commit is contained in:
parent
26db59ea6b
commit
a5899aaad5
7
Makefile
7
Makefile
@ -78,14 +78,14 @@ TARGET =
|
|||||||
#### TARGET CPU
|
#### TARGET CPU
|
||||||
# Use CPU=<cpu_name> to optimize for a particular CPU, among the following
|
# Use CPU=<cpu_name> to optimize for a particular CPU, among the following
|
||||||
# list :
|
# list :
|
||||||
# generic, i586, i686, ultrasparc, custom
|
# generic, native, i586, i686, ultrasparc, custom
|
||||||
CPU = generic
|
CPU = generic
|
||||||
|
|
||||||
#### Architecture, used when not building for native architecture
|
#### Architecture, used when not building for native architecture
|
||||||
# Use ARCH=<arch_name> to force build for a specific architecture. Known
|
# Use ARCH=<arch_name> to force build for a specific architecture. Known
|
||||||
# architectures will lead to "-m32" or "-m64" being added to CFLAGS and
|
# architectures will lead to "-m32" or "-m64" being added to CFLAGS and
|
||||||
# LDFLAGS. This can be required to build 32-bit binaries on 64-bit targets.
|
# LDFLAGS. This can be required to build 32-bit binaries on 64-bit targets.
|
||||||
# Currently, only x86_64, i386, i486, i586 and i686 are understood.
|
# Currently, only 32, 64, x86_64, i386, i486, i586 and i686 are understood.
|
||||||
ARCH =
|
ARCH =
|
||||||
|
|
||||||
#### Toolchain options.
|
#### Toolchain options.
|
||||||
@ -134,12 +134,15 @@ SILENT_DEFINE =
|
|||||||
# them. You should not have to change these options. Better use CPU_CFLAGS or
|
# them. You should not have to change these options. Better use CPU_CFLAGS or
|
||||||
# even CFLAGS instead.
|
# even CFLAGS instead.
|
||||||
CPU_CFLAGS.generic = -O2
|
CPU_CFLAGS.generic = -O2
|
||||||
|
CPU_CFLAGS.native = -O2 -march=native
|
||||||
CPU_CFLAGS.i586 = -O2 -march=i586
|
CPU_CFLAGS.i586 = -O2 -march=i586
|
||||||
CPU_CFLAGS.i686 = -O2 -march=i686
|
CPU_CFLAGS.i686 = -O2 -march=i686
|
||||||
CPU_CFLAGS.ultrasparc = -O6 -mcpu=v9 -mtune=ultrasparc
|
CPU_CFLAGS.ultrasparc = -O6 -mcpu=v9 -mtune=ultrasparc
|
||||||
CPU_CFLAGS = $(CPU_CFLAGS.$(CPU))
|
CPU_CFLAGS = $(CPU_CFLAGS.$(CPU))
|
||||||
|
|
||||||
#### ARCH dependant flags, may be overriden by CPU flags
|
#### ARCH dependant flags, may be overriden by CPU flags
|
||||||
|
ARCH_FLAGS.32 = -m32
|
||||||
|
ARCH_FLAGS.64 = -m64
|
||||||
ARCH_FLAGS.i386 = -m32 -march=i386
|
ARCH_FLAGS.i386 = -m32 -march=i386
|
||||||
ARCH_FLAGS.i486 = -m32 -march=i486
|
ARCH_FLAGS.i486 = -m32 -march=i486
|
||||||
ARCH_FLAGS.i586 = -m32 -march=i586
|
ARCH_FLAGS.i586 = -m32 -march=i586
|
||||||
|
@ -13,6 +13,7 @@ TARGET = openbsd
|
|||||||
|
|
||||||
# pass CPU=<cpu_name> to make to optimize for a particular CPU
|
# pass CPU=<cpu_name> to make to optimize for a particular CPU
|
||||||
CPU = generic
|
CPU = generic
|
||||||
|
#CPU = native
|
||||||
#CPU = i586
|
#CPU = i586
|
||||||
#CPU = i686
|
#CPU = i686
|
||||||
#CPU = ultrasparc
|
#CPU = ultrasparc
|
||||||
@ -37,6 +38,7 @@ LIBS.openbsd =
|
|||||||
|
|
||||||
# CPU dependant optimizations
|
# CPU dependant optimizations
|
||||||
COPTS.generic = -O2
|
COPTS.generic = -O2
|
||||||
|
COPTS.native = -O2 -march=native
|
||||||
COPTS.i586 = -O2 -march=i586
|
COPTS.i586 = -O2 -march=i586
|
||||||
COPTS.i686 = -O2 -march=i686
|
COPTS.i686 = -O2 -march=i686
|
||||||
COPTS.ultrasparc = -O6 -mcpu=v9 -mtune=ultrasparc
|
COPTS.ultrasparc = -O6 -mcpu=v9 -mtune=ultrasparc
|
||||||
|
@ -13,6 +13,7 @@ TARGET = generic
|
|||||||
|
|
||||||
# pass CPU=<cpu_name> to make to optimize for a particular CPU
|
# pass CPU=<cpu_name> to make to optimize for a particular CPU
|
||||||
CPU = generic
|
CPU = generic
|
||||||
|
#CPU = native
|
||||||
#CPU = i586
|
#CPU = i586
|
||||||
#CPU = i686
|
#CPU = i686
|
||||||
#CPU = ultrasparc
|
#CPU = ultrasparc
|
||||||
@ -40,6 +41,7 @@ LIBS.darwin =
|
|||||||
|
|
||||||
# CPU dependant optimizations
|
# CPU dependant optimizations
|
||||||
COPTS.generic = -O2
|
COPTS.generic = -O2
|
||||||
|
COPTS.native = -O2 -march=native
|
||||||
COPTS.i586 = -O2 -march=i586
|
COPTS.i586 = -O2 -march=i586
|
||||||
COPTS.i686 = -O2 -march=i686
|
COPTS.i686 = -O2 -march=i686
|
||||||
COPTS.ultrasparc = -O6 -mcpu=v9 -mtune=ultrasparc
|
COPTS.ultrasparc = -O6 -mcpu=v9 -mtune=ultrasparc
|
||||||
|
5
README
5
README
@ -39,6 +39,7 @@ one of the following choices to the CPU variable :
|
|||||||
- i686 for intel PentiumPro, Pentium 2 and above, AMD Athlon
|
- i686 for intel PentiumPro, Pentium 2 and above, AMD Athlon
|
||||||
- i586 for intel Pentium, AMD K6, VIA C3.
|
- i586 for intel Pentium, AMD K6, VIA C3.
|
||||||
- ultrasparc : Sun UltraSparc I/II/III/IV processor
|
- ultrasparc : Sun UltraSparc I/II/III/IV processor
|
||||||
|
- native : use the build machine's specific processor optimizations
|
||||||
- generic : any other processor or no specific optimization. (default)
|
- generic : any other processor or no specific optimization. (default)
|
||||||
|
|
||||||
Alternatively, you may just set the CPU_CFLAGS value to the optimal GCC options
|
Alternatively, you may just set the CPU_CFLAGS value to the optimal GCC options
|
||||||
@ -47,8 +48,8 @@ for your platform.
|
|||||||
You may want to build specific target binaries which do not match your native
|
You may want to build specific target binaries which do not match your native
|
||||||
compiler's target. This is particularly true on 64-bit systems when you want
|
compiler's target. This is particularly true on 64-bit systems when you want
|
||||||
to build a 32-bit binary. Use the ARCH variable for this purpose. Right now
|
to build a 32-bit binary. Use the ARCH variable for this purpose. Right now
|
||||||
it only knows about a few x86 variants (i386,i486,i586,i686,x86_64) and sets
|
it only knows about a few x86 variants (i386,i486,i586,i686,x86_64), two
|
||||||
-m32/-m64 as well as -march=<arch> accordingly.
|
generic ones (32,64) and sets -m32/-m64 as well as -march=<arch> accordingly.
|
||||||
|
|
||||||
If your system supports PCRE (Perl Compatible Regular Expressions), then you
|
If your system supports PCRE (Perl Compatible Regular Expressions), then you
|
||||||
really should build with libpcre which is between 2 and 10 times faster than
|
really should build with libpcre which is between 2 and 10 times faster than
|
||||||
|
Loading…
Reference in New Issue
Block a user