diff --git a/make/linux/makefiles/saproc.make b/make/linux/makefiles/saproc.make index d6fa6a9697cb0cdcfe19fb62e2382ba79a82788a..ffc0ec5ce5bde30984cb880c503a62101659d79c 100644 --- a/make/linux/makefiles/saproc.make +++ b/make/linux/makefiles/saproc.make @@ -59,6 +59,11 @@ ifeq ($(DEBUG_BINARIES), true) SA_DEBUG_CFLAGS = -g endif +# Optimize saproc lib at level -O3 unless it's a slowdebug build +ifneq ($(BUILD_FLAVOR), debug) + SA_OPT_FLAGS = $(OPT_CFLAGS) +endif + # if $(AGENT_DIR) does not exist, we don't build SA # also, we don't build SA on Itanium or zero. @@ -95,6 +100,7 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) $(SASRCFILES) \ $(SA_LFLAGS) \ $(SA_DEBUG_CFLAGS) \ + $(SA_OPT_FLAGS) \ $(EXTRA_CFLAGS) \ -o $@ \ -lthread_db -ldl diff --git a/make/windows/makefiles/sa.make b/make/windows/makefiles/sa.make index 84a34a71246fa348d061a5c7db0e4edffd9a2980..0edb178b484196d914093bea6c51fe22ef98b4ab 100644 --- a/make/windows/makefiles/sa.make +++ b/make/windows/makefiles/sa.make @@ -99,20 +99,25 @@ SAWINDBG=sawindbg.dll checkAndBuildSA:: $(SAWINDBG) -# These do not need to be optimized (don't run a lot of code) and it -# will be useful to have the assertion checks in place +!if "$(BUILD_FLAVOR)" == "debug" +SA_EXTRA_CFLAGS = -Od -D "_DEBUG" +!elseif "$(BUILD_FLAVOR)" == "fastdebug" +SA_EXTRA_CFLAGS = -O2 -D "_DEBUG" +!else +SA_EXTRA_CFLAGS = -O2 +!endif !if "$(BUILDARCH)" == "ia64" -SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -c +SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_CONSOLE" -D "_MBCS" -YX -FD -c !elseif "$(BUILDARCH)" == "amd64" -SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -c +SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_CONSOLE" -D "_MBCS" -YX -FD -c !if "$(COMPILER_NAME)" == "VS2005" # On amd64, VS2005 compiler requires bufferoverflowU.lib on the link command line, # otherwise we get missing __security_check_cookie externals at link time. SA_LD_FLAGS = bufferoverflowU.lib !endif !else -SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 -Gm $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -GZ -c +SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 -Gm $(GX_OPTION) -D "WIN32" -D "_WINDOWS" -D "_CONSOLE" -D "_MBCS" -YX -FD -GZ -c !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" SA_CFLAGS = $(SA_CFLAGS) -ZI !endif @@ -120,6 +125,7 @@ SA_CFLAGS = $(SA_CFLAGS) -ZI !if "$(MT)" != "" SA_LD_FLAGS = -manifest $(SA_LD_FLAGS) !endif +SA_CFLAGS = $(SA_CFLAGS) $(SA_EXTRA_CFLAGS) SASRCFILES = $(AGENT_DIR)/src/os/win32/windbg/sawindbg.cpp \ $(AGENT_DIR)/src/share/native/sadis.c