MCDwarf: Remove unused parameter
[oota-llvm.git] / projects / sample / Makefile.llvm.rules
index 7ed1c1b4ed6b11b38f53e343a580ba68225845d9..0ec2b2e69b89c4dcf9a616cdef383ce8fb8b5171 100644 (file)
@@ -42,7 +42,7 @@ VPATH=$(PROJ_SRC_DIR)
 # Reset the list of suffixes we know how to build.
 #--------------------------------------------------------------------
 .SUFFIXES:
-.SUFFIXES: .c .cpp .cc .h .hpp .o .a .bc .td .ps .dot .ll .m .mm
+.SUFFIXES: .c .cpp .cc .h .hpp .o .a .td .ps .dot .m .mm
 .SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
 
 #--------------------------------------------------------------------
@@ -208,10 +208,12 @@ ifeq ($(ENABLE_OPTIMIZED),1)
   BuildMode := Release
   # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
   ifneq ($(HOST_OS),FreeBSD)
+  ifneq ($(HOST_OS),GNU/kFreeBSD)
   ifneq ($(HOST_OS),Darwin)
     OmitFramePointer := -fomit-frame-pointer
   endif
   endif
+  endif
 
   # Darwin requires -fstrict-aliasing to be explicitly enabled.
   # Avoid -fstrict-aliasing on Darwin for now, there are unresolved issues
@@ -250,6 +252,15 @@ ifeq ($(ENABLE_LIBCPP),1)
   LD.Flags +=  -stdlib=libc++
 endif
 
+ifeq ($(ENABLE_CXX11),1)
+  CXX.Flags += -std=c++11
+endif
+
+ifeq ($(ENABLE_WERROR),1)
+  CXX.Flags += -Werror
+  C.Flags += -Werror
+endif
+
 ifeq ($(ENABLE_PROFILING),1)
   BuildMode := $(BuildMode)+Profile
   CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
@@ -426,27 +437,6 @@ ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
   endif
 endif
 
-#--------------------------------------------------------------------
-# LLVM Capable Compiler
-#--------------------------------------------------------------------
-
-ifneq ($(findstring llvm-gcc,$(LLVMCC_OPTION)),)
-  LLVMCC := $(LLVMGCC)
-  LLVMCXX := $(LLVMGXX)
-else
-  ifneq ($(findstring clang,$(LLVMCC_OPTION)),)
-    ifneq ($(CLANGPATH),)
-      LLVMCC := $(CLANGPATH)
-      LLVMCXX := $(CLANGXXPATH)
-    else
-      ifeq ($(ENABLE_BUILT_CLANG),1)
-        LLVMCC := $(LLVMToolDir)/clang
-        LLVMCXX := $(LLVMToolDir)/clang++
-      endif
-    endif
-  endif
-endif
-
 #--------------------------------------------------------------------
 # Full Paths To Compiled Tools and Utilities
 #--------------------------------------------------------------------
@@ -492,16 +482,24 @@ ifeq ($(HOST_OS),Darwin)
 
   LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress
   SharedLinkOptions := -dynamiclib
-  ifneq ($(ARCH),ARM)
-    SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
+  ifdef DEPLOYMENT_TARGET
+    SharedLinkOptions += $(DEPLOYMENT_TARGET)
+  else
+    ifneq ($(ARCH),ARM)
+      SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
+    endif
   endif
 else
   SharedLinkOptions=-shared
 endif
 
 ifeq ($(TARGET_OS),Darwin)
-  ifneq ($(ARCH),ARM)
-    TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
+  ifdef DEPLOYMENT_TARGET
+    TargetCommonOpts += $(DEPLOYMENT_TARGET)
+  else
+    ifneq ($(ARCH),ARM)
+      TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
+    endif
   endif
 endif
 
@@ -536,21 +534,18 @@ ifndef KEEP_SYMBOLS
   Install.StripFlag += -s
 endif
 
-ifdef TOOL_NO_EXPORTS
-  DynamicFlags :=
-else
-  DynamicFlag := $(RDYNAMIC)
-endif
-
 # Adjust linker flags for building an executable
 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+  ifndef TOOL_NO_EXPORTS
+    LD.Flags += $(RDYNAMIC)
+  endif
 ifneq ($(HOST_OS), Darwin)
 ifdef TOOLNAME
   LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
   ifdef EXAMPLE_TOOL
-    LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
+    LD.Flags += $(RPATH) -Wl,$(ExmplDir)
   else
-    LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
+    LD.Flags += $(RPATH) -Wl,$(ToolDir)
   endif
 endif
 else
@@ -581,13 +576,13 @@ ifeq ($(HOST_OS),HP-UX)
   CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
 endif
 
