Roll back the shared library, r96559. It broke two darwins and arm, mysteriously.
[oota-llvm.git] / Makefile.rules
index 85a3b7926c85bf040afd74e65b2e83eeeb77a494..761cc812beed2d5d55311c959b178d3f0a46f782 100644 (file)
@@ -312,16 +312,6 @@ endif
 #--------------------------------------------------------------------
 
 CPP.Defines :=
-# OPTIMIZE_OPTION - The optimization level option we want to build LLVM with
-# this can be overridden on the make command line.
-ifndef OPTIMIZE_OPTION
-  ifneq ($(HOST_OS),MingW)
-    OPTIMIZE_OPTION := -O3
-  else
-    OPTIMIZE_OPTION := -O2
-  endif
-endif
-
 ifeq ($(ENABLE_OPTIMIZED),1)
   BuildMode := Release
   # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
@@ -348,11 +338,19 @@ ifeq ($(ENABLE_OPTIMIZED),1)
     KEEP_SYMBOLS := 1
   endif
 else
-  BuildMode := Debug
-  CXX.Flags += -g
-  C.Flags   += -g
-  LD.Flags  += -g
-  KEEP_SYMBOLS := 1
+  ifdef NO_DEBUG_SYMBOLS
+    BuildMode := Unoptimized
+    CXX.Flags +=
+    C.Flags   +=
+    LD.Flags  +=
+    KEEP_SYMBOLS := 1
+  else
+    BuildMode := Debug
+    CXX.Flags += -g
+    C.Flags   += -g
+    LD.Flags  += -g
+    KEEP_SYMBOLS := 1
+  endif
 endif
 
 ifeq ($(ENABLE_PROFILING),1)
@@ -367,9 +365,18 @@ endif
 #    CXX.Flags += -fvisibility-inlines-hidden
 #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
+  REQUIRES_RTTI := 1
+endif
+
 # IF REQUIRES_EH=1 is specified then don't disable exceptions
 ifndef REQUIRES_EH
   CXX.Flags += -fno-exceptions
+else
+  # If the library requires EH, it also requires RTTI.
+  REQUIRES_RTTI := 1
 endif
 
 ifdef REQUIRES_FRAME_POINTER
@@ -379,9 +386,9 @@ ifdef REQUIRES_FRAME_POINTER
 endif
 
 # If REQUIRES_RTTI=1 is specified then don't disable run-time type id.
-ifeq ($(REQUIRES_RTTI), 1)
-  CXX.Flags := $(filter-out -fno-rtti,$(CXX.Flags))
-  CXXFLAGS := $(filter-out -fno-rtti,$(CXXFLAGS))
+ifneq ($(REQUIRES_RTTI), 1)
+  CXX.Flags += -fno-rtti
+  CXXFLAGS += -fno-rtti
 endif
 
 ifdef ENABLE_COVERAGE
@@ -441,6 +448,17 @@ else
   endif
 endif
 
+ifeq ($(HOST_OS),MingW)
+  # Work around PR4957
+  CPP.Defines += -D__NO_CTYPE_INLINE
+  ifeq ($(LLVM_CROSS_COMPILING),1)
+    # Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016
+    ifdef TOOLNAME
+      LD.Flags += -Wl,--allow-multiple-definition
+    endif
+  endif
+endif
+
 CXX.Flags     += -Woverloaded-virtual
 CPP.BaseFlags += $(CPP.Defines)
 AR.Flags      := cru
@@ -459,22 +477,6 @@ ifeq ($(ARCH),Alpha)
   LD.Flags += -Wl,--no-relax
 endif
 
-ifeq ($(HOST_OS),MingW)
-  ifeq ($(LLVM_CROSS_COMPILING),1)
-    # Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016
-    ifdef TOOLNAME
-      LD.Flags += -Wl,--allow-multiple-definition
-    endif
-  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))
-  CXXFLAGS := $(filter-out -fno-rtti,$(CXXFLAGS))
-endif
-
 #--------------------------------------------------------------------
 # Directory locations
 #--------------------------------------------------------------------
@@ -566,6 +568,8 @@ endif
 ifeq ($(TARGET_OS),Darwin)
   ifneq ($(ARCH),ARM)
     TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
+  else
+    TargetCommonOpts += -marm
   endif
 endif
 
@@ -671,6 +675,10 @@ ifeq ($(HOST_OS),SunOS)
 CPP.BaseFlags += -include llvm/System/Solaris.h
 endif
 
+ifeq ($(HOST_OS),AuroraUX)
+CPP.BaseFlags += -include llvm/System/Solaris.h
+endif # !HOST_OS - AuroraUX.
+
 LD.Flags      += -L$(LibDir) -L$(LLVMLibDir)
 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
 # All -I flags should go here, so that they don't confuse llvm-config.
@@ -732,6 +740,8 @@ else
 Ranlib        = ranlib
 endif
 
+AliasTool     = ln -s
+
 #----------------------------------------------------------
 # Get the list of source files and compute object file
 # names from them.
@@ -1211,10 +1221,20 @@ ifdef TOOLNAME
 #---------------------------------------------------------
 # Set up variables for building a tool.
 #---------------------------------------------------------
+TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
+ifdef EXAMPLE_TOOL
+ToolBuildPath   := $(ExmplDir)/$(TOOLEXENAME)
+else
+ToolBuildPath   := $(ToolDir)/$(TOOLEXENAME)
+endif
+
+# TOOLALIAS is a name to symlink (or copy) the tool to.
+ifdef TOOLALIAS
 ifdef EXAMPLE_TOOL
-ToolBuildPath   := $(ExmplDir)/$(strip $(TOOLNAME))$(EXEEXT)
+ToolAliasBuildPath   := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
 else
-ToolBuildPath   := $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT)
+ToolAliasBuildPath   := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
+endif
 endif
 
 #---------------------------------------------------------
@@ -1234,7 +1254,7 @@ endif
 endif
 
 ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD))
-LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
+  LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
 endif
 endif
 
@@ -1242,12 +1262,15 @@ endif
 #---------------------------------------------------------
 # Provide targets for building the tools
 #---------------------------------------------------------
-all-local:: $(ToolBuildPath)
+all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
 
 clean-local::
 ifneq ($(strip $(ToolBuildPath)),)
        -$(Verb) $(RM) -f $(ToolBuildPath)
 endif
+ifneq ($(strip $(ToolAliasBuildPath)),)
+       -$(Verb) $(RM) -f $(ToolAliasBuildPath)
+endif
 
 ifdef EXAMPLE_TOOL
 $(ToolBuildPath): $(ExmplDir)/.dir
@@ -1262,13 +1285,22 @@ $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
        $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
           $(StripWarnMsg)
 
+ifneq ($(strip $(ToolAliasBuildPath)),)
+$(ToolAliasBuildPath): $(ToolBuildPath)
+       $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
+       $(Verb) $(RM) -f $(ToolAliasBuildPath)
+       $(Verb) $(AliasTool) $(TOOLEXENAME) $(ToolAliasBuildPath)
+       $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLNAME) \
+          $(StripWarnMsg)
+endif
+
 ifdef NO_INSTALL
 install-local::
        $(Echo) Install circumvented with NO_INSTALL
 uninstall-local::
        $(Echo) Uninstall circumvented with NO_INSTALL
 else
-DestTool = $(PROJ_bindir)/$(TOOLNAME)$(EXEEXT)
+DestTool = $(PROJ_bindir)/$(TOOLEXENAME)
 
 install-local:: $(DestTool)
 
@@ -1279,6 +1311,23 @@ $(DestTool): $(ToolBuildPath) $(PROJ_bindir)
 uninstall-local::
        $(Echo) Uninstalling $(BuildMode) $(DestTool)
        -$(Verb) $(RM) -f $(DestTool)
+
+# TOOLALIAS install.
+ifdef TOOLALIAS
+DestToolAlias = $(PROJ_bindir)/$(TOOLALIAS)$(EXEEXT)
+
+install-local:: $(DestToolAlias)
+
+$(DestToolAlias): $(DestTool) $(PROJ_bindir)
+       $(Echo) Installing $(BuildMode) $(DestToolAlias)
+       $(Verb) $(RM) -f $(DestToolAlias)
+       $(Verb) $(AliasTool) $(TOOLEXENAME) $(DestToolAlias)
+
+uninstall-local::
+       $(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
+       -$(Verb) $(RM) -f $(DestToolAlias)
+endif
+
 endif
 endif
 
@@ -1306,17 +1355,17 @@ DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
                   else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
 
-$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
+$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_SRC_DIR)/Makefile
        $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
        $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
                $(DEPEND_MOVEFILE)
 
-$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
+$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_SRC_DIR)/Makefile
        $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
        $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
                $(DEPEND_MOVEFILE)
 
-$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
+$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_SRC_DIR)/Makefile
        $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
        $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
                $(DEPEND_MOVEFILE)
@@ -1520,6 +1569,16 @@ $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir
        $(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
        $(Verb) $(TableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
 
+$(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \
+$(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir
+       $(Echo) "Building $(<F) disassembly tables with tblgen"
+       $(Verb) $(TableGen) -gen-disassembler -o $(call SYSPATH, $@) $<
+
+$(TARGET:%=$(ObjDir)/%GenEDInfo.inc.tmp): \
+$(ObjDir)/%GenEDInfo.inc.tmp : %.td $(ObjDir)/.dir
+       $(Echo) "Building $(<F) enhanced disassembly information with tblgen"
+       $(Verb) $(TableGen) -gen-enhanced-disassembly-info -o $(call SYSPATH, $@) $<
+
 $(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
 $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir
        $(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
@@ -1536,8 +1595,8 @@ $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir
        $(Verb) $(TableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
 
 $(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
-$(ObjDir)/%GenIntrinsics.inc.tmp : Intrinsics%.td $(ObjDir)/.dir
-       $(Echo) "Building $(<F) calling convention information with tblgen"
+$(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir
+       $(Echo) "Building $(<F) intrinsics information with tblgen"
        $(Verb) $(TableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
 
 clean-local::