Build flag optimization