-# If we are building a universal binary on Mac OS/X, pass extra options.  This
+# If we are building a universal binary on Mac OS X, pass extra options.  This
 # is useful to people that want to link the LLVM libraries into their universal
 # apps.
 #
 # The following can be optionally specified:
 #   UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
-#      For Mac OS/X 10.4 Intel machines, the traditional one is:
+#      For Mac OS X 10.4 Intel machines, the traditional one is:
 #      UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
 #   UNIVERSAL_ARCH can be optionally specified to be a list of architectures
 #      to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64".  This defaults to
@@ -671,14 +666,9 @@ else
                   $(LDFLAGS) $(TargetCommonOpts)  $(CompileCommonOpts) $(Strip)
 endif
 
-BCCompile.C   = $(LLVMCC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
-                $(TargetCommonOpts) $(CompileCommonOpts)
 Preprocess.C  = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
                 $(TargetCommonOpts) $(CompileCommonOpts) -E
 
-BCCompile.CXX = $(LLVMCXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
-                $(TargetCommonOpts) $(CompileCommonOpts)
-
 ProgInstall   = $(INSTALL) $(Install.StripFlag) -m 0755
 ScriptInstall = $(INSTALL) -m 0755
 DataInstall   = $(INSTALL) -m 0644
@@ -693,7 +683,6 @@ TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
 LLVMTableGen  = $(LLVM_TBLGEN) $(TableGen.Flags)
 
 Archive       = $(AR) $(AR.Flags)
-LArchive      = $(LLVMToolDir)/llvm-ar rcsf
 ifdef RANLIB
 Ranlib        = $(RANLIB)
 else
@@ -721,7 +710,6 @@ endif
 BaseNameSources := $(sort $(basename $(Sources)))
 
 ObjectsO  := $(BaseNameSources:%=$(ObjDir)/%.o)
-ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
 
 #----------------------------------------------------------
 # For Mingw MSYS bash and Python/w32:
@@ -736,7 +724,7 @@ ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
 #----------------------------------------------------------
 
 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
-  ECHOPATH := $(Verb)python -u -c "import sys;print ' '.join(sys.argv[1:])"
+  ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])"
 else
   ECHOPATH := $(Verb)$(ECHO)
 endif
@@ -1042,67 +1030,6 @@ endif
 # Library Build Rules: Four ways to build a library
 ###############################################################################
 
-#---------------------------------------------------------
-# Bytecode Module Targets:
-#   If the user set MODULE_NAME then they want to build a
-#   bytecode module from the sources. We compile all the
-#   sources and link it together into a single bytecode
-#   module.
-#---------------------------------------------------------
-
-ifdef MODULE_NAME
-ifeq ($(strip $(LLVMCC)),)
-$(warning Modules require LLVM capable compiler but none is available ****)
-else
-
-Module     := $(LibDir)/$(MODULE_NAME).bc
-LinkModule := $(LLVMLD) -r
-
-
-ifdef EXPORTED_SYMBOL_FILE
-LinkModule += -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
-endif
-
-$(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(LLVMLD)
-       $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
-       $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
-
-all-local:: $(Module)
-
-clean-local::
-ifneq ($(strip $(Module)),)
-       -$(Verb) $(RM) -f $(Module)
-endif
-
-ifdef BYTECODE_DESTINATION
-ModuleDestDir := $(BYTECODE_DESTINATION)
-else
-ModuleDestDir := $(DESTDIR)$(PROJ_libdir)
-endif
-
-ifdef NO_INSTALL
-install-local::
-       $(Echo) Install circumvented with NO_INSTALL
-uninstall-local::
-       $(Echo) Uninstall circumvented with NO_INSTALL
-else
-DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
-
-install-module:: $(DestModule)
-install-local:: $(DestModule)
-
-$(DestModule): $(ModuleDestDir) $(Module)
-       $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
-       $(Verb) $(DataInstall) $(Module) $(DestModule)
-
-uninstall-local::
-       $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
-       -$(Verb) $(RM) -f $(DestModule)
-endif
-
-endif
-endif
-
 # if we're building a library ...
 ifdef LIBRARYNAME
 
@@ -1118,7 +1045,6 @@ endif
 LibName.A  := $(LibDir)/$(BaseLibName.A)
 LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
 LibName.O  := $(LibDir)/$(LIBRARYNAME).o
-LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
 
 #---------------------------------------------------------
 # Shared Library Targets:
@@ -1184,72 +1110,6 @@ uninstall-local::
 endif
 endif
 
-#---------------------------------------------------------
-# Bytecode Library Targets:
-#   If the user asked for a bytecode library to be built
-#   with the BYTECODE_LIBRARY variable, then we provide
-#   targets for building them.
-#---------------------------------------------------------
-ifdef BYTECODE_LIBRARY
-ifeq ($(strip $(LLVMCC)),)
-$(warning Bytecode libraries require LLVM capable compiler but none is available ****)
-else
-
-all-local:: $(LibName.BCA)
-
-ifdef EXPORTED_SYMBOL_FILE
-BCLinkLib = $(LLVMLD) -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
-
-$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLD) \
-                $(LLVMToolDir)/llvm-ar
-       $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
-         "(internalize)"
-       $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).internalize $(ObjectsBC)
-       $(Verb) $(RM) -f $@
-       $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).internalize.bc
-else
-$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
-                $(LLVMToolDir)/llvm-ar
-       $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
-       $(Verb) $(RM) -f $@
-       $(Verb) $(LArchive) $@ $(ObjectsBC)
-
-endif
-
-clean-local::
-ifneq ($(strip $(LibName.BCA)),)
-       -$(Verb) $(RM) -f $(LibName.BCA)
-endif
-
-ifdef BYTECODE_DESTINATION
-BytecodeDestDir := $(BYTECODE_DESTINATION)
-else
-BytecodeDestDir := $(DESTDIR)$(PROJ_libdir)
-endif
-
-DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).bca
-
-install-bytecode-local:: $(DestBytecodeLib)
-
-ifdef NO_INSTALL
-install-local::
-       $(Echo) Install circumvented with NO_INSTALL
-uninstall-local::
-       $(Echo) Uninstall circumvented with NO_INSTALL
-else
-install-local:: $(DestBytecodeLib)
-
-$(DestBytecodeLib): $(LibName.BCA) $(BytecodeDestDir)
-       $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
-       $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
-
-uninstall-local::
-       $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
-       -$(Verb) $(RM) -f $(DestBytecodeLib)
-endif
-endif
-endif
-
 #---------------------------------------------------------
 # Library Targets:
 #   If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
