Home | History | Annotate | Download | only in llvm
      1 #===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===#
      2 #
      3 #                     The LLVM Compiler Infrastructure
      4 #
      5 # This file is distributed under the University of Illinois Open Source
      6 # License. See LICENSE.TXT for details.
      7 #
      8 #===------------------------------------------------------------------------===#
      9 #
     10 # This file is included by all of the LLVM makefiles.  For details on how to use
     11 # it properly, please see the document MakefileGuide.html in the docs directory.
     12 #
     13 #===-----------------------------------------------------------------------====#
     14 
     15 ################################################################################
     16 # TARGETS: Define standard targets that can be invoked
     17 ################################################################################
     18 
     19 #--------------------------------------------------------------------
     20 # Define the various target sets
     21 #--------------------------------------------------------------------
     22 RecursiveTargets := all clean clean-all install uninstall install-bytecode \
     23                     unitcheck
     24 LocalTargets     := all-local clean-local clean-all-local check-local \
     25                     install-local printvars uninstall-local \
     26 		    install-bytecode-local
     27 TopLevelTargets  := check dist dist-check dist-clean dist-gzip dist-bzip2 \
     28                     dist-zip unittests
     29 UserTargets      := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
     30 InternalTargets  := preconditions distdir dist-hook
     31 
     32 ################################################################################
     33 # INITIALIZATION: Basic things the makefile needs
     34 ################################################################################
     35 
     36 #--------------------------------------------------------------------
     37 # Set the VPATH so that we can find source files.
     38 #--------------------------------------------------------------------
     39 VPATH=$(PROJ_SRC_DIR)
     40 
     41 #--------------------------------------------------------------------
     42 # Reset the list of suffixes we know how to build.
     43 #--------------------------------------------------------------------
     44 .SUFFIXES:
     45 .SUFFIXES: .c .cpp .cc .h .hpp .o .a .bc .td .ps .dot .ll .m .mm
     46 .SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
     47 
     48 #--------------------------------------------------------------------
     49 # Mark all of these targets as phony to avoid implicit rule search
     50 #--------------------------------------------------------------------
     51 .PHONY: $(UserTargets) $(InternalTargets)
     52 
     53 #--------------------------------------------------------------------
     54 # Make sure all the user-target rules are double colon rules and
     55 # they are defined first.
     56 #--------------------------------------------------------------------
     57 
     58 $(UserTargets)::
     59 
     60 #------------------------------------------------------------------------
     61 # LLVMBuild Integration
     62 #------------------------------------------------------------------------
     63 #
     64 # We use llvm-build to generate all the data required by the Makefile based
     65 # build system in one swoop:
     66 #
     67 #  - We generate a file (a Makefile fragment) in the object root which contains
     68 #    all the definitions that are required by Makefiles across the entire
     69 #    project.
     70 #
     71 #  - We generate the library table used by llvm-config.
     72 #
     73 #  - We generate the dependencies for the Makefile fragment, so that we will
     74 #    automatically reconfigure outselves.
     75 
     76 # The path to the llvm-build tool itself.
     77 LLVMBuildTool	:= $(PROJ_SRC_ROOT)/utils/llvm-build/llvm-build
     78 
     79 # The files we are going to generate using llvm-build.
     80 LLVMBuildMakeFrag := $(PROJ_OBJ_ROOT)/Makefile.llvmbuild
     81 LLVMConfigLibraryDependenciesInc := \
     82 	$(PROJ_OBJ_ROOT)/tools/llvm-config/LibraryDependencies.inc
     83 
     84 # This is for temporary backwards compatibility.
     85 ifndef TARGET_NATIVE_ARCH
     86 TARGET_NATIVE_ARCH := $(ARCH)
     87 endif
     88 
     89 # The rule to create the LLVMBuild Makefile fragment as well as the llvm-config
     90 # library table.
     91 #
     92 # Note that this target gets its real dependencies generated for us by
     93 # llvm-build.
     94 #
     95 # We include a dependency on this Makefile to ensure that changes to the
     96 # generation command get picked up.
     97 $(LLVMBuildMakeFrag): $(PROJ_SRC_ROOT)/Makefile.rules \
     98 		      $(PROJ_OBJ_ROOT)/Makefile.config
     99 	$(Echo) Constructing LLVMBuild project information.
    100 	$(Verb)$(PYTHON) $(LLVMBuildTool) \
    101 	  --native-target "$(TARGET_NATIVE_ARCH)" \
    102 	  --enable-targets "$(TARGETS_TO_BUILD)" \
    103 	  --enable-optional-components "$(OPTIONAL_COMPONENTS)" \
    104 	  --write-library-table $(LLVMConfigLibraryDependenciesInc) \
    105 	  --write-make-fragment $(LLVMBuildMakeFrag)
    106 
    107 # For completeness, let Make know how the extra files are generated.
    108 $(LLVMConfigLibraryDependenciesInc): $(LLVMBuildMakeFrag)
    109 
    110 # Include the generated Makefile fragment.
    111 #
    112 # We currently only include the dependencies for the fragment itself if we are
    113 # at the top-level. Otherwise, recursive invocations would ends up doing
    114 # substantially more redundant stat'ing.
    115 #
    116 # This means that we won't properly regenerate things for developers used to
    117 # building from a subdirectory, but that is always somewhat unreliable.
    118 ifeq ($(LEVEL),.)
    119 LLVMBUILD_INCLUDE_DEPENDENCIES := 1
    120 
    121 # Clean the generated makefile fragment at the top-level.
    122 clean-local::
    123 	-$(Verb) $(RM) -f $(LLVMBuildMakeFrag)
    124 endif
    125 -include $(LLVMBuildMakeFrag)
    126 
    127 ################################################################################
    128 # PRECONDITIONS: that which must be built/checked first
    129 ################################################################################
    130 
    131 SrcMakefiles       := $(filter %Makefile %Makefile.tests,\
    132                       $(wildcard $(PROJ_SRC_DIR)/Makefile*))
    133 ObjMakefiles       := $(subst $(PROJ_SRC_DIR),$(PROJ_OBJ_DIR),$(SrcMakefiles))
    134 ConfigureScript    := $(PROJ_SRC_ROOT)/configure
    135 ConfigStatusScript := $(PROJ_OBJ_ROOT)/config.status
    136 MakefileConfigIn   := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.config.in))
    137 MakefileCommonIn   := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.common.in))
    138 MakefileConfig     := $(PROJ_OBJ_ROOT)/Makefile.config
    139 MakefileCommon     := $(PROJ_OBJ_ROOT)/Makefile.common
    140 PreConditions      := $(ConfigStatusScript) $(ObjMakefiles)
    141 ifneq ($(MakefileCommonIn),)
    142 PreConditions      += $(MakefileCommon)
    143 endif
    144 
    145 ifneq ($(MakefileConfigIn),)
    146 PreConditions      += $(MakefileConfig)
    147 endif
    148 
    149 preconditions: $(PreConditions)
    150 
    151 #------------------------------------------------------------------------
    152 # Make sure the BUILT_SOURCES are built first
    153 #------------------------------------------------------------------------
    154 $(filter-out clean clean-local,$(UserTargets)):: $(BUILT_SOURCES)
    155 
    156 clean-all-local::
    157 ifneq ($(strip $(BUILT_SOURCES)),)
    158 	-$(Verb) $(RM) -f $(BUILT_SOURCES)
    159 endif
    160 
    161 ifneq ($(PROJ_OBJ_ROOT),$(PROJ_SRC_ROOT))
    162 spotless:
    163 	$(Verb) if test -x config.status ; then \
    164 	  $(EchoCmd) Wiping out $(PROJ_OBJ_ROOT) ; \
    165 	  $(MKDIR) .spotless.save ; \
    166 	  $(MV) config.status .spotless.save ; \
    167 	  $(MV) mklib  .spotless.save ; \
    168 	  $(MV) projects  .spotless.save ; \
    169 	  $(RM) -rf * ; \
    170 	  $(MV) .spotless.save/config.status . ; \
    171 	  $(MV) .spotless.save/mklib . ; \
    172 	  $(MV) .spotless.save/projects . ; \
    173 	  $(RM) -rf .spotless.save ; \
    174 	  $(EchoCmd) Rebuilding configuration of $(PROJ_OBJ_ROOT) ; \
    175 	  $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
    176 	  $(ConfigStatusScript) ; \
    177 	else \
    178 	  $(EchoCmd) "make spotless" can only be run from $(PROJ_OBJ_ROOT); \
    179 	fi
    180 else
    181 spotless:
    182 	$(EchoCmd) "spotless target not supported for objdir == srcdir"
    183 endif
    184 
    185 $(BUILT_SOURCES) : $(ObjMakefiles)
    186 
    187 #------------------------------------------------------------------------
    188 # Make sure we're not using a stale configuration
    189 #------------------------------------------------------------------------
    190 reconfigure:
    191 	$(Echo) Reconfiguring $(PROJ_OBJ_ROOT)
    192 	$(Verb) cd $(PROJ_OBJ_ROOT) && \
    193 	  $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
    194 	  $(ConfigStatusScript)
    195 
    196 .PRECIOUS: $(ConfigStatusScript)
    197 $(ConfigStatusScript): $(ConfigureScript)
    198 	$(Echo) Reconfiguring with $<
    199 	$(Verb) cd $(PROJ_OBJ_ROOT) && \
    200 	  $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
    201 	  $(ConfigStatusScript)
    202 
    203 #------------------------------------------------------------------------
    204 # Make sure the configuration makefile is up to date
    205 #------------------------------------------------------------------------
    206 ifneq ($(MakefileConfigIn),)
    207 $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
    208 	$(Echo) Regenerating $@
    209 	$(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
    210 endif
    211 
    212 ifneq ($(MakefileCommonIn),)
    213 $(MakefileCommon): $(MakefileCommonIn) $(ConfigStatusScript)
    214 	$(Echo) Regenerating $@
    215 	$(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.common
    216 endif
    217 
    218 #------------------------------------------------------------------------
    219 # If the Makefile in the source tree has been updated, copy it over into the
    220 # build tree. But, only do this if the source and object makefiles differ
    221 #------------------------------------------------------------------------
    222 ifndef PROJ_MAKEFILE
    223 PROJ_MAKEFILE := $(PROJ_SRC_DIR)/Makefile
    224 endif
    225 
    226 ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
    227 
    228 Makefile: $(PROJ_MAKEFILE) $(ExtraMakefiles)
    229 	$(Echo) "Updating Makefile"
    230 	$(Verb) $(MKDIR) $(@D)
    231 	$(Verb) $(CP) -f $< $@
    232 
    233 # Copy the Makefile.* files unless we're in the root directory which avoids
    234 # the copying of Makefile.config.in or other things that should be explicitly
    235 # taken care of.
    236 $(PROJ_OBJ_DIR)/Makefile% : $(PROJ_MAKEFILE)%
    237 	@case '$?' in \
    238           *Makefile.rules) ;; \
    239           *.in) ;; \
    240           *) $(EchoCmd) "Updating $(@F)" ; \
    241 	     $(MKDIR) $(@D) ; \
    242 	     $(CP) -f $< $@ ;; \
    243 	esac
    244 
    245 endif
    246 
    247 #------------------------------------------------------------------------
    248 # Set up the basic dependencies
    249 #------------------------------------------------------------------------
    250 $(UserTargets):: $(PreConditions)
    251 
    252 all:: all-local
    253 clean:: clean-local
    254 clean-all:: clean-local clean-all-local
    255 install:: install-local
    256 uninstall:: uninstall-local
    257 install-local:: all-local
    258 install-bytecode:: install-bytecode-local
    259 
    260 ###############################################################################
    261 # VARIABLES: Set up various variables based on configuration data
    262 ###############################################################################
    263 
    264 # Variable for if this make is for a "cleaning" target
    265 ifneq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),)
    266   IS_CLEANING_TARGET=1
    267 endif
    268 
    269 #--------------------------------------------------------------------
    270 # Variables derived from configuration we are building
    271 #--------------------------------------------------------------------
    272 
    273 CPP.Defines :=
    274 ifeq ($(ENABLE_OPTIMIZED),1)
    275   BuildMode := Release
    276   # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
    277   ifneq ($(HOST_OS),FreeBSD)
    278   ifneq ($(HOST_OS),Darwin)
    279     OmitFramePointer := -fomit-frame-pointer
    280   endif
    281   endif
    282 
    283   CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
    284   C.Flags   += $(OPTIMIZE_OPTION) $(OmitFramePointer)
    285   LD.Flags  += $(OPTIMIZE_OPTION)
    286   ifdef DEBUG_SYMBOLS
    287     BuildMode := $(BuildMode)+Debug
    288     CXX.Flags += -g
    289     C.Flags   += -g
    290     LD.Flags  += -g
    291     KEEP_SYMBOLS := 1
    292   endif
    293 else
    294   ifdef NO_DEBUG_SYMBOLS
    295     BuildMode := Unoptimized
    296     CXX.Flags +=
    297     C.Flags   +=
    298     LD.Flags  +=
    299     KEEP_SYMBOLS := 1
    300   else
    301     BuildMode := Debug
    302     CXX.Flags += -g
    303     C.Flags   += -g
    304     LD.Flags  += -g
    305     KEEP_SYMBOLS := 1
    306   endif
    307 endif
    308 
    309 ifeq ($(ENABLE_LIBCPP),1)
    310   CXX.Flags +=  -stdlib=libc++
    311   LD.Flags +=  -stdlib=libc++
    312 endif
    313 
    314 ifeq ($(ENABLE_CXX11),1)
    315   CXX.Flags += -std=c++11
    316 endif
    317 
    318 ifeq ($(ENABLE_WERROR),1)
    319   CXX.Flags += -Werror
    320   C.Flags += -Werror
    321 endif
    322 
    323 ifeq ($(ENABLE_PROFILING),1)
    324   BuildMode := $(BuildMode)+Profile
    325   CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
    326   C.Flags   := $(filter-out -fomit-frame-pointer,$(C.Flags)) -pg -g
    327   LD.Flags  := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg -g
    328   KEEP_SYMBOLS := 1
    329 endif
    330 
    331 ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
    332     CXX.Flags += -fvisibility-inlines-hidden
    333 endif
    334 
    335 ifdef ENABLE_EXPENSIVE_CHECKS
    336   # GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above.
    337   # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40160
    338   REQUIRES_RTTI := 1
    339 endif
    340 
    341 # IF REQUIRES_EH=1 is specified then don't disable exceptions
    342 ifndef REQUIRES_EH
    343   CXX.Flags += -fno-exceptions
    344 else
    345   # If the library requires EH, it also requires RTTI.
    346   REQUIRES_RTTI := 1
    347 endif
    348 
    349 ifdef REQUIRES_FRAME_POINTER
    350   CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags))
    351   C.Flags   := $(filter-out -fomit-frame-pointer,$(C.Flags))
    352   LD.Flags  := $(filter-out -fomit-frame-pointer,$(LD.Flags))
    353 endif
    354 
    355 # If REQUIRES_RTTI=1 is specified then don't disable run-time type id.
    356 ifneq ($(REQUIRES_RTTI), 1)
    357   CXX.Flags += -fno-rtti
    358 endif
    359 
    360 ifeq ($(ENABLE_COVERAGE),1)
    361   BuildMode := $(BuildMode)+Coverage
    362   CXX.Flags += -ftest-coverage -fprofile-arcs
    363   C.Flags   += -ftest-coverage -fprofile-arcs
    364 endif
    365 
    366 # If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
    367 # then disable assertions by defining the appropriate preprocessor symbols.
    368 ifeq ($(DISABLE_ASSERTIONS),1)
    369   CPP.Defines += -DNDEBUG
    370 else
    371   BuildMode := $(BuildMode)+Asserts
    372   CPP.Defines += -D_DEBUG
    373 endif
    374 
    375 # If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
    376 # configured), then enable expensive checks by defining the
    377 # appropriate preprocessor symbols.
    378 ifeq ($(ENABLE_EXPENSIVE_CHECKS),1)
    379   BuildMode := $(BuildMode)+Checks
    380   CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
    381 endif
    382 
    383 # LOADABLE_MODULE implies several other things so we force them to be
    384 # defined/on.
    385 ifdef LOADABLE_MODULE
    386   SHARED_LIBRARY := 1
    387   LINK_LIBS_IN_SHARED := 1
    388 endif
    389 
    390 ifdef SHARED_LIBRARY
    391   ENABLE_PIC := 1
    392   PIC_FLAG = "(PIC)"
    393 endif
    394 
    395 ifeq ($(ENABLE_PIC),1)
    396   ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
    397     # Nothing. Win32 defaults to PIC and warns when given -fPIC
    398   else
    399     ifeq ($(HOST_OS),Darwin)
    400       # Common symbols not allowed in dylib files
    401       CXX.Flags += -fno-common
    402       C.Flags   += -fno-common
    403     else
    404       # Linux and others; pass -fPIC
    405       CXX.Flags += -fPIC
    406       C.Flags   += -fPIC
    407     endif
    408   endif
    409 else
    410   ifeq ($(HOST_OS),Darwin)
    411       CXX.Flags += -mdynamic-no-pic
    412       C.Flags   += -mdynamic-no-pic
    413   endif
    414 endif
    415 
    416 # Support makefile variable to disable any kind of timestamp/non-deterministic
    417 # info from being used in the build.
    418 ifeq ($(ENABLE_TIMESTAMPS),1)
    419   DOTDIR_TIMESTAMP_COMMAND := $(DATE)
    420 else
    421   DOTDIR_TIMESTAMP_COMMAND := echo 'Created.'
    422 endif
    423 
    424 ifeq ($(HOST_OS),MingW)
    425   # Work around PR4957
    426   CPP.Defines += -D__NO_CTYPE_INLINE
    427   ifeq ($(LLVM_CROSS_COMPILING),1)
    428     # Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016
    429     ifdef TOOLNAME
    430       LD.Flags += -Wl,--allow-multiple-definition
    431     endif
    432   endif
    433 endif
    434 
    435 CXX.Flags     += -Woverloaded-virtual
    436 CPP.BaseFlags += $(CPP.Defines)
    437 AR.Flags      := cru
    438 
    439 # Make Floating point IEEE compliant on Alpha.
    440 ifeq ($(ARCH),Alpha)
    441   CXX.Flags     += -mieee
    442   CPP.BaseFlags += -mieee
    443 ifeq ($(ENABLE_PIC),0)
    444   CXX.Flags     += -fPIC
    445   CPP.BaseFlags += -fPIC
    446 endif
    447 
    448   LD.Flags += -Wl,--no-relax
    449 endif
    450 
    451 # GNU ld/PECOFF accepts but ignores them below;
    452 #   --version-script
    453 #   --export-dynamic
    454 #   --rpath
    455 # FIXME: autoconf should be aware of them.
    456 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
    457   HAVE_LINK_VERSION_SCRIPT := 0
    458   RPATH :=
    459   RDYNAMIC := -Wl,--export-all-symbols
    460 endif
    461 
    462 #--------------------------------------------------------------------
    463 # Directory locations
    464 #--------------------------------------------------------------------
    465 TargetMode :=
    466 ifeq ($(LLVM_CROSS_COMPILING),1)
    467   BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin
    468 endif
    469 
    470 ObjRootDir  := $(PROJ_OBJ_DIR)/$(BuildMode)
    471 ObjDir      := $(ObjRootDir)
    472 LibDir      := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
    473 ToolDir     := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
    474 ExmplDir    := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
    475 LLVMLibDir  := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
    476 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
    477 LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
    478 
    479 #--------------------------------------------------------------------
    480 # Locations of shared libraries
    481 #--------------------------------------------------------------------
    482 
    483 SharedPrefix     := lib
    484 SharedLibDir     := $(LibDir)
    485 LLVMSharedLibDir := $(LLVMLibDir)
    486 
    487 # Win32.DLL prefers to be located on the "PATH" of binaries.
    488 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
    489   SharedLibDir     := $(ToolDir)
    490   LLVMSharedLibDir := $(LLVMToolDir)
    491 
    492   ifeq ($(HOST_OS),Cygwin)
    493     SharedPrefix  := cyg
    494   else
    495     SharedPrefix  :=
    496   endif
    497 endif
    498 
    499 #--------------------------------------------------------------------
    500 # LLVM Capable Compiler
    501 #--------------------------------------------------------------------
    502 
    503 ifneq ($(findstring llvm-gcc,$(LLVMCC_OPTION)),)
    504   LLVMCC := $(LLVMGCC)
    505   LLVMCXX := $(LLVMGXX)
    506 else
    507   ifneq ($(findstring clang,$(LLVMCC_OPTION)),)
    508     ifneq ($(CLANGPATH),)
    509       LLVMCC := $(CLANGPATH)
    510       LLVMCXX := $(CLANGXXPATH)
    511     else
    512       ifeq ($(ENABLE_BUILT_CLANG),1)
    513         LLVMCC := $(LLVMToolDir)/clang
    514         LLVMCXX := $(LLVMToolDir)/clang++
    515       endif
    516     endif
    517   endif
    518 endif
    519 
    520 #--------------------------------------------------------------------
    521 # Full Paths To Compiled Tools and Utilities
    522 #--------------------------------------------------------------------
    523 EchoCmd  := $(ECHO) llvm[$(MAKELEVEL)]:
    524 ifdef BUILD_DIRS_ONLY
    525 EchoCmd  := $(EchoCmd) "(build tools)":
    526 endif
    527 
    528 Echo     := @$(EchoCmd)
    529 ifndef LLVMAS
    530 LLVMAS   := $(LLVMToolDir)/llvm-as$(EXEEXT)
    531 endif
    532 ifndef LLVM_TBLGEN
    533   ifeq ($(LLVM_CROSS_COMPILING),1)
    534     LLVM_TBLGEN   := $(BuildLLVMToolDir)/llvm-tblgen$(BUILD_EXEEXT)
    535   else
    536     LLVM_TBLGEN   := $(LLVMToolDir)/llvm-tblgen$(EXEEXT)
    537   endif
    538 endif
    539 ifeq ($(LLVM_CROSS_COMPILING),1)
    540   LLVM_CONFIG := $(BuildLLVMToolDir)/llvm-config$(BUILD_EXEEXT)
    541 else
    542   LLVM_CONFIG := $(LLVMToolDir)/llvm-config$(EXEEXT)
    543 endif
    544 ifndef LLVMDIS
    545 LLVMDIS  := $(LLVMToolDir)/llvm-dis$(EXEEXT)
    546 endif
    547 ifndef LLI
    548 LLI      := $(LLVMToolDir)/lli$(EXEEXT)
    549 endif
    550 ifndef LLC
    551 LLC      := $(LLVMToolDir)/llc$(EXEEXT)
    552 endif
    553 ifndef LOPT
    554 LOPT     := $(LLVMToolDir)/opt$(EXEEXT)
    555 endif
    556 ifndef LBUGPOINT
    557 LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
    558 endif
    559 ifndef LLVMLINK
    560 LLVMLINK      := $(LLVMToolDir)/llvm-link$(EXEEXT)
    561 endif
    562 
    563 #--------------------------------------------------------------------
    564 # Adjust to user's request
    565 #--------------------------------------------------------------------
    566 
    567 ifeq ($(HOST_OS),Darwin)
    568  ifdef MACOSX_DEPLOYMENT_TARGET
    569   DARWIN_VERSION := $(MACOSX_DEPLOYMENT_TARGET)
    570  else
    571   DARWIN_VERSION := `sw_vers -productVersion`
    572  endif
    573   # Strip a number like 10.4.7 to 10.4
    574   DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/')
    575   # Get "4" out of 10.4 for later pieces in the makefile.
    576   DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
    577 
    578   LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress
    579   SharedLinkOptions := -dynamiclib
    580   ifdef DEPLOYMENT_TARGET
    581     SharedLinkOptions += $(DEPLOYMENT_TARGET)
    582   else
    583     ifneq ($(ARCH),ARM)
    584       SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
    585     endif
    586   endif
    587 else
    588   SharedLinkOptions=-shared
    589 endif
    590 
    591 ifeq ($(TARGET_OS),Darwin)
    592   ifdef DEPLOYMENT_TARGET
    593     TargetCommonOpts += $(DEPLOYMENT_TARGET)
    594   else
    595     ifneq ($(ARCH),ARM)
    596       TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
    597     endif
    598   endif
    599 endif
    600 
    601 ifdef SHARED_LIBRARY
    602 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
    603 ifneq ($(HOST_OS),Darwin)
    604   LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
    605 endif
    606 endif
    607 endif
    608 
    609 ifdef TOOL_VERBOSE
    610   C.Flags += -v
    611   CXX.Flags += -v
    612   LD.Flags += -v
    613   VERBOSE := 1
    614 endif
    615 
    616 # Adjust settings for verbose mode
    617 ifndef VERBOSE
    618   Verb := @
    619   AR.Flags += >/dev/null 2>/dev/null
    620   ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
    621 else
    622   ConfigureScriptFLAGS :=
    623 endif
    624 
    625 # By default, strip symbol information from executable
    626 ifndef KEEP_SYMBOLS
    627   Strip := $(PLATFORMSTRIPOPTS)
    628   StripWarnMsg := "(without symbols)"
    629   Install.StripFlag += -s
    630 endif
    631 
    632 ifdef TOOL_NO_EXPORTS
    633   DynamicFlags :=
    634 else
    635   DynamicFlag := $(RDYNAMIC)
    636 endif
    637 
    638 # Adjust linker flags for building an executable
    639 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
    640   ifneq ($(HOST_OS), Darwin)
    641     ifdef TOOLNAME
    642       LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
    643       ifdef EXAMPLE_TOOL
    644         LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
    645       else
    646         LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
    647     endif
    648   endif
    649 else
    650   ifneq ($(DARWIN_MAJVERS),4)
    651     LD.Flags += $(RPATH) -Wl,@executable_path/../lib
    652   endif
    653   ifeq ($(RC_XBS),YES)
    654     TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX)
    655     LD.Flags += -Wl,-object_path_lto -Wl,$(TempFile)
    656   endif
    657 endif
    658 endif
    659 
    660 
    661 #----------------------------------------------------------
    662 # Options To Invoke Tools
    663 #----------------------------------------------------------
    664 
    665 ifdef EXTRA_LD_OPTIONS
    666 LD.Flags += $(EXTRA_LD_OPTIONS)
    667 endif
    668 
    669 ifndef NO_PEDANTIC
    670 CompileCommonOpts += -pedantic -Wno-long-long
    671 endif
    672 CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
    673                      $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT) \
    674                      $(NO_UNINITIALIZED) $(NO_MAYBE_UNINITIALIZED) \
    675                      $(NO_MISSING_FIELD_INITIALIZERS)
    676 # Enable cast-qual for C++; the workaround is to use const_cast.
    677 CXX.Flags += -Wcast-qual
    678 
    679 ifeq ($(HOST_OS),HP-UX)
    680   CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
    681 endif
    682 
    683 # If we are building a universal binary on Mac OS/X, pass extra options.  This
    684 # is useful to people that want to link the LLVM libraries into their universal
    685 # apps.
    686 #
    687 # The following can be optionally specified:
    688 #   UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
    689 #      For Mac OS/X 10.4 Intel machines, the traditional one is:
    690 #      UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
    691 #   UNIVERSAL_ARCH can be optionally specified to be a list of architectures
    692 #      to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64".  This defaults to
    693 #      i386/ppc only.
    694 ifdef UNIVERSAL
    695   ifndef UNIVERSAL_ARCH
    696     UNIVERSAL_ARCH := i386 ppc
    697   endif
    698   UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
    699   CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
    700   ifdef UNIVERSAL_SDK_PATH
    701     CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
    702   endif
    703 
    704   # Building universal cannot compute dependencies automatically.
    705   DISABLE_AUTO_DEPENDENCIES=1
    706 else
    707   ifeq ($(TARGET_OS),Darwin)
    708     ifeq ($(ARCH),x86_64)
    709       TargetCommonOpts = -m64
    710     else
    711       ifeq ($(ARCH),x86)
    712         TargetCommonOpts = -m32
    713       endif
    714     endif
    715   endif
    716 endif
    717 
    718 ifeq ($(HOST_OS),SunOS)
    719 CPP.BaseFlags += -include llvm/Support/Solaris.h
    720 endif
    721 
    722 ifeq ($(HOST_OS),AuroraUX)
    723 CPP.BaseFlags += -include llvm/Support/Solaris.h
    724 endif # !HOST_OS - AuroraUX.
    725 
    726 # On Windows, SharedLibDir != LibDir. The order is important.
    727 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
    728   LD.Flags    += -L$(SharedLibDir) -L$(LibDir) -L$(LLVMToolDir) -L$(LLVMLibDir)
    729 else
    730   LD.Flags    += -L$(LibDir) -L$(LLVMLibDir)
    731 endif
    732 
    733 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
    734 # All -I flags should go here, so that they don't confuse llvm-config.
    735 CPP.Flags     += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
    736 	         $(patsubst %,-I%/include,\
    737 	         $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
    738 	         $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
    739 	         $(CPP.BaseFlags)
    740 
    741 ifeq ($(INCLUDE_BUILD_DIR),1)
    742   CPP.Flags   += -I$(ObjDir)
    743 endif
    744 
    745 # SHOW_DIAGNOSTICS support.
    746 ifeq ($(SHOW_DIAGNOSTICS),1)
    747   Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
    748 	                  CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
    749 else
    750   Compile.Wrapper :=
    751 endif
    752 
    753 Compile.C     = $(Compile.Wrapper) \
    754 	          $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
    755                 $(TargetCommonOpts) $(CompileCommonOpts) -c
    756 Compile.CXX   = $(Compile.Wrapper) \
    757 	          $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
    758                 $(TargetCommonOpts) $(CompileCommonOpts) -c
    759 Preprocess.CXX= $(Compile.Wrapper) \
    760 	          $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
    761                 $(CompileCommonOpts) $(CXX.Flags) -E
    762 Link          = $(Compile.Wrapper) \
    763 	          $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
    764                 $(LDFLAGS) $(TargetCommonOpts)  $(CompileCommonOpts) $(Strip)
    765 
    766 BCCompile.C   = $(LLVMCC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
    767                 $(TargetCommonOpts) $(CompileCommonOpts)
    768 Preprocess.C  = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
    769                 $(TargetCommonOpts) $(CompileCommonOpts) -E
    770 
    771 BCCompile.CXX = $(LLVMCXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
    772                 $(TargetCommonOpts) $(CompileCommonOpts)
    773 
    774 ProgInstall   = $(INSTALL) $(Install.StripFlag) -m 0755
    775 ScriptInstall = $(INSTALL) -m 0755
    776 DataInstall   = $(INSTALL) -m 0644
    777 
    778 # When compiling under Mingw/Cygwin, the tblgen tool expects Windows
    779 # paths. In this case, the SYSPATH function (defined in
    780 # Makefile.config) transforms Unix paths into Windows paths.
    781 TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
    782                 -I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
    783                 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
    784                 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
    785 LLVMTableGen  = $(LLVM_TBLGEN) $(TableGen.Flags)
    786 
    787 Archive       = $(AR) $(AR.Flags)
    788 LArchive      = $(LLVMToolDir)/llvm-ar rcsf
    789 ifdef RANLIB
    790 Ranlib        = $(RANLIB)
    791 else
    792 Ranlib        = ranlib
    793 endif
    794 
    795 AliasTool     = ln -s
    796 
    797 #----------------------------------------------------------
    798 # Get the list of source files and compute object file
    799 # names from them.
    800 #----------------------------------------------------------
    801 
    802 ifndef SOURCES
    803   Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
    804              $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
    805 else
    806   Sources := $(SOURCES)
    807 endif
    808 
    809 ifdef BUILT_SOURCES
    810 Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
    811 endif
    812 
    813 BaseNameSources := $(sort $(basename $(Sources)))
    814 
    815 ObjectsO  := $(BaseNameSources:%=$(ObjDir)/%.o)
    816 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
    817 
    818 #----------------------------------------------------------
    819 # For Mingw MSYS bash and Python/w32:
    820 #
    821 # $(ECHOPATH) prints DOSish pathstring.
    822 #   ex) $(ECHOPATH) /include/sys/types.h
    823 #   --> C:/mingw/include/sys/types.h
    824 # built-in "echo" does not transform path to DOSish path.
    825 #
    826 # FIXME: It would not be needed when MSYS's python
    827 # were provided.
    828 #----------------------------------------------------------
    829 
    830 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
    831   ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])"
    832 else
    833   ECHOPATH := $(Verb)$(ECHO)
    834 endif
    835 
    836 ###############################################################################
    837 # DIRECTORIES: Handle recursive descent of directory structure
    838 ###############################################################################
    839 
    840 #---------------------------------------------------------
    841 # Provide rules to make install dirs. This must be early
    842 # in the file so they get built before dependencies
    843 #---------------------------------------------------------
    844 
    845 $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
    846 	$(Verb) $(MKDIR) $@
    847 
    848 # To create other directories, as needed, and timestamp their creation
    849 %/.dir:
    850 	$(Verb) $(MKDIR) $* > /dev/null
    851 	$(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
    852 
    853 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
    854 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
    855 
    856 #---------------------------------------------------------
    857 # Handle the DIRS options for sequential construction
    858 #---------------------------------------------------------
    859 
    860 SubDirs :=
    861 ifdef DIRS
    862 SubDirs += $(DIRS)
    863 
    864 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
    865 $(RecursiveTargets)::
    866 	$(Verb) for dir in $(DIRS); do \
    867 	  if ([ ! -f $$dir/Makefile ] || \
    868 	      command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
    869 	    $(MKDIR) $$dir; \
    870 	    $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
    871 	  fi; \
    872 	  ($(MAKE) -C $$dir $@ ) || exit 1; \
    873 	done
    874 else
    875 $(RecursiveTargets)::
    876 	$(Verb) for dir in $(DIRS); do \
    877 	  ($(MAKE) -C $$dir $@ ) || exit 1; \
    878 	done
    879 endif
    880 
    881 endif
    882 
    883 #---------------------------------------------------------
    884 # Handle the EXPERIMENTAL_DIRS options ensuring success
    885 # after each directory is built.
    886 #---------------------------------------------------------
    887 ifdef EXPERIMENTAL_DIRS
    888 $(RecursiveTargets)::
    889 	$(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
    890 	  if ([ ! -f $$dir/Makefile ] || \
    891 	      command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
    892 	    $(MKDIR) $$dir; \
    893 	    $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
    894 	  fi; \
    895 	  ($(MAKE) -C $$dir $@ ) || exit 0; \
    896 	done
    897 endif
    898 
    899 #-----------------------------------------------------------
    900 # Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
    901 #-----------------------------------------------------------
    902 ifdef OPTIONAL_PARALLEL_DIRS
    903   PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) -o -f $(T)/Makefile && echo "$(T)"))
    904 endif
    905 
    906 #-----------------------------------------------------------
    907 # Handle the PARALLEL_DIRS options for parallel construction
    908 #-----------------------------------------------------------
    909 ifdef PARALLEL_DIRS
    910 
    911 SubDirs += $(PARALLEL_DIRS)
    912 
    913 # Unfortunately, this list must be maintained if new recursive targets are added
    914 all      :: $(addsuffix /.makeall      ,$(PARALLEL_DIRS))
    915 clean    :: $(addsuffix /.makeclean    ,$(PARALLEL_DIRS))
    916 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
    917 install  :: $(addsuffix /.makeinstall  ,$(PARALLEL_DIRS))
    918 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
    919 install-bytecode  :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
    920 unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS))
    921 
    922 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
    923 
    924 $(ParallelTargets) :
    925 	$(Verb) \
    926 	  SD=$(PROJ_SRC_DIR)/$(@D); \
    927 	  DD=$(@D); \
    928 	  if [ ! -f $$SD/Makefile ]; then \
    929 	    SD=$(@D); \
    930 	    DD=$(notdir $(@D)); \
    931 	  fi; \
    932 	  if ([ ! -f $$DD/Makefile ] || \
    933 	            command test $$DD/Makefile -ot \
    934                       $$SD/Makefile ); then \
    935 	  $(MKDIR) $$DD; \
    936 	  $(CP) $$SD/Makefile $$DD/Makefile; \
    937 	fi; \
    938 	$(MAKE) -C $$DD $(subst $(@D)/.make,,$@)
    939 endif
    940 
    941 #---------------------------------------------------------
    942 # Handle the OPTIONAL_DIRS options for directores that may
    943 # or may not exist.
    944 #---------------------------------------------------------
    945 ifdef OPTIONAL_DIRS
    946 
    947 SubDirs += $(OPTIONAL_DIRS)
    948 
    949 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
    950 $(RecursiveTargets)::
    951 	$(Verb) for dir in $(OPTIONAL_DIRS); do \
    952 	  if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
    953 	    if ([ ! -f $$dir/Makefile ] || \
    954 	        command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
    955 	      $(MKDIR) $$dir; \
    956 	      $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
    957 	    fi; \
    958 	    ($(MAKE) -C$$dir $@ ) || exit 1; \
    959 	  fi \
    960 	done
    961 else
    962 $(RecursiveTargets)::
    963 	$(Verb) for dir in $(OPTIONAL_DIRS); do \
    964 	  if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
    965 	    ($(MAKE) -C$$dir $@ ) || exit 1; \
    966 	  fi \
    967 	done
    968 endif
    969 endif
    970 
    971 #---------------------------------------------------------
    972 # Handle the CONFIG_FILES options
    973 #---------------------------------------------------------
    974 ifdef CONFIG_FILES
    975 
    976 ifdef NO_INSTALL
    977 install-local::
    978 	$(Echo) Install circumvented with NO_INSTALL
    979 uninstall-local::
    980 	$(Echo) UnInstall circumvented with NO_INSTALL
    981 else
    982 install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
    983 	$(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir)
    984 	$(Verb)for file in $(CONFIG_FILES); do \
    985           if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
    986             $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
    987           elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
    988             $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
    989           else \
    990             $(ECHO) Error: cannot find config file $${file}. ; \
    991           fi \
    992 	done
    993 
    994 uninstall-local::
    995 	$(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
    996 	$(Verb)for file in $(CONFIG_FILES); do \
    997 	  $(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
    998 	done
    999 endif
   1000 
   1001 endif
   1002 
   1003 ###############################################################################
   1004 # Set up variables for building libraries
   1005 ###############################################################################
   1006 
   1007 #---------------------------------------------------------
   1008 # Define various command line options pertaining to the
   1009 # libraries needed when linking. There are "Proj" libs
   1010 # (defined by the user's project) and "LLVM" libs (defined
   1011 # by the LLVM project).
   1012 #---------------------------------------------------------
   1013 
   1014 ifdef USEDLIBS
   1015 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
   1016 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o,  $(ProjLibsOptions))
   1017 ProjUsedLibs    := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
   1018 ProjLibsPaths   := $(addprefix $(LibDir)/,$(ProjUsedLibs))
   1019 endif
   1020 
   1021 ifdef LLVMLIBS
   1022 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
   1023 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
   1024 LLVMUsedLibs    := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
   1025 LLVMLibsPaths   := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
   1026 endif
   1027 
   1028 # Loadable module for Win32 requires all symbols resolved for linking.
   1029 # Then all symbols in LLVM.dll will be available.
   1030 ifeq ($(ENABLE_SHARED),1)
   1031   ifdef LOADABLE_MODULE
   1032     ifneq (,$(filter $(HOST_OS),Cygwin MingW))
   1033       LINK_COMPONENTS += all
   1034     endif
   1035   endif
   1036 endif
   1037 
   1038 ifndef IS_CLEANING_TARGET
   1039 ifdef LINK_COMPONENTS
   1040 
   1041 # If LLVM_CONFIG doesn't exist, build it.  This can happen if you do a make
   1042 # clean in tools, then do a make in tools (instead of at the top level).
   1043 $(LLVM_CONFIG):
   1044 	@echo "*** llvm-config doesn't exist - rebuilding it."
   1045 	@$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config
   1046 
   1047 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
   1048 
   1049 ifeq ($(ENABLE_SHARED), 1)
   1050 # We can take the "auto-import" feature to get rid of using dllimport.
   1051 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
   1052 LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
   1053                    -L $(SharedLibDir)
   1054 endif
   1055 LLVMLibsOptions += -lLLVM-$(LLVMVersion)
   1056 LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT)
   1057 else
   1058 
   1059 ifndef NO_LLVM_CONFIG
   1060 LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)
   1061 ifeq ($(LLVMConfigLibs),Error)
   1062 $(error llvm-config --libs failed)
   1063 endif
   1064 LLVMLibsOptions += $(LLVMConfigLibs)
   1065 LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error)
   1066 ifeq ($(LLVMConfigLibfiles),Error)
   1067 $(error llvm-config --libfiles failed)
   1068 endif
   1069 LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles)
   1070 endif
   1071 
   1072 endif
   1073 endif
   1074 endif
   1075 
   1076 # Set up the library exports file.
   1077 ifdef EXPORTED_SYMBOL_FILE
   1078 
   1079 # First, set up the native export file, which may differ from the source
   1080 # export file.
   1081 
   1082 ifeq ($(HOST_OS),Darwin)
   1083 # Darwin convention prefixes symbols with underscores.
   1084 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed
   1085 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
   1086 	$(Verb) sed -e 's/^/_/' < $< > $@
   1087 clean-local::
   1088 	-$(Verb) $(RM) -f $(NativeExportsFile)
   1089 else
   1090 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
   1091 # Gold and BFD ld require a version script rather than a plain list.
   1092 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
   1093 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
   1094 	$(Verb) echo "{" > $@
   1095 	$(Verb) grep -q '[[:alnum:]_]' $< && echo "  global:" >> $@ || :
   1096 	$(Verb) sed -e 's/$$/;/' -e 's/^/    /' < $< >> $@
   1097 ifneq ($(HOST_OS),OpenBSD)
   1098 	$(Verb) echo "  local: *;" >> $@
   1099 endif
   1100 	$(Verb) echo "};" >> $@
   1101 clean-local::
   1102 	-$(Verb) $(RM) -f $(NativeExportsFile)
   1103 else
   1104 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
   1105 # GNU ld Win32 accepts .DEF files that contain "DATA" entries.
   1106 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def))
   1107 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
   1108 	$(Echo) Generating $(notdir $@)
   1109 	$(Verb) $(ECHO) "EXPORTS" > $@
   1110 	$(Verb) $(CAT) $< >> $@
   1111 clean-local::
   1112 	-$(Verb) $(RM) -f $(NativeExportsFile)
   1113 else
   1114 # Default behavior: just use the exports file verbatim.
   1115 NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
   1116 endif
   1117 endif
   1118 endif
   1119 
   1120 # Now add the linker command-line options to use the native export file.
   1121 
   1122 # Darwin
   1123 ifeq ($(HOST_OS),Darwin)
   1124 LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
   1125 endif
   1126 
   1127 # gold, bfd ld, etc.
   1128 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
   1129 LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
   1130 endif
   1131 
   1132 # Windows
   1133 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
   1134 # LLVMLibsOptions is invalidated at processing tools/llvm-shlib.
   1135 SharedLinkOptions += $(NativeExportsFile)
   1136 endif
   1137 
   1138 endif
   1139 
   1140 ###############################################################################
   1141 # Library Build Rules: Four ways to build a library
   1142 ###############################################################################
   1143 
   1144 #---------------------------------------------------------
   1145 # Bytecode Module Targets:
   1146 #   If the user set MODULE_NAME then they want to build a
   1147 #   bytecode module from the sources. We compile all the
   1148 #   sources and link it together into a single bytecode
   1149 #   module.
   1150 #---------------------------------------------------------
   1151 
   1152 ifdef MODULE_NAME
   1153 ifeq ($(strip $(LLVMCC)),)
   1154 $(warning Modules require LLVM capable compiler but none is available ****)
   1155 else
   1156 
   1157 Module     := $(LibDir)/$(MODULE_NAME).bc
   1158 LinkModule := $(LLVMLINK)
   1159 
   1160 
   1161 ifdef EXPORTED_SYMBOL_FILE
   1162 LinkModule += -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
   1163 endif
   1164 
   1165 $(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(LLVMLINK)
   1166 	$(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
   1167 	$(Verb) $(LinkModule) -o $@ $(ObjectsBC)
   1168 
   1169 all-local:: $(Module)
   1170 
   1171 clean-local::
   1172 ifneq ($(strip $(Module)),)
   1173 	-$(Verb) $(RM) -f $(Module)
   1174 endif
   1175 
   1176 ifdef BYTECODE_DESTINATION
   1177 ModuleDestDir := $(BYTECODE_DESTINATION)
   1178 else
   1179 ModuleDestDir := $(DESTDIR)$(PROJ_libdir)
   1180 endif
   1181 
   1182 ifdef NO_INSTALL
   1183 install-local::
   1184 	$(Echo) Install circumvented with NO_INSTALL
   1185 uninstall-local::
   1186 	$(Echo) Uninstall circumvented with NO_INSTALL
   1187 else
   1188 DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
   1189 
   1190 install-module:: $(DestModule)
   1191 install-local:: $(DestModule)
   1192 
   1193 $(DestModule): $(ModuleDestDir) $(Module)
   1194 	$(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
   1195 	$(Verb) $(DataInstall) $(Module) $(DestModule)
   1196 
   1197 uninstall-local::
   1198 	$(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
   1199 	-$(Verb) $(RM) -f $(DestModule)
   1200 endif
   1201 
   1202 endif
   1203 endif
   1204 
   1205 # if we're building a library ...
   1206 ifdef LIBRARYNAME
   1207 
   1208 # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option
   1209 LIBRARYNAME := $(strip $(LIBRARYNAME))
   1210 ifdef LOADABLE_MODULE
   1211 BaseLibName.A  := $(LIBRARYNAME).a
   1212 BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT)
   1213 else
   1214 BaseLibName.A  := lib$(LIBRARYNAME).a
   1215 BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
   1216 endif
   1217 LibName.A  := $(LibDir)/$(BaseLibName.A)
   1218 LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
   1219 LibName.O  := $(LibDir)/$(LIBRARYNAME).o
   1220 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
   1221 
   1222 #---------------------------------------------------------
   1223 # Shared Library Targets:
   1224 #   If the user asked for a shared library to be built
   1225 #   with the SHARED_LIBRARY variable, then we provide
   1226 #   targets for building them.
   1227 #---------------------------------------------------------
   1228 ifdef SHARED_LIBRARY
   1229 
   1230 all-local:: $(LibName.SO)
   1231 
   1232 ifdef EXPORTED_SYMBOL_FILE
   1233 $(LibName.SO): $(NativeExportsFile)
   1234 endif
   1235 
   1236 ifdef LINK_LIBS_IN_SHARED
   1237 ifdef LOADABLE_MODULE
   1238 SharedLibKindMessage := "Loadable Module"
   1239 SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions)
   1240 else
   1241 SharedLibKindMessage := "Shared Library"
   1242 endif
   1243 $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
   1244 	$(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
   1245 	  $(notdir $@)
   1246 	$(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
   1247 	  $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
   1248 else
   1249 $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
   1250 	$(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
   1251 	$(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
   1252 endif
   1253 
   1254 clean-local::
   1255 ifneq ($(strip $(LibName.SO)),)
   1256 	-$(Verb) $(RM) -f $(LibName.SO)
   1257 endif
   1258 
   1259 ifdef NO_INSTALL
   1260 install-local::
   1261 	$(Echo) Install circumvented with NO_INSTALL
   1262 uninstall-local::
   1263 	$(Echo) Uninstall circumvented with NO_INSTALL
   1264 else
   1265 
   1266 # Win32.DLL prefers to be located on the "PATH" of binaries.
   1267 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
   1268 DestSharedLibDir := $(DESTDIR)$(PROJ_bindir)
   1269 else
   1270 DestSharedLibDir := $(DESTDIR)$(PROJ_libdir)
   1271 endif
   1272 DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
   1273 
   1274 install-local:: $(DestSharedLib)
   1275 
   1276 $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir)
   1277 	$(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
   1278 	$(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
   1279 
   1280 uninstall-local::
   1281 	$(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
   1282 	-$(Verb) $(RM) -f $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME).*
   1283 endif
   1284 endif
   1285 
   1286 #---------------------------------------------------------
   1287 # Bytecode Library Targets:
   1288 #   If the user asked for a bytecode library to be built
   1289 #   with the BYTECODE_LIBRARY variable, then we provide
   1290 #   targets for building them.
   1291 #---------------------------------------------------------
   1292 ifdef BYTECODE_LIBRARY
   1293 ifeq ($(strip $(LLVMCC)),)
   1294 $(warning Bytecode libraries require LLVM capable compiler but none is available ****)
   1295 else
   1296 
   1297 all-local:: $(LibName.BCA)
   1298 
   1299 ifdef EXPORTED_SYMBOL_FILE
   1300 BCLinkLib = $(LLVMLINK) -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
   1301 
   1302 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLINK) \
   1303                 $(LLVMToolDir)/llvm-ar
   1304 	$(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
   1305 	  "(internalize)"
   1306 	$(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).internalize $(ObjectsBC)
   1307 	$(Verb) $(RM) -f $@
   1308 	$(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).internalize.bc
   1309 else
   1310 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
   1311                 $(LLVMToolDir)/llvm-ar
   1312 	$(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
   1313 	$(Verb) $(RM) -f $@
   1314 	$(Verb) $(LArchive) $@ $(ObjectsBC)
   1315 
   1316 endif
   1317 
   1318 clean-local::
   1319 ifneq ($(strip $(LibName.BCA)),)
   1320 	-$(Verb) $(RM) -f $(LibName.BCA)
   1321 endif
   1322 
   1323 ifdef BYTECODE_DESTINATION
   1324 BytecodeDestDir := $(BYTECODE_DESTINATION)
   1325 else
   1326 BytecodeDestDir := $(DESTDIR)$(PROJ_libdir)
   1327 endif
   1328 
   1329 DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).bca
   1330 
   1331 install-bytecode-local:: $(DestBytecodeLib)
   1332 
   1333 ifdef NO_INSTALL
   1334 install-local::
   1335 	$(Echo) Install circumvented with NO_INSTALL
   1336 uninstall-local::
   1337 	$(Echo) Uninstall circumvented with NO_INSTALL
   1338 else
   1339 install-local:: $(DestBytecodeLib)
   1340 
   1341 $(DestBytecodeLib): $(LibName.BCA) $(BytecodeDestDir)
   1342 	$(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
   1343 	$(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
   1344 
   1345 uninstall-local::
   1346 	$(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
   1347 	-$(Verb) $(RM) -f $(DestBytecodeLib)
   1348 endif
   1349 endif
   1350 endif
   1351 
   1352 #---------------------------------------------------------
   1353 # Library Targets:
   1354 #   If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
   1355 #   building an archive.
   1356 #---------------------------------------------------------
   1357 ifndef NO_BUILD_ARCHIVE
   1358 ifndef BUILD_ARCHIVE
   1359 ifndef LOADABLE_MODULE
   1360 BUILD_ARCHIVE = 1
   1361 endif
   1362 endif
   1363 endif
   1364 
   1365 #---------------------------------------------------------
   1366 # Archive Library Targets:
   1367 #   If the user wanted a regular archive library built,
   1368 #   then we provide targets for building them.
   1369 #---------------------------------------------------------
   1370 ifdef BUILD_ARCHIVE
   1371 
   1372 all-local:: $(LibName.A)
   1373 
   1374 $(LibName.A): $(ObjectsO) $(LibDir)/.dir
   1375 	$(Echo) Building $(BuildMode) Archive Library $(notdir $@)
   1376 	-$(Verb) $(RM) -f $@
   1377 	$(Verb) $(Archive) $@ $(ObjectsO)
   1378 	$(Verb) $(Ranlib) $@
   1379 
   1380 clean-local::
   1381 ifneq ($(strip $(LibName.A)),)
   1382 	-$(Verb) $(RM) -f $(LibName.A)
   1383 endif
   1384 
   1385 ifdef NO_INSTALL
   1386 install-local::
   1387 	$(Echo) Install circumvented with NO_INSTALL
   1388 uninstall-local::
   1389 	$(Echo) Uninstall circumvented with NO_INSTALL
   1390 else
   1391 ifdef NO_INSTALL_ARCHIVES
   1392 install-local::
   1393 	$(Echo) Install circumvented with NO_INSTALL
   1394 uninstall-local::
   1395 	$(Echo) Uninstall circumvented with NO_INSTALL
   1396 else
   1397 DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a
   1398 
   1399 install-local:: $(DestArchiveLib)
   1400 
   1401 $(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
   1402 	$(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
   1403 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
   1404 	$(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
   1405 
   1406 uninstall-local::
   1407 	$(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
   1408 	-$(Verb) $(RM) -f $(DestArchiveLib)
   1409 endif
   1410 endif
   1411 endif
   1412 
   1413 # endif LIBRARYNAME
   1414 endif
   1415 
   1416 ###############################################################################
   1417 # Tool Build Rules: Build executable tool based on TOOLNAME option
   1418 ###############################################################################
   1419 
   1420 ifdef TOOLNAME
   1421 
   1422 #---------------------------------------------------------
   1423 # Set up variables for building a tool.
   1424 #---------------------------------------------------------
   1425 TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
   1426 ifdef EXAMPLE_TOOL
   1427 ToolBuildPath   := $(ExmplDir)/$(TOOLEXENAME)
   1428 else
   1429 ToolBuildPath   := $(ToolDir)/$(TOOLEXENAME)
   1430 endif
   1431 
   1432 # TOOLALIAS is a name to symlink (or copy) the tool to.
   1433 ifdef TOOLALIAS
   1434 ifdef EXAMPLE_TOOL
   1435 ToolAliasBuildPath   := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
   1436 else
   1437 ToolAliasBuildPath   := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
   1438 endif
   1439 endif
   1440 
   1441 #---------------------------------------------------------
   1442 # Prune Exports
   1443 #---------------------------------------------------------
   1444 
   1445 # If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
   1446 # not exporting all of the weak symbols from the binary.  This reduces dyld
   1447 # startup time by 4x on darwin in some cases.
   1448 ifdef TOOL_NO_EXPORTS
   1449 ifeq ($(HOST_OS),Darwin)
   1450 
   1451 # Tiger tools don't support this.
   1452 ifneq ($(DARWIN_MAJVERS),4)
   1453 LD.Flags += -Wl,-exported_symbol,_main
   1454 endif
   1455 endif
   1456 
   1457 ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU))
   1458 ifneq ($(ARCH), Mips)
   1459   LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
   1460 endif
   1461 endif
   1462 endif
   1463 
   1464 #---------------------------------------------------------
   1465 # Tool Order File Support
   1466 #---------------------------------------------------------
   1467 
   1468 ifeq ($(HOST_OS),Darwin)
   1469 ifdef TOOL_ORDER_FILE
   1470 
   1471 LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
   1472 
   1473 endif
   1474 endif
   1475 
   1476 #---------------------------------------------------------
   1477 # Tool Version Info Support
   1478 #---------------------------------------------------------
   1479 
   1480 ifeq ($(HOST_OS),Darwin)
   1481 ifdef TOOL_INFO_PLIST
   1482 
   1483 LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST)
   1484 
   1485 $(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST)
   1486 
   1487 $(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir
   1488 	$(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..."
   1489 	$(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \
   1490 	           -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \
   1491 	           -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \
   1492 	         -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \
   1493 	           $< > $@
   1494 
   1495 endif
   1496 endif
   1497 
   1498 #---------------------------------------------------------
   1499 # Provide targets for building the tools
   1500 #---------------------------------------------------------
   1501 all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
   1502 
   1503 clean-local::
   1504 ifneq ($(strip $(ToolBuildPath)),)
   1505 	-$(Verb) $(RM) -f $(ToolBuildPath)
   1506 endif
   1507 ifneq ($(strip $(ToolAliasBuildPath)),)
   1508 	-$(Verb) $(RM) -f $(ToolAliasBuildPath)
   1509 endif
   1510 
   1511 ifdef EXAMPLE_TOOL
   1512 $(ToolBuildPath): $(ExmplDir)/.dir
   1513 else
   1514 $(ToolBuildPath): $(ToolDir)/.dir
   1515 endif
   1516 
   1517 ifdef CODESIGN_TOOLS
   1518 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
   1519 	$(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
   1520 	$(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
   1521 	$(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
   1522 	$(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
   1523           $(StripWarnMsg)
   1524 	$(Echo) ======= Code-Signing $(BuildMode) Executable $(TOOLNAME)
   1525 	$(Verb) codesign -s - $@
   1526 else
   1527 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
   1528 	$(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
   1529 	$(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
   1530 	$(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
   1531 	$(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
   1532           $(StripWarnMsg)
   1533 endif
   1534 
   1535 ifneq ($(strip $(ToolAliasBuildPath)),)
   1536 $(ToolAliasBuildPath): $(ToolBuildPath)
   1537 	$(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
   1538 	$(Verb) $(RM) -f $(ToolAliasBuildPath)
   1539 	$(Verb) $(AliasTool) $(notdir $(ToolBuildPath)) $(ToolAliasBuildPath)
   1540 	$(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
   1541           $(StripWarnMsg)
   1542 endif
   1543 
   1544 ifdef NO_INSTALL
   1545 install-local::
   1546 	$(Echo) Install circumvented with NO_INSTALL
   1547 uninstall-local::
   1548 	$(Echo) Uninstall circumvented with NO_INSTALL
   1549 else
   1550 
   1551 ifdef INTERNAL_TOOL
   1552 ToolBinDir = $(DESTDIR)$(PROJ_internal_prefix)/bin
   1553 else
   1554 ToolBinDir = $(DESTDIR)$(PROJ_bindir)
   1555 endif
   1556 DestTool = $(ToolBinDir)/$(program_prefix)$(TOOLEXENAME)
   1557 
   1558 install-local:: $(DestTool)
   1559 
   1560 $(DestTool): $(ToolBuildPath)
   1561 	$(Echo) Installing $(BuildMode) $(DestTool)
   1562 	$(Verb) $(MKDIR) $(ToolBinDir)
   1563 	$(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
   1564 
   1565 uninstall-local::
   1566 	$(Echo) Uninstalling $(BuildMode) $(DestTool)
   1567 	-$(Verb) $(RM) -f $(DestTool)
   1568 
   1569 # TOOLALIAS install.
   1570 ifdef TOOLALIAS
   1571 DestToolAlias = $(ToolBinDir)/$(program_prefix)$(TOOLALIAS)$(EXEEXT)
   1572 
   1573 install-local:: $(DestToolAlias)
   1574 
   1575 $(DestToolAlias): $(DestTool)
   1576 	$(Echo) Installing $(BuildMode) $(DestToolAlias)
   1577 	$(Verb) $(RM) -f $(DestToolAlias)
   1578 	$(Verb) $(AliasTool) $(notdir $(DestTool)) $(DestToolAlias)
   1579 
   1580 uninstall-local::
   1581 	$(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
   1582 	-$(Verb) $(RM) -f $(DestToolAlias)
   1583 endif
   1584 
   1585 endif
   1586 endif
   1587 
   1588 ###############################################################################
   1589 # Object Build Rules: Build object files based on sources
   1590 ###############################################################################
   1591 
   1592 # FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
   1593 ifeq ($(HOST_OS),HP-UX)
   1594   DISABLE_AUTO_DEPENDENCIES=1
   1595 endif
   1596 
   1597 # Provide rule sets for when dependency generation is enabled
   1598 ifndef DISABLE_AUTO_DEPENDENCIES
   1599 
   1600 #---------------------------------------------------------
   1601 # Create .o files in the ObjDir directory from the .cpp and .c files...
   1602 #---------------------------------------------------------
   1603 
   1604 DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
   1605          -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
   1606 
   1607 # If the build succeeded, move the dependency file over, otherwise
   1608 # remove it.
   1609 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
   1610                   else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
   1611 
   1612 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
   1613 	$(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
   1614 	$(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
   1615 	        $(DEPEND_MOVEFILE)
   1616 
   1617 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
   1618 	$(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
   1619 	$(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
   1620 	        $(DEPEND_MOVEFILE)
   1621 
   1622 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
   1623 	$(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
   1624 	$(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
   1625 	        $(DEPEND_MOVEFILE)
   1626 
   1627 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
   1628 	$(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
   1629 	$(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
   1630 	        $(DEPEND_MOVEFILE)
   1631 
   1632 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
   1633 	$(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
   1634 	$(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
   1635 	        $(DEPEND_MOVEFILE)
   1636 
   1637 #---------------------------------------------------------
   1638 # Create .bc files in the ObjDir directory from .cpp .cc and .c files...
   1639 #---------------------------------------------------------
   1640 
   1641 BC_DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.bc.d.tmp" \
   1642 	-MT "$(ObjDir)/$*.ll" -MT "$(ObjDir)/$*.bc.d"
   1643 
   1644 # If the build succeeded, move the dependency file over, otherwise
   1645 # remove it.
   1646 BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d"; \
   1647                      else $(RM) "$(ObjDir)/$*.bc.d.tmp"; exit 1; fi
   1648 
   1649 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
   1650 	$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
   1651 	$(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
   1652 			$< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
   1653 	        $(BC_DEPEND_MOVEFILE)
   1654 
   1655 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
   1656 	$(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
   1657 	$(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
   1658 			$< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
   1659 	        $(BC_DEPEND_MOVEFILE)
   1660 
   1661 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
   1662 	$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
   1663 	$(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
   1664 			$< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
   1665 	        $(BC_DEPEND_MOVEFILE)
   1666 
   1667 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
   1668 	$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
   1669 	$(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
   1670 			$< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
   1671 	        $(BC_DEPEND_MOVEFILE)
   1672 
   1673 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
   1674 	$(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
   1675 	$(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
   1676 			$< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
   1677 	        $(BC_DEPEND_MOVEFILE)
   1678 
   1679 # Provide alternate rule sets if dependencies are disabled
   1680 else
   1681 
   1682 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
   1683 	$(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
   1684 	$(Compile.CXX) $< -o $@
   1685 
   1686 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
   1687 	$(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
   1688 	$(Compile.CXX) $< -o $@
   1689 
   1690 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
   1691 	$(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
   1692 	$(Compile.CXX) $< -o $@
   1693 
   1694 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
   1695 	$(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
   1696 	$(Compile.C) $< -o $@
   1697 
   1698 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
   1699 	$(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
   1700 	$(Compile.C) $< -o $@
   1701 
   1702 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
   1703 	$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
   1704 	$(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
   1705 
   1706 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
   1707 	$(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
   1708 	$(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
   1709 
   1710 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
   1711 	$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
   1712 	$(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
   1713 
   1714 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
   1715 	$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
   1716 	$(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
   1717 
   1718 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
   1719 	$(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
   1720 	$(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
   1721 
   1722 endif
   1723 
   1724 
   1725 ## Rules for building preprocessed (.i/.ii) outputs.
   1726 $(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
   1727 	$(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
   1728 	$(Verb) $(Preprocess.CXX) $< -o $@
   1729 
   1730 $(BuildMode)/%.ii: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
   1731 	$(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file"
   1732 	$(Verb) $(Preprocess.CXX) $< -o $@
   1733 
   1734 $(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
   1735 	$(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
   1736 	$(Verb) $(Preprocess.CXX) $< -o $@
   1737 
   1738 $(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
   1739 	$(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
   1740 	$(Verb) $(Preprocess.C) $< -o $@
   1741 
   1742 $(BuildMode)/%.i: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
   1743 	$(Echo) "Compiling $*.m for $(BuildMode) build to .i file"
   1744 	$(Verb) $(Preprocess.C) $< -o $@
   1745 
   1746 
   1747 $(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
   1748 	$(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
   1749 	$(Compile.CXX) $< -o $@ -S
   1750 
   1751 $(ObjDir)/%.s: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
   1752 	$(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG)
   1753 	$(Compile.CXX) $< -o $@ -S
   1754 
   1755 $(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
   1756 	$(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
   1757 	$(Compile.CXX) $< -o $@ -S
   1758 
   1759 $(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
   1760 	$(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
   1761 	$(Compile.C) $< -o $@ -S
   1762 
   1763 $(ObjDir)/%.s: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
   1764 	$(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG)
   1765 	$(Compile.C) $< -o $@ -S
   1766 
   1767 
   1768 # make the C and C++ compilers strip debug info out of bytecode libraries.
   1769 ifdef DEBUG_RUNTIME
   1770 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
   1771 	$(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
   1772 	$(Verb) $(LOPT) $< -std-compile-opts -o $@
   1773 else
   1774 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
   1775 	$(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
   1776 	$(Verb) $(LOPT) $< -std-compile-opts -strip-debug -o $@
   1777 endif
   1778 
   1779 
   1780 #---------------------------------------------------------
   1781 # Provide rule to build .bc files from .ll sources,
   1782 # regardless of dependencies
   1783 #---------------------------------------------------------
   1784 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
   1785 	$(Echo) "Compiling $*.ll for $(BuildMode) build"
   1786 	$(Verb) $(LLVMAS) $< -f -o $@
   1787 
   1788 ###############################################################################
   1789 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
   1790 ###############################################################################
   1791 
   1792 ifdef TARGET
   1793 TABLEGEN_INC_FILES_COMMON = 1
   1794 endif
   1795 
   1796 ifdef TABLEGEN_INC_FILES_COMMON
   1797 
   1798 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
   1799 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
   1800 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
   1801 
   1802 # INCFiles rule: All of the tblgen generated files are emitted to
   1803 # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc.  This allows
   1804 # us to only "touch" the real file if the contents of it change.  IOW, if
   1805 # tblgen is modified, all of the .inc.tmp files are regenerated, but no
   1806 # dependencies of the .inc files are, unless the contents of the .inc file
   1807 # changes.
   1808 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
   1809 	$(Verb) $(CMP) -s $@ $< || $(CP) $< $@
   1810 
   1811 endif # TABLEGEN_INC_FILES_COMMON
   1812 
   1813 ifdef TARGET
   1814 
   1815 TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
   1816            $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \
   1817            $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \
   1818            $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \
   1819            $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \
   1820            $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
   1821            $(wildcard $(LLVM_SRC_ROOT)/include/llvm/IR/Intrinsics*.td)
   1822 
   1823 # All .inc.tmp files depend on the .td files.
   1824 $(INCTMPFiles) : $(TDFiles)
   1825 
   1826 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
   1827 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1828 	$(Echo) "Building $(<F) register info implementation with tblgen"
   1829 	$(Verb) $(LLVMTableGen) -gen-register-info -o $(call SYSPATH, $@) $<
   1830 
   1831 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
   1832 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1833 	$(Echo) "Building $(<F) instruction information with tblgen"
   1834 	$(Verb) $(LLVMTableGen) -gen-instr-info -o $(call SYSPATH, $@) $<
   1835 
   1836 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
   1837 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1838 	$(Echo) "Building $(<F) assembly writer with tblgen"
   1839 	$(Verb) $(LLVMTableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
   1840 
   1841 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
   1842 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1843 	$(Echo) "Building $(<F) assembly writer #1 with tblgen"
   1844 	$(Verb) $(LLVMTableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
   1845 
   1846 $(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
   1847 $(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1848 	$(Echo) "Building $(<F) assembly matcher with tblgen"
   1849 	$(Verb) $(LLVMTableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
   1850 
   1851 $(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \
   1852 $(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1853 	$(Echo) "Building $(<F) MC code emitter with tblgen"
   1854 	$(Verb) $(LLVMTableGen) -gen-emitter -mc-emitter -o $(call SYSPATH, $@) $<
   1855 
   1856 $(TARGET:%=$(ObjDir)/%GenMCPseudoLowering.inc.tmp): \
   1857 $(ObjDir)/%GenMCPseudoLowering.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1858 	$(Echo) "Building $(<F) MC Pseudo instruction expander with tblgen"
   1859 	$(Verb) $(LLVMTableGen) -gen-pseudo-lowering -o $(call SYSPATH, $@) $<
   1860 
   1861 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
   1862 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1863 	$(Echo) "Building $(<F) code emitter with tblgen"
   1864 	$(Verb) $(LLVMTableGen) -gen-emitter -o $(call SYSPATH, $@) $<
   1865 
   1866 $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
   1867 $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1868 	$(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
   1869 	$(Verb) $(LLVMTableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
   1870 
   1871 $(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \
   1872 $(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1873 	$(Echo) "Building $(<F) disassembly tables with tblgen"
   1874 	$(Verb) $(LLVMTableGen) -gen-disassembler -o $(call SYSPATH, $@) $<
   1875 
   1876 $(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
   1877 $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1878 	$(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
   1879 	$(Verb) $(LLVMTableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
   1880 
   1881 $(TARGET:%=$(ObjDir)/%GenSubtargetInfo.inc.tmp): \
   1882 $(ObjDir)/%GenSubtargetInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1883 	$(Echo) "Building $(<F) subtarget information with tblgen"
   1884 	$(Verb) $(LLVMTableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
   1885 
   1886 $(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
   1887 $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1888 	$(Echo) "Building $(<F) calling convention information with tblgen"
   1889 	$(Verb) $(LLVMTableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
   1890 
   1891 $(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
   1892 $(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1893 	$(Echo) "Building $(<F) intrinsics information with tblgen"
   1894 	$(Verb) $(LLVMTableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
   1895 
   1896 $(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1897 	$(Echo) "Building $(<F) decoder tables with tblgen"
   1898 	$(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $<
   1899 
   1900 $(ObjDir)/%GenDFAPacketizer.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
   1901 	$(Echo) "Building $(<F) DFA packetizer tables with tblgen"
   1902 	$(Verb) $(LLVMTableGen) -gen-dfa-packetizer -o $(call SYSPATH, $@) $<
   1903 
   1904 clean-local::
   1905 	-$(Verb) $(RM) -f $(INCFiles)
   1906 
   1907 endif # TARGET
   1908 
   1909 ###############################################################################
   1910 # OTHER RULES: Other rules needed
   1911 ###############################################################################
   1912 
   1913 # To create postscript files from dot files...
   1914 ifneq ($(DOT),false)
   1915 %.ps: %.dot
   1916 	$(DOT) -Tps < $< > $@
   1917 else
   1918 %.ps: %.dot
   1919 	$(Echo) "Cannot build $@: The program dot is not installed"
   1920 endif
   1921 
   1922 # This rules ensures that header files that are removed still have a rule for
   1923 # which they can be "generated."  This allows make to ignore them and
   1924 # reproduce the dependency lists.
   1925 %.h:: ;
   1926 %.hpp:: ;
   1927 
   1928 # Define clean-local to clean the current directory. Note that this uses a
   1929 # very conservative approach ensuring that empty variables do not cause
   1930 # errors or disastrous removal.
   1931 clean-local::
   1932 ifneq ($(strip $(ObjRootDir)),)
   1933 	-$(Verb) $(RM) -rf $(ObjRootDir)
   1934 endif
   1935 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
   1936 	-$(Verb) $(RM) -f *$(SHLIBEXT)
   1937 endif
   1938 
   1939 clean-all-local::
   1940 	-$(Verb) $(RM) -rf Debug Release Profile
   1941 
   1942 
   1943 ###############################################################################
   1944 # DEPENDENCIES: Include the dependency files if we should
   1945 ###############################################################################
   1946 ifndef DISABLE_AUTO_DEPENDENCIES
   1947 
   1948 # If its not one of the cleaning targets
   1949 ifndef IS_CLEANING_TARGET
   1950 
   1951 # Get the list of dependency files
   1952 DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources)))
   1953 DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
   1954 
   1955 # Include bitcode dependency files if using bitcode libraries
   1956 ifdef BYTECODE_LIBRARY
   1957 DependFiles += $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.bc.d)
   1958 endif
   1959 
   1960 -include $(DependFiles) ""
   1961 
   1962 endif
   1963 
   1964 endif
   1965 
   1966 ###############################################################################
   1967 # CHECK: Running the test suite
   1968 ###############################################################################
   1969 
   1970 check::
   1971 	$(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
   1972 	  if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
   1973 	    $(EchoCmd) Running test suite ; \
   1974 	    $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
   1975 	      TESTSUITE=$(TESTSUITE) ; \
   1976 	  else \
   1977 	    $(EchoCmd) No Makefile in test directory ; \
   1978 	  fi ; \
   1979 	else \
   1980 	  $(EchoCmd) No test directory ; \
   1981 	fi
   1982 
   1983 # An alias dating from when both lit and DejaGNU test runners were used.
   1984 check-lit:: check
   1985 
   1986 check-all::
   1987 	$(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
   1988 	  if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
   1989 	    $(EchoCmd) Running test suite ; \
   1990 	    $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \
   1991 	  else \
   1992 	    $(EchoCmd) No Makefile in test directory ; \
   1993 	  fi ; \
   1994 	else \
   1995 	  $(EchoCmd) No test directory ; \
   1996 	fi
   1997 
   1998 ###############################################################################
   1999 # UNITTESTS: Running the unittests test suite
   2000 ###############################################################################
   2001 
   2002 unittests::
   2003 	$(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
   2004 	  if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
   2005 	    $(EchoCmd) Running unittests test suite ; \
   2006 	    $(MAKE) -C $(PROJ_OBJ_ROOT)/unittests unitcheck; \
   2007 	  else \
   2008 	    $(EchoCmd) No Makefile in unittests directory ; \
   2009 	  fi ; \
   2010 	else \
   2011 	  $(EchoCmd) No unittests directory ; \
   2012 	fi
   2013 
   2014 ###############################################################################
   2015 # DISTRIBUTION: Handle construction of a distribution tarball
   2016 ###############################################################################
   2017 
   2018 #------------------------------------------------------------------------
   2019 # Define distribution related variables
   2020 #------------------------------------------------------------------------
   2021 DistName    := $(PROJECT_NAME)-$(PROJ_VERSION)
   2022 DistDir     := $(PROJ_OBJ_ROOT)/$(DistName)
   2023 TopDistDir  := $(PROJ_OBJ_ROOT)/$(DistName)
   2024 DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
   2025 DistZip     := $(PROJ_OBJ_ROOT)/$(DistName).zip
   2026 DistTarBZ2  := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
   2027 DistAlways  := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
   2028 	       ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
   2029 	       Makefile.config.in configure autoconf
   2030 DistOther   := $(notdir $(wildcard \
   2031                $(PROJ_SRC_DIR)/*.h \
   2032                $(PROJ_SRC_DIR)/*.td \
   2033                $(PROJ_SRC_DIR)/*.def \
   2034                $(PROJ_SRC_DIR)/*.ll \
   2035                $(PROJ_SRC_DIR)/*.in))
   2036 DistSubDirs := $(SubDirs)
   2037 DistSources  = $(Sources) $(EXTRA_DIST)
   2038 DistFiles    = $(DistAlways) $(DistSources) $(DistOther)
   2039 
   2040 #------------------------------------------------------------------------
   2041 # We MUST build distribution with OBJ_DIR != SRC_DIR
   2042 #------------------------------------------------------------------------
   2043 ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
   2044 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
   2045 	$(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
   2046 
   2047 else
   2048 
   2049 #------------------------------------------------------------------------
   2050 # Prevent attempt to run dist targets from anywhere but the top level
   2051 #------------------------------------------------------------------------
   2052 ifneq ($(LEVEL),.)
   2053 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
   2054 	$(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
   2055 else
   2056 
   2057 #------------------------------------------------------------------------
   2058 # Provide the top level targets
   2059 #------------------------------------------------------------------------
   2060 
   2061 dist-gzip:: $(DistTarGZip)
   2062 
   2063 $(DistTarGZip) : $(TopDistDir)/.makedistdir
   2064 	$(Echo) Packing gzipped distribution tar file.
   2065 	$(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
   2066 	  $(GZIP) -c > "$(DistTarGZip)"
   2067 
   2068 dist-bzip2:: $(DistTarBZ2)
   2069 
   2070 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
   2071 	$(Echo) Packing bzipped distribution tar file.
   2072 	$(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
   2073 	  $(BZIP2) -c >$(DistTarBZ2)
   2074 
   2075 dist-zip:: $(DistZip)
   2076 
   2077 $(DistZip) : $(TopDistDir)/.makedistdir
   2078 	$(Echo) Packing zipped distribution file.
   2079 	$(Verb) rm -f $(DistZip)
   2080 	$(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
   2081 
   2082 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
   2083 	$(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL =====
   2084 
   2085 DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
   2086 
   2087 dist-check:: $(DistTarGZip)
   2088 	$(Echo) Checking distribution tar file.
   2089 	$(Verb) if test -d $(DistCheckDir) ; then \
   2090 	  $(RM) -rf $(DistCheckDir) ; \
   2091 	fi
   2092 	$(Verb) $(MKDIR) $(DistCheckDir)
   2093 	$(Verb) cd $(DistCheckDir) && \
   2094 	  $(MKDIR) $(DistCheckDir)/build && \
   2095 	  $(MKDIR) $(DistCheckDir)/install && \
   2096 	  gunzip -c $(DistTarGZip) | $(TAR) xf - && \
   2097 	  cd build && \
   2098 	  ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
   2099 	    --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
   2100 	  $(MAKE) all && \
   2101 	  $(MAKE) check && \
   2102 	  $(MAKE) unittests && \
   2103 	  $(MAKE) install && \
   2104 	  $(MAKE) uninstall && \
   2105 	  $(MAKE) dist-clean && \
   2106 	  $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
   2107 
   2108 dist-clean::
   2109 	$(Echo) Cleaning distribution files
   2110 	-$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
   2111 	  $(DistCheckDir)
   2112 
   2113 endif
   2114 
   2115 #------------------------------------------------------------------------
   2116 # Provide the recursive distdir target for building the distribution directory
   2117 #------------------------------------------------------------------------
   2118 distdir: $(DistDir)/.makedistdir
   2119 $(DistDir)/.makedistdir: $(DistSources)
   2120 	$(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
   2121 	  if test -d "$(DistDir)" ; then \
   2122 	    find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';'  || \
   2123 	      exit 1 ; \
   2124 	  fi ; \
   2125 	  $(EchoCmd) Removing old $(DistDir) ; \
   2126 	  $(RM) -rf $(DistDir); \
   2127 	  $(EchoCmd) Making 'all' to verify build ; \
   2128 	  $(MAKE) ENABLE_OPTIMIZED=1 all ; \
   2129 	fi
   2130 	$(Echo) Building Distribution Directory $(DistDir)
   2131 	$(Verb) $(MKDIR) $(DistDir)
   2132 	$(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
   2133 	srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
   2134 	for file in $(DistFiles) ; do \
   2135 	  case "$$file" in \
   2136 	    $(PROJ_SRC_DIR)/*) \
   2137 	      file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
   2138 	      ;; \
   2139 	    $(PROJ_SRC_ROOT)/*) \
   2140 	      file=`echo "$$file" | \
   2141 		sed "s#^$$srcrootstrip/##"` \
   2142 	      ;; \
   2143 	  esac; \
   2144 	  if test -f "$(PROJ_SRC_DIR)/$$file" || \
   2145 	     test -d "$(PROJ_SRC_DIR)/$$file" ; then \
   2146 	    from_dir="$(PROJ_SRC_DIR)" ; \
   2147 	  elif test -f "$$file" || test -d "$$file" ; then \
   2148 	    from_dir=. ; \
   2149 	  fi ; \
   2150 	  to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
   2151 	  if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
   2152 	    to_dir="$(DistDir)/$$dir"; \
   2153 	    $(MKDIR) "$$to_dir" ; \
   2154 	  else \
   2155 	    to_dir="$(DistDir)"; \
   2156 	  fi; \
   2157 	  mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
   2158 	  if test -n "$$mid_dir" ; then \
   2159             $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
   2160           fi ; \
   2161 	  if test -d "$$from_dir/$$file"; then \
   2162 	    if test -d "$(PROJ_SRC_DIR)/$$file" && \
   2163 	       test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
   2164 	       cd $(PROJ_SRC_DIR) ; \
   2165 	       $(TAR) cf - $$file --exclude .svn --exclude CVS | \
   2166 	         ( cd $$to_dir ; $(TAR) xf - ) ; \
   2167 	       cd $(PROJ_OBJ_DIR) ; \
   2168 	    else \
   2169 	       cd $$from_dir ; \
   2170 	       $(TAR) cf - $$file --exclude .svn --exclude CVS | \
   2171 	         ( cd $$to_dir ; $(TAR) xf - ) ; \
   2172 	       cd $(PROJ_OBJ_DIR) ; \
   2173 	    fi; \
   2174 	  elif test -f "$$from_dir/$$file" ; then \
   2175 	    $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
   2176 	  elif test -L "$$from_dir/$$file" ; then \
   2177 	    $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
   2178 	  elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
   2179 	    $(EchoCmd) "===== WARNING: Distribution Source " \
   2180 	      "$$from_dir/$$file Not Found!" ; \
   2181 	  elif test "$(Verb)" != '@' ; then \
   2182 	    $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
   2183 	  fi; \
   2184 	done
   2185 	$(Verb) for subdir in $(DistSubDirs) ; do \
   2186 	  if test "$$subdir" \!= "." ; then \
   2187 	    new_distdir="$(DistDir)/$$subdir" ; \
   2188 	    test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
   2189 	    ( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
   2190 	      DistDir="$$new_distdir" distdir ) || exit 1; \
   2191 	  fi; \
   2192 	done
   2193 	$(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
   2194 	  $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
   2195 	  $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
   2196                                   -name .svn \) -print` ;\
   2197 	  $(MAKE) dist-hook ; \
   2198 	  $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
   2199 	    -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
   2200 	    -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
   2201 	    -o ! -type d ! -perm -444 -exec \
   2202 	      $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
   2203 	    || chmod -R a+r $(DistDir) ; \
   2204 	fi
   2205 
   2206 # This is invoked by distdir target, define it as a no-op to avoid errors if not
   2207 # defined by user.
   2208 dist-hook::
   2209 
   2210 endif
   2211 
   2212 ###############################################################################
   2213 # TOP LEVEL - targets only to apply at the top level directory
   2214 ###############################################################################
   2215 
   2216 ifeq ($(LEVEL),.)
   2217 
   2218 #------------------------------------------------------------------------
   2219 # Install support for the project's include files:
   2220 #------------------------------------------------------------------------
   2221 ifdef NO_INSTALL
   2222 install-local::
   2223 	$(Echo) Install circumvented with NO_INSTALL
   2224 uninstall-local::
   2225 	$(Echo) Uninstall circumvented with NO_INSTALL
   2226 else
   2227 install-local::
   2228 	$(Echo) Installing include files
   2229 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
   2230 	$(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
   2231 	  cd $(PROJ_SRC_ROOT)/include && \
   2232 	  for hdr in `find . -type f \
   2233 	      '(' -name LICENSE.TXT \
   2234 	       -o -name '*.def' \
   2235 	       -o -name '*.h' \
   2236 	       -o -name '*.inc' \
   2237 	       -o -name '*.td' \
   2238 	      ')' -print | grep -v CVS | \
   2239 	      grep -v .svn` ; do \
   2240 	    instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
   2241 	    if test \! -d "$$instdir" ; then \
   2242 	      $(EchoCmd) Making install directory $$instdir ; \
   2243 	      $(MKDIR) $$instdir ;\
   2244 	    fi ; \
   2245 	    $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
   2246 	  done ; \
   2247 	fi
   2248 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
   2249 	$(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
   2250 	  cd $(PROJ_OBJ_ROOT)/include && \
   2251 	  for hdr in `find . -type f \
   2252 	      '(' -name LICENSE.TXT \
   2253 	       -o -name '*.def' \
   2254 	       -o -name '*.h' \
   2255 	       -o -name '*.inc' \
   2256 	       -o -name '*.td' \
   2257 	      ')' -print | grep -v CVS | \
   2258 	      grep -v .svn` ; do \
   2259 	    instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
   2260 	    if test \! -d "$$instdir" ; then \
   2261 	      $(EchoCmd) Making install directory $$instdir ; \
   2262 	      $(MKDIR) $$instdir ;\
   2263 	    fi ; \
   2264 	    $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
   2265 	  done ; \
   2266 	fi
   2267 endif
   2268 
   2269 uninstall-local::
   2270 	$(Echo) Uninstalling include files
   2271 	$(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
   2272 	  cd $(PROJ_SRC_ROOT)/include && \
   2273 	    $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
   2274 	      '!' '(' -name '*~' -o -name '.#*' \
   2275         -o -name '*.in' ')' -print ')' | \
   2276         grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
   2277 	  cd $(PROJ_SRC_ROOT)/include && \
   2278 	    $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
   2279       -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
   2280 	fi
   2281 endif
   2282 endif
   2283 
   2284 check-line-length:
   2285 	@echo searching for overlength lines in files: $(Sources)
   2286 	@echo
   2287 	@echo
   2288 	egrep -n '.{81}' $(Sources) /dev/null
   2289 
   2290 check-for-tabs:
   2291 	@echo searching for tabs in files: $(Sources)
   2292 	@echo
   2293 	@echo
   2294 	egrep -n '	' $(Sources) /dev/null
   2295 
   2296 check-footprint:
   2297 	@ls -l $(LibDir) | awk '\
   2298 	  BEGIN { sum = 0; } \
   2299 	        { sum += $$5; } \
   2300 	  END   { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
   2301 	@ls -l $(ToolDir) | awk '\
   2302 	  BEGIN { sum = 0; } \
   2303 	        { sum += $$5; } \
   2304 	  END   { printf("Programs:  %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
   2305 #------------------------------------------------------------------------
   2306 # Print out the directories used for building
   2307 #------------------------------------------------------------------------
   2308 printvars::
   2309 	$(Echo) "BuildMode    : " '$(BuildMode)'
   2310 	$(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
   2311 	$(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
   2312 	$(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
   2313 	$(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
   2314 	$(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
   2315 	$(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
   2316 	$(Echo) "PROJ_prefix  : " '$(PROJ_prefix)'
   2317 	$(Echo) "PROJ_internal_prefix  : " '$(PROJ_internal_prefix)'
   2318 	$(Echo) "PROJ_bindir  : " '$(PROJ_bindir)'
   2319 	$(Echo) "PROJ_libdir  : " '$(PROJ_libdir)'
   2320 	$(Echo) "PROJ_etcdir  : " '$(PROJ_etcdir)'
   2321 	$(Echo) "PROJ_includedir  : " '$(PROJ_includedir)'
   2322 	$(Echo) "UserTargets  : " '$(UserTargets)'
   2323 	$(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
   2324 	$(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
   2325 	$(Echo) "ObjDir       : " '$(ObjDir)'
   2326 	$(Echo) "LibDir       : " '$(LibDir)'
   2327 	$(Echo) "ToolDir      : " '$(ToolDir)'
   2328 	$(Echo) "ExmplDir     : " '$(ExmplDir)'
   2329 	$(Echo) "Sources      : " '$(Sources)'
   2330 	$(Echo) "TDFiles      : " '$(TDFiles)'
   2331 	$(Echo) "INCFiles     : " '$(INCFiles)'
   2332 	$(Echo) "INCTMPFiles  : " '$(INCTMPFiles)'
   2333 	$(Echo) "PreConditions: " '$(PreConditions)'
   2334 	$(Echo) "Compile.CXX  : " '$(Compile.CXX)'
   2335 	$(Echo) "Compile.C    : " '$(Compile.C)'
   2336 	$(Echo) "Archive      : " '$(Archive)'
   2337 	$(Echo) "YaccFiles    : " '$(YaccFiles)'
   2338 	$(Echo) "LexFiles     : " '$(LexFiles)'
   2339 	$(Echo) "Module       : " '$(Module)'
   2340 	$(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
   2341 	$(Echo) "SubDirs      : " '$(SubDirs)'
   2342 	$(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
   2343 	$(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
   2344 
   2345 ###
   2346 # Debugging
   2347 
   2348 # General debugging rule, use 'make dbg-print-XXX' to print the
   2349 # definition, value and origin of XXX.
   2350 make-print-%:
   2351 	$(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))
   2352