Remove redundant cflags
-fomit-frame-pointer is included for any optimisation level above O2 (including Os) Setting MACOS_DEPLOYMENT_TARGET is unecessary if you are just setting it the same as the OS X you are running.
This commit is contained in:
parent
d3a52adce3
commit
95eb1b4a5d
@ -24,14 +24,12 @@
|
|||||||
|
|
||||||
module HomebrewEnvExtension
|
module HomebrewEnvExtension
|
||||||
# -w: keep signal to noise high
|
# -w: keep signal to noise high
|
||||||
# -fomit-frame-pointer: we are not debugging this software, we are using it
|
SAFE_CFLAGS_FLAGS = "-w -pipe"
|
||||||
SAFE_CFLAGS_FLAGS = "-w -pipe -fomit-frame-pointer"
|
|
||||||
|
|
||||||
def setup_build_environment
|
def setup_build_environment
|
||||||
# Clear CDPATH to avoid make issues that depend on changing directories
|
# Clear CDPATH to avoid make issues that depend on changing directories
|
||||||
ENV.delete('CDPATH')
|
ENV.delete('CDPATH')
|
||||||
|
|
||||||
ENV['MACOSX_DEPLOYMENT_TARGET']=MACOS_VERSION.to_s
|
|
||||||
ENV['MAKEFLAGS']="-j#{Hardware.processor_count}"
|
ENV['MAKEFLAGS']="-j#{Hardware.processor_count}"
|
||||||
|
|
||||||
unless HOMEBREW_PREFIX.to_s == '/usr/local'
|
unless HOMEBREW_PREFIX.to_s == '/usr/local'
|
||||||
@ -51,7 +49,7 @@ module HomebrewEnvExtension
|
|||||||
|
|
||||||
ENV['CC'] = "#{prefix}/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2"
|
ENV['CC'] = "#{prefix}/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2"
|
||||||
ENV['CXX'] = "#{prefix}/usr/llvm-gcc-4.2/bin/llvm-g++-4.2"
|
ENV['CXX'] = "#{prefix}/usr/llvm-gcc-4.2/bin/llvm-g++-4.2"
|
||||||
cflags = ['-O4'] # O4 baby!
|
cflags = %w{-O4} # link time optimisation baby!
|
||||||
else
|
else
|
||||||
ENV['CC']="gcc-4.2"
|
ENV['CC']="gcc-4.2"
|
||||||
ENV['CXX']="g++-4.2"
|
ENV['CXX']="g++-4.2"
|
||||||
@ -94,7 +92,7 @@ module HomebrewEnvExtension
|
|||||||
cflags<<"-msse3"
|
cflags<<"-msse3"
|
||||||
end
|
end
|
||||||
|
|
||||||
ENV['CFLAGS']=ENV['CXXFLAGS']="#{cflags*' '} #{SAFE_CFLAGS_FLAGS} -mmacosx-version-min=#{MACOS_VERSION}"
|
ENV['CFLAGS'] = ENV['CXXFLAGS'] = "#{cflags*' '} #{SAFE_CFLAGS_FLAGS}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def deparallelize
|
def deparallelize
|
||||||
@ -104,15 +102,19 @@ module HomebrewEnvExtension
|
|||||||
|
|
||||||
def O3
|
def O3
|
||||||
# Sometimes O4 just takes fucking forever
|
# Sometimes O4 just takes fucking forever
|
||||||
remove_from_cflags '-O4'
|
remove_from_cflags /-O./
|
||||||
append_to_cflags '-O3'
|
append_to_cflags '-O3'
|
||||||
end
|
end
|
||||||
def O2
|
def O2
|
||||||
# Sometimes O3 doesn't work or produces bad binaries
|
# Sometimes O3 doesn't work or produces bad binaries
|
||||||
remove_from_cflags '-O4'
|
remove_from_cflags /-O./
|
||||||
remove_from_cflags '-O3'
|
|
||||||
append_to_cflags '-O2'
|
append_to_cflags '-O2'
|
||||||
end
|
end
|
||||||
|
def Os
|
||||||
|
# Sometimes you just want a small one
|
||||||
|
remove_from_cflags /-O./
|
||||||
|
append_to_cflags '-Os'
|
||||||
|
end
|
||||||
|
|
||||||
def gcc_4_0_1
|
def gcc_4_0_1
|
||||||
case MACOS_VERSION
|
case MACOS_VERSION
|
||||||
@ -157,6 +159,7 @@ module HomebrewEnvExtension
|
|||||||
def no_optimization
|
def no_optimization
|
||||||
self['CFLAGS']=self['CXXFLAGS'] = SAFE_CFLAGS_FLAGS
|
self['CFLAGS']=self['CXXFLAGS'] = SAFE_CFLAGS_FLAGS
|
||||||
end
|
end
|
||||||
|
|
||||||
def libxml2
|
def libxml2
|
||||||
append_to_cflags ' -I/usr/include/libxml2'
|
append_to_cflags ' -I/usr/include/libxml2'
|
||||||
end
|
end
|
||||||
@ -195,11 +198,7 @@ module HomebrewEnvExtension
|
|||||||
# i386 and x86_64 only, no PPC
|
# i386 and x86_64 only, no PPC
|
||||||
def universal_binary
|
def universal_binary
|
||||||
append_to_cflags '-arch i386 -arch x86_64'
|
append_to_cflags '-arch i386 -arch x86_64'
|
||||||
if self['CFLAGS'].include? '-O4'
|
ENV.O3 if self['CFLAGS'].include? '-O4' # O4 seems to cause the build to fail
|
||||||
# O4 seems to cause the build to fail
|
|
||||||
remove_from_cflags '-O4'
|
|
||||||
append_to_cflags '-O3'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepend key, value, separator = ' '
|
def prepend key, value, separator = ' '
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user