Introduced separate CXXFLAGS for use with C++ code in the same style as the existing CFLAGS. Prepended _ to some configure.in private variables.

This commit is contained in:
cls%seawood.org 1999-03-07 05:18:45 +00:00
parent a88c4f62d6
commit 202df19f2e
9 changed files with 56 additions and 41 deletions

View File

@ -37,6 +37,6 @@ CPPSRCS = \
include $(topsrcdir)/config/config.mk
CFLAGS += $(TK_CFLAGS)
CXXFLAGS += $(TK_CFLAGS)
include $(topsrcdir)/config/rules.mk

View File

@ -61,11 +61,16 @@ MOZ_BUILD_NSPR = @MOZ_BUILD_NSPR@
# Should the extra CFLAGS only be added in Makefile.ins that need them?
ifdef MOZ_DEBUG
OS_CFLAGS = $(filter-out -O%, @CFLAGS@) $(DSO_CFLAGS)
OS_CFLAGS = $(filter-out -O%, @CFLAGS@)
OS_CXXFLAGS = $(filter-out -O%, @CXXFLAGS@)
else
OS_CFLAGS = @CFLAGS@ $(DSO_CFLAGS)
OS_CFLAGS = @CFLAGS@
OS_CXXFLAGS = @CXXFLAGS@
endif
OS_CFLAGS += $(DSO_CFLAGS)
OS_CXXFLAGS += $(DSO_CFLAGS)
OS_INCLUDES = $(NSPR_CFLAGS) $(JPEG_CFLAGS) $(PNG_CFLAGS) $(ZLIB_CFLAGS)
OS_LIBS = @LDFLAGS@ @LIBS@
AC_DEFINES = @DEFS@
@ -82,12 +87,7 @@ XLDFLAGS = @XLDFLAGS@
XLIBS = @XLIBS@
CC = @CC@
# The right way to set these rtti and exceptions flags is probably using
# CXXFLAGS. But, CXXFLAGS is currently not used. It scares me a lot
# set CXXFLAGS for the whole project without knowing what side effects
# it could have in implicit make rules or even rules.mk
CXX = @CXX@ @MOZ_RTTI_FLAGS@ @MOZ_EXCEPTIONS_FLAGS@
CXX = @CXX@
GNU_CC = @GNU_CC@
GNU_CXX = @GNU_CXX@

View File