@@ -1355,7 +1215,7 @@ LD.Flags += -Wl,-exported_symbol,_main
 endif
 endif
 
-ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD))
+ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU/kFreeBSD))
 ifneq ($(ARCH), Mips)
   LD.Flags += -Wl,--version-script=$(PROJ_SRC_ROOT)/autoconf/ExportMap.map
 endif
@@ -1517,48 +1377,6 @@ $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
        $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
                $(DEPEND_MOVEFILE)
 
-#---------------------------------------------------------
-# Create .bc files in the ObjDir directory from .cpp .cc and .c files...
-#---------------------------------------------------------
-
-BC_DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.bc.d.tmp" \
-       -MT "$(ObjDir)/$*.ll" -MT "$(ObjDir)/$*.bc.d"
-
-# If the build succeeded, move the dependency file over, otherwise
-# remove it.
-BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d"; \
-                     else $(RM) "$(ObjDir)/$*.bc.d.tmp"; exit 1; fi
-
-$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
-       $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
-       $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
-                       $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
-               $(BC_DEPEND_MOVEFILE)
-
-$(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
-       $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
-       $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
-                       $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
-               $(BC_DEPEND_MOVEFILE)
-
-$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
-       $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
-       $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
-                       $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
-               $(BC_DEPEND_MOVEFILE)
-
-$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
-       $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
-       $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
-                       $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
-               $(BC_DEPEND_MOVEFILE)
-
-$(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
-       $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
-       $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
-                       $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
-               $(BC_DEPEND_MOVEFILE)
-
 # Provide alternate rule sets if dependencies are disabled
 else
 
@@ -1581,27 +1399,6 @@ $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
        $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
        $(Compile.C) $< -o $@
-
-$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
-       $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
-       $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
-
-$(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
-       $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
-       $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
-
-$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
-       $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
-       $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
-
-$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
-       $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
-       $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
-
-$(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
-       $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
-       $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
-
 endif
 
 
@@ -1647,27 +1444,6 @@ $(ObjDir)/%.s: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
        $(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG)
        $(Compile.C) $< -o $@ -S
 
-
-# make the C and C++ compilers strip debug info out of bytecode libraries.
-ifdef DEBUG_RUNTIME
-$(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
-       $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
-       $(Verb) $(LOPT) $< -std-compile-opts -o $@
-else
-$(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
-       $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
-       $(Verb) $(LOPT) $< -std-compile-opts -strip-debug -o $@
-endif
-
-
-#---------------------------------------------------------
-# Provide rule to build .bc files from .ll sources,
-# regardless of dependencies
-#---------------------------------------------------------
-$(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
-       $(Echo) "Compiling $*.ll for $(BuildMode) build"
-       $(Verb) $(LLVMAS) $< -f -o $@
-
 ###############################################################################
 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
 ###############################################################################
@@ -1838,11 +1614,6 @@ ifndef IS_CLEANING_TARGET
 DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources)))
 DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
 
-# Include bitcode dependency files if using bitcode libraries
-ifdef BYTECODE_LIBRARY
-DependFiles += $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.bc.d)
-endif
-
 -include $(DependFiles) ""
 
 endif