Fix CMake build. Patch from Ingmar Vanhassel.
[oota-llvm.git] / Makefile.rules
index bcaed80f2db744c5338100bc3221e424a7581587..4a77bf536dffcdcbd98a53bd7947683b4542141d 100644 (file)
@@ -375,6 +375,12 @@ ifeq ($(OS),MingW)
   endif
 endif
 
+ifdef ENABLE_EXPENSIVE_CHECKS
+  # GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above.
+  # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40160
+  CXX.Flags := $(filter-out -fno-rtti,$(CXX.Flags))
+endif
+
 #--------------------------------------------------------------------
 # Directory locations
 #--------------------------------------------------------------------
@@ -515,7 +521,10 @@ endif
 # Options To Invoke Tools
 #----------------------------------------------------------
 
-CompileCommonOpts += -pedantic -Wall -W -Wwrite-strings -Wno-long-long \
+ifndef NO_PEDANTIC
+CompileCommonOpts += -pedantic
+endif
+CompileCommonOpts += -Wall -W -Wwrite-strings -Wno-long-long \
                      -Wunused -Wno-unused-parameter $(EXTRA_OPTIONS)
 
 ifeq ($(OS),HP-UX)
@@ -939,7 +948,7 @@ $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(LibDir)/.dir
        $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
          $(LIBRARYNAME)$(SHLIBEXT)
        $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
-         $(ProjLibsOptions) $(LLVMLibsOptions)
+         $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
 else
 $(LibName.SO): $(ObjectsO) $(LibDir)/.dir
        $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
@@ -1057,7 +1066,7 @@ all-local:: $(LibName.O)
 
 $(LibName.O): $(ObjectsO) $(LibDir)/.dir
        $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
-       $(Verb) $(Relink) -Wl,-r -nodefaultlibs -nostdlib -nostartfiles -o $@ $(ObjectsO)
+       $(Verb) $(Relink) -r -nodefaultlibs -nostdlib -nostartfiles -o $@ $(ObjectsO)
 
 clean-local::
 ifneq ($(strip $(LibName.O)),)