@ -122,6 +122,7 @@ OS_CONFIG := $(OS_ARCH)$(OS_RELEASE)
ifneq (, $(filter $(MODULE), $(MOZ_DEBUG_MODULES)))
MOZ_DEBUG=1
OS_CFLAGS += -g
OS_CXXFLAGS += -g
endif
#
@ -353,8 +354,10 @@ endif
endif
CFLAGS = $(XP_DEFINE) $(OPTIMIZER) $(OS_CFLAGS) $(MDUPDATE_FLAGS) $(DEFINES) $(AC_INCLUDE_OR_DEFINES) $(INCLUDES) $(XCFLAGS) $(PROF_FLAGS)
CXXFLAGS = $(XP_DEFINE) $(OPTIMIZER) $(OS_CXXFLAGS) $(MDUPDATE_FLAGS) $(DEFINES) $(AC_INCLUDE_OR_DEFINES) $(INCLUDES) $(XCFLAGS) $(PROF_FLAGS)
NOMD_CFLAGS = $(XP_DEFINE) $(OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(AC_INCLUDE_OR_DEFINES) $(INCLUDES) $(XCFLAGS)
NOMD_CXXFLAGS = $(XP_DEFINE) $(OPTIMIZER) $(OS_CXXFLAGS) $(DEFINES) $(AC_INCLUDE_OR_DEFINES) $(INCLUDES) $(XCFLAGS)
#
# Include the binary distrib stuff, if necessary.
@ -737,6 +740,6 @@ ifndef USE_AUTOCONF
# From nsprpub/config/config.mk, mozilla/jpeg needs to know
# about USE_PTHREADS. This fixes platforms like SparcLinux. -mcafee
ifeq ($(USE_PTHREADS), 1)
OS_CFLAGS += -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM
DEFINES += -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM
endif
endif #!USE_AUTOCONF

View File

@ -418,7 +418,7 @@ ifeq ($(OS_ARCH),WINNT)
$(CC) $(PROGOBJS) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
else
ifeq ($(CPP_PROG_LINK),1)
$(CCC) $(CFLAGS) $(WRAP_MALLOC_CFLAGS) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB)
$(CCC) $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB)
else
$(CCF) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
endif
@ -438,7 +438,7 @@ $(SIMPLE_PROGRAMS):$(OBJDIR)/%: $(OBJDIR)/%.o
@$(MAKE_OBJDIR)
@$(MAKE_DEPDIR)
ifeq ($(CPP_PROG_LINK),1)
$(CCC) $(CFLAGS) $(WRAP_MALLOC_CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB)
$(CCC) $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB)
else
$(CCF) -o $@ $^ $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
endif
@ -450,7 +450,7 @@ endif
#
pure: $(PROGRAM)
ifeq ($(CPP_PROG_LINK),1)
$(PURIFY) $(CCC) $(CFLAGS) -o $^.pure $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
$(PURIFY) $(CCC) $(CXXFLAGS) -o $^.pure $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
else
$(PURIFY) $(CCF) -o $^.pure $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
endif
@ -540,32 +540,32 @@ $(OBJDIR)/%.o: %.S
$(OBJDIR)/%: %.cpp
@$(MAKE_OBJDIR)
@$(MAKE_DEPDIR)
$(CCC) -o $@ $(CFLAGS) $< $(LDFLAGS)
$(CCC) -o $@ $(CXXFLAGS) $< $(LDFLAGS)
#
# Please keep the next two rules in sync.
#
$(OBJDIR)/%.o: %.cc
@$(MAKE_OBJDIR)
$(CCC) -o $@ -c $(CFLAGS) $<
$(CCC) -o $@ -c $(CXXFLAGS) $<
$(OBJDIR)/%.o: %.cpp
@$(MAKE_OBJDIR)
@$(MAKE_DEPDIR)
ifdef STRICT_CPLUSPLUS_SUFFIX
echo "#line 1 \"$*.cpp\"" | cat - $*.cpp > $(OBJDIR)/t_$*.cc
$(CCC) -o $@ -c $(CFLAGS) $(OBJDIR)/t_$*.cc
$(CCC) -o $@ -c $(CXXFLAGS) $(OBJDIR)/t_$*.cc
rm -f $(OBJDIR)/t_$*.cc
else
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
$(CCC) -Fo$@ -c $(CFLAGS) $<
$(CCC) -Fo$@ -c $(CXXFLAGS) $<
else
$(CCC) -o $@ -c $(CFLAGS) $<
$(CCC) -o $@ -c $(CXXFLAGS) $<
endif
endif #STRICT_CPLUSPLUS_SUFFIX
%.i: %.cpp
$(CCC) -C -E $(CFLAGS) $< > $*.i
$(CCC) -C -E $(CXXFLAGS) $< > $*.i
%.i: %.c
$(CC) -C -E $(CFLAGS) $< > $*.i

View File

