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