bd85fefecd7074b0359ddd53ca87efdc079bbeca
[pkgsrcv2.git] / devel / cpuflags / files / optimize_gcc.mk
1 # $Id: optimize_gcc.mk,v 1.36 2009/04/21 16:47:48 tnn Exp $
2
3 # This file is 'experimental' - which is doublespeak for unspeakably
4 # ugly, and quite broken by design.
5 #
6 # The intention is to pass additional flags to gcc to further optimise
7 # generated code. It _will_ make it impossible to debug, may fail to
8 # compile some code, and even generate curdled binaries. It is completely
9 # unsupported. Any questions should be directed to <abs@absd.org>.
10
11 .ifdef BSD_PKG_MK                       # Try to catch various package opts
12
13 # -----------------------------------------------------------------------------
14 # Per package exclusions
15
16 # firefox-1: v1.0, NetBSD i386/2.0
17 PKG_EXCLUDE_OMIT_FRAME_POINTER+=www/firefox
18 PKG_EXCLUDE_FAST_MATH+=www/firefox
19
20 # seamonkey-1.0.5: gcc-4.1.2 NetBSD 4.99.3 i386
21 PKG_EXCLUDE_OMIT_FRAME_POINTER+=www/seamonkey www/seamonkey-gtk1
22
23 PKG_EXCLUDE_OMIT_FRAME_POINTER+=mail/thunderbird mail/thunderbird-gtk1
24 PKG_EXCLUDE_OMIT_FRAME_POINTER+=mail/thunderbird15 mail/thunderbird15-gtk1
25
26 PKG_EXCLUDE_OMIT_FRAME_POINTER+=lang/lua
27 PKG_EXCLUDE_OMIT_FRAME_POINTER+=lang/ruby18-base        # NetBSD i386/3.0
28
29 # perl5: '49/49!=1 in test'
30 PKG_EXCLUDE_FAST_MATH+=lang/perl5
31
32 PKG_EXCLUDE_INLINE_FUNCTIONS+=emulators/qemu net/userppp multimedia/vlc
33
34 # binutils-2.17: Linux 2.6.21.5 i686, gcc-4.1.3
35 PKG_EXCLUDE_INLINE_FUNCTIONS+=cross/binutils devel/binutils
36
37 # procmail-3.22: debian_linux-2.6.21.5/gcc-4.1.3, gcc-4.1.2 NetBSD 4.0_BETA2
38 PKG_EXCLUDE_INLINE_FUNCTIONS+=mail/procmail
39
40 # aspell-0.60.5: gcc-4.1.2 NetBSD 4.0_BETA2 i386
41 PKG_EXCLUDE_INLINE_FUNCTIONS+=textproc/aspell
42
43 # gcc3.3.3 NetBSD i386/3.0 breaks kde3
44 PKG_EXCLUDE_FAST_MATH+=x11/qt3-libs
45
46 # gcc4.1.3 NetBSD i386/4.99.29 breaks liboil
47 PKG_EXCLUDE_OMIT_FRAME_POINTER+=devel/liboil
48
49 # -----------------------------------------------------------------------------
50 # Assign default flags, then remove values based on settings above
51 #
52 COPT_FLAGS=-finline-functions -fomit-frame-pointer -ffast-math
53
54 .if !empty(PKG_EXCLUDE_OMIT_FRAME_POINTER:M${PKGPATH})
55 COPT_FLAGS:=    ${COPT_FLAGS:S/-fomit-frame-pointer//}
56 .endif
57
58 .if !empty(PKG_EXCLUDE_INLINE_FUNCTIONS:M${PKGPATH})
59 COPT_FLAGS:=    ${COPT_FLAGS:S/-finline-functions//}
60 .endif
61
62 .if !empty(PKG_EXCLUDE_FAST_MATH:M${PKGPATH})
63 COPT_FLAGS:=    ${COPT_FLAGS:S/-ffast-math//}
64 .endif
65
66 CFLAGS+=${COPT_FLAGS}
67 CXXFLAGS+=${COPT_FLAGS}
68 MAKE_FLAGS+=CCOPTIONS="${COPT_FLAGS}"   # Override CCOPTIONS for imake
69
70 .else   # (BSD_PKG_MK) Assume in NetBSD base system, only COPTS
71
72 .if ${USETOOLS:Uyes} == "no"
73 COPT_FLAGS+=-fomit-frame-pointer
74 # Include ${DEFCOPTS} and set ?= to allow overriding in kernel builds
75 .if !defined(COPTS)
76 COPTS=${DEFCOPTS} ${COPT_FLAGS}
77 .else
78 COPTS+=${COPT_FLAGS}
79 .endif
80 .endif
81
82 .endif