@ -170,13 +170,16 @@ dnl Assumes the native ld is being used.
;;
alpha*-*-linux*)
CFLAGS="$CFLAGS -mieee" ;;
CFLAGS="$CFLAGS -mieee"
CXXFLAGS="$CXXFLAGS -mieee"
;;
alpha*-*-osf*)
if [ test "$GNU_CC" = 1 ]; then
DSO_LDOPTS='-shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.$(DLL_SUFFIX)=%.$(DLL_SUFFIX))'
else
CFLAGS="$CFLAGS -std1 -ieee_with_inexact"
CXXFLAGS="$CXXFLAGS -std1 -ieee_with_inexact"
DSO_LDOPTS='-shared -expect_unresolved \* -soname $(@:$(OBJDIR)/%.$(DLL_SUFFIX)=%.$(DLL_SUFFIX))'
DSO_CFLAGS=
fi ;;
@ -241,6 +244,7 @@ alpha*-*-osf*)
AC_DEFINE(IRIX6_3)
DSO_LDOPTS='-elf -shared'
CFLAGS="$CFLAGS -woff 3262"
CXXFLAGS="$CXXFLAGS -woff 3262"
if test -z "$GNU_CC"; then
MKSHLIB_FORCE_ALL=-all
MKSHLIB_UNFORCE_ALL=-none
@ -393,7 +397,7 @@ dnl By default, turn rtti and exceptions off on g++/egcs
dnl ========================================================
if [ test -n "$GNU_CXX" ]; then
MOZ_RTTI_FLAGS=-fno-rtti
_MOZ_RTTI_FLAGS=-fno-rtti
AC_MSG_CHECKING(for C++ exceptions flag)
@ -414,7 +418,7 @@ dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
rm -f $_tmp_output ])
AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
MOZ_EXCEPTIONS_FLAGS=$ac_cv_cxx_exceptions_flags
_MOZ_EXCEPTIONS_FLAGS=$ac_cv_cxx_exceptions_flags
fi
dnl Put your C++ language/feature checks below
@ -575,10 +579,12 @@ AC_CACHE_VAL(ac_cv_cc_wall_flag,
[ac_cv_cc_wall_flag=false])])
if test $ac_cv_cc_wall_flag = true ; then
AC_MSG_RESULT(yes)
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall"
else
AC_MSG_RESULT(no)
fi
_SAVE_CC=$CC ; CC=$CXX
CFLAGS="$CXXFLAGS -Wall"
AC_MSG_CHECKING($CXX for \"-Wall\" support)
AC_CACHE_VAL(ac_cv_cxx_wall_flag,
[AC_TRY_COMPILE([],
@ -587,12 +593,10 @@ AC_CACHE_VAL(ac_cv_cxx_wall_flag,
[ac_cv_cxx_wall_flag=false])])
if test $ac_cv_cxx_wall_flag = true ; then
AC_MSG_RESULT(yes)
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall"
else
AC_MSG_RESULT(no)
fi
if test $ac_cv_cc_wall_flag = true -a $ac_cv_cxx_wall_flag = true ; then
WARNINGS_CFLAGS="${WARNINGS_CFLAGS} -Wall"
fi
CC=$_SAVE_CC
CFLAGS=$_SAVE_CFLAGS
@ -650,7 +654,7 @@ dnl [ NO_UNIX_LDAP=1 ])
MOZ_ARG_ENABLE_BOOL(mailnews,
[ --enable-mailnews Enable Mail & News],
MOZ_MAIL_NEWS=1)
[ MOZ_MAIL_NEWS=1 AC_DEFINE(MOZ_MAIL_NEWS) ] )
dnl Note: This conflicts with --disable-shared
MOZ_ARG_ENABLE_BOOL(oji,
@ -699,20 +703,21 @@ MOZ_ARG_DISABLE_BOOL(asserts,
MOZ_ARG_ENABLE_BOOL_OR_STRING(debug,
[ --enable-debug Enable debug symbols],
[ MOZ_DEBUG=1 CFLAGS="$CFLAGS -g" ],
[ MOZ_DEBUG=1 CFLAGS="$CFLAGS -g" CXXFLAGS="$CXXFLAGS -g" ],
[],
[MOZ_DEBUG_MODULES=`echo $enableval | sed 's|,| |g'` ])
MOZ_ARG_ENABLE_BOOL(md,
[ --enable-md Use compiler-based dependencies ],
[ COMPILER_DEPEND=1
DEPEND_CFLAGS='-Wp,-MMD,$(*D)/.deps/$(*F).pp' ]
_DEPEND_CFLAGS='-Wp,-MMD,$(*D)/.deps/$(*F).pp' ]
)
dnl Make pedantic a flag for now since the builds currently choke on it.
MOZ_ARG_ENABLE_BOOL(pedantic,
[ --enable-pedantic Issue all warnings demanded by strict ANSI C ],
WARNINGS_CFLAGS="${WARNINGS_CFLAGS} -pedantic")
[ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -pedantic"
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -pedantic" ])
dnl Note: This should not be disabled if --enable-oji is set
MOZ_ARG_DISABLE_BOOL(shared,
@ -723,21 +728,21 @@ dnl C++ rtti (g++/egcs only - for now)
dnl Should be smarter and check that the compiler does indeed have rtti
MOZ_ARG_ENABLE_BOOL(cpp-rtti,
[ --enable-cpp-rtti Enable C++ RTTI ],
[ MOZ_RTTI_FLAGS=-frtti ]
[ _MOZ_RTTI_FLAGS=-frtti ]
)
dnl C++ exceptions (g++/egcs only - for now)
dnl Should be smarter and check that the compiler does indeed have exceptions
MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
[ --enable-cpp-exceptions Enable C++ exceptions ],
[ MOZ_EXCEPTIONS_FLAGS=-fexceptions ]
[ _MOZ_EXCEPTIONS_FLAGS=-fexceptions ]
)
MOZ_ARG_HEADER(Profiling and Instrumenting)
MOZ_ARG_ENABLE_BOOL(gprof,
[ --enable-gprof Enable gprof symbols],
[ GPROF_CFLAGS="-pg" ])
[ _GPROF_CFLAGS="-pg" ])
MOZ_ARG_ENABLE_BOOL(insure,
[ --enable-insure Enable insure++ instrumentation (linux only)],
@ -853,8 +858,6 @@ AC_SUBST(FULL_STATIC_BUILD)
AC_SUBST(NO_UNIX_LDAP)
AC_SUBST(MOZ_IDL_TOOL)
AC_SUBST(COMPILER_DEPEND)
AC_SUBST(MOZ_RTTI_FLAGS)
AC_SUBST(MOZ_EXCEPTIONS_FLAGS)
dnl Checks for X libraries.
dnl Ordering is important.
@ -1180,6 +1183,7 @@ AC_ARG_WITH(pthreads,
AC_DEFINE(_REENTRANT)
else
CFLAGS="$CFLAGS -pthread"
CXXFLAGS="$CXXFLAGS -pthread"
fi ;;
esac
fi] )
@ -1258,11 +1262,18 @@ dnl ========================================================
dnl Echo the CFLAGS to remove extra whitespace.
CFLAGS=`echo \
$WARNINGS_CFLAGS \
$GPROF_CFLAGS \
$DEPEND_CFLAGS \
$_WARNINGS_CFLAGS \
$_GPROF_CFLAGS \
$_DEPEND_CFLAGS \
$CFLAGS`
CXXFLAGS=`echo \
$_MOZ_RTTI_FLAGS \
$_MOZ_EXCEPTIONS_FLAGS \
$_WARNINGS_CFLAGS \
$_GPROF_CFLAGS \
$_DEPEND_CFLAGS \
$CXXFLAGS`
dnl Support for X11 makedepend, if found on the system
dnl ========================================================
AC_PATH_PROG(SYSTEM_MAKEDEPEND,makedepend)
@ -1283,6 +1294,7 @@ AC_SUBST(NSPR_CFLAGS)
AC_SUBST(NSPR_LIBS)
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(LIBS)

View File

@ -31,7 +31,7 @@ MODULE=raptor
REQUIRES=util img xpcom raptor netlib ps
DEFINES += -D_IMPL_NS_GFXONXP
CFLAGS += $(TK_CFLAGS)
CXXFLAGS += $(TK_CFLAGS)
CPPSRCS = \
nsDeviceContextGTK.cpp \

View File

@ -149,7 +149,7 @@ LIBS = \
include $(topsrcdir)/config/config.mk
CFLAGS += $(TOOLKIT_CFLAGS)
CXXFLAGS += $(TOOLKIT_CFLAGS)
include $(topsrcdir)/config/rules.mk

View File

@ -54,7 +54,7 @@ CPPSRCS := \
include $(topsrcdir)/config/config.mk
CFLAGS += $(TK_CFLAGS)
CXXFLAGS += $(TK_CFLAGS)
TOOLKIT_DSO_LDOPTS = $(addprefix $(DIST)/lib/libraptorwidget, \
$(addsuffix _s.a, $(MOZ_TOOLKIT)))

View File

@ -41,7 +41,7 @@ LOCAL_INCLUDES := \
include $(topsrcdir)/config/config.mk
CFLAGS += $(TK_CFLAGS)
CXXFLAGS += $(TK_CFLAGS)
MKSHLIB :=