Allow modules to override *default* optimization levels by setting MODULE_OPTIMIZE_FLAGS

Bug #110215 r=bryner
This commit is contained in:
seawood%netscape.com 2001-11-16 07:42:48 +00:00
parent c70362b42d
commit 565a358143
5 changed files with 36 additions and 10 deletions

View File

@ -54,6 +54,10 @@ ifdef NSBUILDROOT
override NSBUILDROOT :=
endif
ifndef GNU_CC
MODULE_OPTIMIZE_FLAGS = -O3
endif
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/config/rules.mk

View File

@ -129,6 +129,10 @@ OS_INCLUDES = $(NSPR_CFLAGS) $(JPEG_CFLAGS) $(PNG_CFLAGS) $(MNG_CFLAGS) $(ZLIB_C
OS_LIBS = @LIBS@
ACDEFINES = @DEFS@
MOZ_OPTIMIZE = @MOZ_OPTIMIZE@
MOZ_OPTIMIZE_FLAGS = @MOZ_OPTIMIZE_FLAGS@
MOZ_OPTIMIZE_LDFLAGS = @MOZ_OPTIMIZE_LDFLAGS@
XCFLAGS = @XCFLAGS@
XLDFLAGS = @XLDFLAGS@
XLIBS = @XLIBS@

View File

@ -444,12 +444,30 @@ endif
CFLAGS = $(OS_CFLAGS)
CXXFLAGS = $(OS_CXXFLAGS)
LDFLAGS = $(OS_LDFLAGS)
# Allow each module to override the *default* optimization settings
# by setting MODULE_OPTIMIZE_FLAGS iff the developer has not given
# arguments to --enable-optimize
ifdef MOZ_OPTIMIZE
ifeq (1,$(MOZ_OPTIMIZE))
ifdef MODULE_OPTIMIZE_FLAGS
CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
CXXFLAGS += $(MODULE_OPTIMIZE_FLAGS)
else
CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
endif # MODULE_OPTIMIZE_FLAGS
else
CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
endif # MOZ_OPTIMIZE == 1
LDFLAGS += $(MOZ_OPTIMIZE_LDFLAGS)
endif # MOZ_OPTIMIZE
COMPILE_CFLAGS = $(DEFINES) $(INCLUDES) $(XCFLAGS) $(PROFILER_CFLAGS) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(OS_COMPILE_CFLAGS)
COMPILE_CXXFLAGS = $(DEFINES) $(INCLUDES) $(XCFLAGS) $(PROFILER_CFLAGS) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(OS_COMPILE_CXXFLAGS)
LDFLAGS = $(OS_LDFLAGS)
#
# Some platforms (Solaris) might require builds using either
# (or both) compiler(s).

View File

@ -28,6 +28,9 @@ include $(DEPTH)/config/autoconf.mk
MODULE = mkdepend
PROGRAM = mkdepend
ifdef GNU_CC
MODULE_OPTIMIZE_FLAGS = -O3
endif
CSRCS = \
cppsetup.c \

View File

@ -2989,8 +2989,7 @@ dnl ========================================================
dnl = Enable code optimization. OFF by default.
dnl ========================================================
MOZ_OPTIMIZE=
if test ! "$MOZ_OPTIMIZE_FLAGS"
then
if test ! "$MOZ_OPTIMIZE_FLAGS"; then
MOZ_OPTIMIZE_FLAGS="-O"
fi
@ -3000,15 +2999,13 @@ MOZ_ARG_ENABLE_STRING(optimize,
MOZ_OPTIMIZE=1
if test -n "$enableval" && test "$enableval" != "yes"; then
MOZ_OPTIMIZE_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
MOZ_OPTIMIZE=2
fi
fi ])
if test "$MOZ_OPTIMIZE"
then
CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
CXXFLAGS="$CXXFLAGS $MOZ_OPTIMIZE_FLAGS"
LDFLAGS="$LDFLAGS $MOZ_OPTIMIZE_LDFLAGS"
fi
AC_SUBST(MOZ_OPTIMIZE)
AC_SUBST(MOZ_OPTIMIZE_FLAGS)
AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
dnl ========================================================
dnl = Enable/disable debug for specific modules only