1 #===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===#
3 # The LLVM Compiler Infrastructure
5 # This file is distributed under the University of Illinois Open Source
6 # License. See LICENSE.TXT for details.
8 #===------------------------------------------------------------------------===#
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.
13 #===-----------------------------------------------------------------------====#
15 ################################################################################
16 # TARGETS: Define standard targets that can be invoked
17 ################################################################################
19 #--------------------------------------------------------------------
20 # Define the various target sets
21 #--------------------------------------------------------------------
22 RecursiveTargets := all clean clean-all install uninstall install-bytecode \
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 \
29 UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
30 InternalTargets := preconditions distdir dist-hook
32 ################################################################################
33 # INITIALIZATION: Basic things the makefile needs
34 ################################################################################
36 #--------------------------------------------------------------------
37 # Set the VPATH so that we can find source files.
38 #--------------------------------------------------------------------
41 #--------------------------------------------------------------------
42 # Reset the list of suffixes we know how to build.
43 #--------------------------------------------------------------------
45 .SUFFIXES: .c .cpp .cc .h .hpp .o .a .bc .td .ps .dot .ll .m .mm
46 .SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
48 #--------------------------------------------------------------------
49 # Mark all of these targets as phony to avoid implicit rule search
50 #--------------------------------------------------------------------
51 .PHONY: $(UserTargets) $(InternalTargets)
53 #--------------------------------------------------------------------
54 # Make sure all the user-target rules are double colon rules and
55 # they are defined first.
56 #--------------------------------------------------------------------
60 #------------------------------------------------------------------------
61 # LLVMBuild Integration
62 #------------------------------------------------------------------------
64 # We use llvm-build to generate all the data required by the Makefile based
65 # build system in one swoop:
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
71 # - We generate the library table used by llvm-config.
73 # - We generate the dependencies for the Makefile fragment, so that we will
74 # automatically reconfigure outselves.
76 # The path to the llvm-build tool itself.
77 LLVMBuildTool := $(PROJ_SRC_ROOT)/utils/llvm-build/llvm-build
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
84 # This is for temporary backwards compatibility.
85 ifndef TARGET_NATIVE_ARCH
86 TARGET_NATIVE_ARCH := $(ARCH)
89 # The rule to create the LLVMBuild Makefile fragment as well as the llvm-config
92 # Note that this target gets its real dependencies generated for us by
95 # We include a dependency on this Makefile to ensure that changes to the
96 # generation command get picked up.
97 $(LLVMBuildMakeFrag): $(PROJ_SRC_ROOT)/Makefile.rules \
98 $(PROJ_OBJ_ROOT)/Makefile.config
99 $(Echo) Constructing LLVMBuild project information.
100 $(Verb)$(PYTHON) $(LLVMBuildTool) \
101 --native-target "$(TARGET_NATIVE_ARCH)" \
102 --enable-targets "$(TARGETS_TO_BUILD)" \
103 --enable-optional-components "$(OPTIONAL_COMPONENTS)" \
104 --write-library-table $(LLVMConfigLibraryDependenciesInc) \
105 --write-make-fragment $(LLVMBuildMakeFrag)
107 # For completeness, let Make know how the extra files are generated.
108 $(LLVMConfigLibraryDependenciesInc): $(LLVMBuildMakeFrag)
110 # Include the generated Makefile fragment.
112 # We currently only include the dependencies for the fragment itself if we are
113 # at the top-level. Otherwise, recursive invocations would ends up doing
114 # substantially more redundant stat'ing.
116 # This means that we won't properly regenerate things for developers used to
117 # building from a subdirectory, but that is always somewhat unreliable.
119 LLVMBUILD_INCLUDE_DEPENDENCIES := 1
121 # Clean the generated makefile fragment at the top-level.
123 -$(Verb) $(RM) -f $(LLVMBuildMakeFrag)
125 -include $(LLVMBuildMakeFrag)
127 ################################################################################
128 # PRECONDITIONS: that which must be built/checked first
129 ################################################################################
131 SrcMakefiles := $(filter %Makefile %Makefile.tests,\
132 $(wildcard $(PROJ_SRC_DIR)/Makefile*))
133 ObjMakefiles := $(subst $(PROJ_SRC_DIR),$(PROJ_OBJ_DIR),$(SrcMakefiles))
134 ConfigureScript := $(PROJ_SRC_ROOT)/configure
135 ConfigStatusScript := $(PROJ_OBJ_ROOT)/config.status
136 MakefileConfigIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.config.in))
137 MakefileCommonIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.common.in))
138 MakefileConfig := $(PROJ_OBJ_ROOT)/Makefile.config
139 MakefileCommon := $(PROJ_OBJ_ROOT)/Makefile.common
140 PreConditions := $(ConfigStatusScript) $(ObjMakefiles)
141 ifneq ($(MakefileCommonIn),)
142 PreConditions += $(MakefileCommon)
145 ifneq ($(MakefileConfigIn),)
146 PreConditions += $(MakefileConfig)
149 preconditions: $(PreConditions)
151 #------------------------------------------------------------------------
152 # Make sure the BUILT_SOURCES are built first
153 #------------------------------------------------------------------------
154 $(filter-out clean clean-local,$(UserTargets)):: $(BUILT_SOURCES)
157 ifneq ($(strip $(BUILT_SOURCES)),)
158 -$(Verb) $(RM) -f $(BUILT_SOURCES)
161 ifneq ($(PROJ_OBJ_ROOT),$(PROJ_SRC_ROOT))
163 $(Verb) if test -x config.status ; then \
164 $(EchoCmd) Wiping out $(PROJ_OBJ_ROOT) ; \
165 $(MKDIR) .spotless.save ; \
166 $(MV) config.status .spotless.save ; \
167 $(MV) mklib .spotless.save ; \
168 $(MV) projects .spotless.save ; \
170 $(MV) .spotless.save/config.status . ; \
171 $(MV) .spotless.save/mklib . ; \
172 $(MV) .spotless.save/projects . ; \
173 $(RM) -rf .spotless.save ; \
174 $(EchoCmd) Rebuilding configuration of $(PROJ_OBJ_ROOT) ; \
175 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
176 $(ConfigStatusScript) ; \
178 $(EchoCmd) "make spotless" can only be run from $(PROJ_OBJ_ROOT); \
182 $(EchoCmd) "spotless target not supported for objdir == srcdir"
185 $(BUILT_SOURCES) : $(ObjMakefiles)
187 #------------------------------------------------------------------------
188 # Make sure we're not using a stale configuration
189 #------------------------------------------------------------------------
191 $(Echo) Reconfiguring $(PROJ_OBJ_ROOT)
192 $(Verb) cd $(PROJ_OBJ_ROOT) && \
193 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
194 $(ConfigStatusScript)
196 .PRECIOUS: $(ConfigStatusScript)
197 $(ConfigStatusScript): $(ConfigureScript)
198 $(Echo) Reconfiguring with $<
199 $(Verb) cd $(PROJ_OBJ_ROOT) && \
200 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
201 $(ConfigStatusScript)
203 #------------------------------------------------------------------------
204 # Make sure the configuration makefile is up to date
205 #------------------------------------------------------------------------
206 ifneq ($(MakefileConfigIn),)
207 $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
208 $(Echo) Regenerating $@
209 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
212 ifneq ($(MakefileCommonIn),)
213 $(MakefileCommon): $(MakefileCommonIn) $(ConfigStatusScript)
214 $(Echo) Regenerating $@
215 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.common
218 #------------------------------------------------------------------------
219 # If the Makefile in the source tree has been updated, copy it over into the
220 # build tree. But, only do this if the source and object makefiles differ
221 #------------------------------------------------------------------------
223 PROJ_MAKEFILE := $(PROJ_SRC_DIR)/Makefile
226 ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
228 Makefile: $(PROJ_MAKEFILE) $(ExtraMakefiles)
229 $(Echo) "Updating Makefile"
230 $(Verb) $(MKDIR) $(@D)
231 $(Verb) $(CP) -f $< $@
233 # Copy the Makefile.* files unless we're in the root directory which avoids
234 # the copying of Makefile.config.in or other things that should be explicitly
236 $(PROJ_OBJ_DIR)/Makefile% : $(PROJ_MAKEFILE)%
238 *Makefile.rules) ;; \
240 *) $(EchoCmd) "Updating $(@F)" ; \
247 #------------------------------------------------------------------------
248 # Set up the basic dependencies
249 #------------------------------------------------------------------------
250 $(UserTargets):: $(PreConditions)
254 clean-all:: clean-local clean-all-local
255 install:: install-local
256 uninstall:: uninstall-local
257 install-local:: all-local
258 install-bytecode:: install-bytecode-local
260 ###############################################################################
261 # VARIABLES: Set up various variables based on configuration data
262 ###############################################################################
264 # Variable for if this make is for a "cleaning" target
265 ifneq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),)
269 #--------------------------------------------------------------------
270 # Variables derived from configuration we are building
271 #--------------------------------------------------------------------
274 ifeq ($(ENABLE_OPTIMIZED),1)
276 # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
277 ifneq ($(HOST_OS),FreeBSD)
278 ifneq ($(HOST_OS),Darwin)
279 OmitFramePointer := -fomit-frame-pointer
283 # Darwin requires -fstrict-aliasing to be explicitly enabled.
284 # Avoid -fstrict-aliasing on Darwin for now, there are unresolved issues
285 # with -fstrict-aliasing and ipa-type-escape radr://6756684
286 #ifeq ($(HOST_OS),Darwin)
287 # EXTRA_OPTIONS += -fstrict-aliasing -Wstrict-aliasing
289 CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
290 C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
291 LD.Flags += $(OPTIMIZE_OPTION)
293 BuildMode := $(BuildMode)+Debug
300 ifdef NO_DEBUG_SYMBOLS
301 BuildMode := Unoptimized
315 ifeq ($(ENABLE_LIBCPP),1)
316 CXX.Flags += -stdlib=libc++
317 LD.Flags += -stdlib=libc++
320 ifeq ($(ENABLE_CXX11),1)
321 CXX.Flags += -std=c++11
324 ifeq ($(ENABLE_WERROR),1)
329 ifeq ($(ENABLE_PROFILING),1)
330 BuildMode := $(BuildMode)+Profile
331 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
332 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) -pg -g
333 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg -g
337 ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
338 CXX.Flags += -fvisibility-inlines-hidden
341 ifdef ENABLE_EXPENSIVE_CHECKS
342 # GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above.
343 # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40160
347 # IF REQUIRES_EH=1 is specified then don't disable exceptions
349 CXX.Flags += -fno-exceptions
351 # If the library requires EH, it also requires RTTI.
355 ifdef REQUIRES_FRAME_POINTER
356 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags))
357 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags))
358 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags))
361 # If REQUIRES_RTTI=1 is specified then don't disable run-time type id.
362 ifneq ($(REQUIRES_RTTI), 1)
363 CXX.Flags += -fno-rtti
366 ifeq ($(ENABLE_COVERAGE),1)
367 BuildMode := $(BuildMode)+Coverage
368 CXX.Flags += -ftest-coverage -fprofile-arcs
369 C.Flags += -ftest-coverage -fprofile-arcs
372 # If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
373 # then disable assertions by defining the appropriate preprocessor symbols.
374 ifeq ($(DISABLE_ASSERTIONS),1)
375 CPP.Defines += -DNDEBUG
377 BuildMode := $(BuildMode)+Asserts
378 CPP.Defines += -D_DEBUG
381 # If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
382 # configured), then enable expensive checks by defining the
383 # appropriate preprocessor symbols.
384 ifeq ($(ENABLE_EXPENSIVE_CHECKS),1)
385 BuildMode := $(BuildMode)+Checks
386 CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
389 # LOADABLE_MODULE implies several other things so we force them to be
391 ifdef LOADABLE_MODULE
393 LINK_LIBS_IN_SHARED := 1
401 ifeq ($(ENABLE_PIC),1)
402 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
403 # Nothing. Win32 defaults to PIC and warns when given -fPIC
405 ifeq ($(HOST_OS),Darwin)
406 # Common symbols not allowed in dylib files
407 CXX.Flags += -fno-common
408 C.Flags += -fno-common
410 # Linux and others; pass -fPIC
416 ifeq ($(HOST_OS),Darwin)
417 CXX.Flags += -mdynamic-no-pic
418 C.Flags += -mdynamic-no-pic
422 # Support makefile variable to disable any kind of timestamp/non-deterministic
423 # info from being used in the build.
424 ifeq ($(ENABLE_TIMESTAMPS),1)
425 DOTDIR_TIMESTAMP_COMMAND := $(DATE)
427 DOTDIR_TIMESTAMP_COMMAND := echo 'Created.'
430 ifeq ($(HOST_OS),MingW)
432 CPP.Defines += -D__NO_CTYPE_INLINE
433 ifeq ($(LLVM_CROSS_COMPILING),1)
434 # Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016
436 LD.Flags += -Wl,--allow-multiple-definition
441 CXX.Flags += -Woverloaded-virtual
442 CPP.BaseFlags += $(CPP.Defines)
445 # Make Floating point IEEE compliant on Alpha.
448 CPP.BaseFlags += -mieee
449 ifeq ($(ENABLE_PIC),0)
451 CPP.BaseFlags += -fPIC
454 LD.Flags += -Wl,--no-relax
457 # GNU ld/PECOFF accepts but ignores them below;
461 # FIXME: autoconf should be aware of them.
462 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
463 HAVE_LINK_VERSION_SCRIPT := 0
465 RDYNAMIC := -Wl,--export-all-symbols
468 #--------------------------------------------------------------------
469 # Directory locations
470 #--------------------------------------------------------------------
472 ifeq ($(LLVM_CROSS_COMPILING),1)
473 BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin
476 ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode)
477 ObjDir := $(ObjRootDir)
478 LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
479 ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
480 ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
481 LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
482 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
483 LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
485 #--------------------------------------------------------------------
486 # Locations of shared libraries
487 #--------------------------------------------------------------------
490 SharedLibDir := $(LibDir)
491 LLVMSharedLibDir := $(LLVMLibDir)
493 # Win32.DLL prefers to be located on the "PATH" of binaries.
494 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
495 SharedLibDir := $(ToolDir)
496 LLVMSharedLibDir := $(LLVMToolDir)
498 ifeq ($(HOST_OS),Cygwin)
505 #--------------------------------------------------------------------
506 # LLVM Capable Compiler
507 #--------------------------------------------------------------------
509 ifneq ($(findstring llvm-gcc,$(LLVMCC_OPTION)),)
511 LLVMCXX := $(LLVMGXX)
513 ifneq ($(findstring clang,$(LLVMCC_OPTION)),)
514 ifneq ($(CLANGPATH),)
515 LLVMCC := $(CLANGPATH)
516 LLVMCXX := $(CLANGXXPATH)
518 ifeq ($(ENABLE_BUILT_CLANG),1)
519 LLVMCC := $(LLVMToolDir)/clang
520 LLVMCXX := $(LLVMToolDir)/clang++
526 #--------------------------------------------------------------------
527 # Full Paths To Compiled Tools and Utilities
528 #--------------------------------------------------------------------
529 EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
530 ifdef BUILD_DIRS_ONLY
531 EchoCmd := $(EchoCmd) "(build tools)":
536 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
539 ifeq ($(LLVM_CROSS_COMPILING),1)
540 LLVM_TBLGEN := $(BuildLLVMToolDir)/llvm-tblgen$(BUILD_EXEEXT)
542 LLVM_TBLGEN := $(LLVMToolDir)/llvm-tblgen$(EXEEXT)
545 ifeq ($(LLVM_CROSS_COMPILING),1)
546 LLVM_CONFIG := $(BuildLLVMToolDir)/llvm-config$(BUILD_EXEEXT)
548 LLVM_CONFIG := $(LLVMToolDir)/llvm-config$(EXEEXT)
551 LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
554 LLI := $(LLVMToolDir)/lli$(EXEEXT)
557 LLC := $(LLVMToolDir)/llc$(EXEEXT)
560 LOPT := $(LLVMToolDir)/opt$(EXEEXT)
563 LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
566 LLVMLINK := $(LLVMToolDir)/llvm-link$(EXEEXT)
569 #--------------------------------------------------------------------
570 # Adjust to user's request
571 #--------------------------------------------------------------------
573 ifeq ($(HOST_OS),Darwin)
574 ifdef MACOSX_DEPLOYMENT_TARGET
575 DARWIN_VERSION := $(MACOSX_DEPLOYMENT_TARGET)
577 DARWIN_VERSION := `sw_vers -productVersion`
579 # Strip a number like 10.4.7 to 10.4
580 DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/')
581 # Get "4" out of 10.4 for later pieces in the makefile.
582 DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
584 LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress
585 SharedLinkOptions := -dynamiclib
586 ifdef DEPLOYMENT_TARGET
587 SharedLinkOptions += $(DEPLOYMENT_TARGET)
590 SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
594 SharedLinkOptions=-shared
597 ifeq ($(TARGET_OS),Darwin)
598 ifdef DEPLOYMENT_TARGET
599 TargetCommonOpts += $(DEPLOYMENT_TARGET)
602 TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
608 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
609 ifneq ($(HOST_OS),Darwin)
610 LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
622 # Adjust settings for verbose mode
625 AR.Flags += >/dev/null 2>/dev/null
626 ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
628 ConfigureScriptFLAGS :=
631 # By default, strip symbol information from executable
633 Strip := $(PLATFORMSTRIPOPTS)
634 StripWarnMsg := "(without symbols)"
635 Install.StripFlag += -s
638 ifdef TOOL_NO_EXPORTS
641 DynamicFlag := $(RDYNAMIC)
644 # Adjust linker flags for building an executable
645 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
646 ifneq ($(HOST_OS), Darwin)
648 LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
650 LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
652 LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
656 ifneq ($(DARWIN_MAJVERS),4)
657 LD.Flags += $(RPATH) -Wl,@executable_path/../lib
659 ifeq ($(RC_BUILDIT),YES)
660 TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX)
661 LD.Flags += -Wl,-object_path_lto -Wl,$(TempFile)
667 #----------------------------------------------------------
668 # Options To Invoke Tools
669 #----------------------------------------------------------
671 ifdef EXTRA_LD_OPTIONS
672 LD.Flags += $(EXTRA_LD_OPTIONS)
676 CompileCommonOpts += -pedantic -Wno-long-long $(NO_NESTED_ANON_TYPES)
678 CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
679 $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT) \
680 $(NO_UNINITIALIZED) $(NO_MAYBE_UNINITIALIZED) \
681 $(NO_MISSING_FIELD_INITIALIZERS)
682 # Enable cast-qual for C++; the workaround is to use const_cast.
683 CXX.Flags += -Wcast-qual
685 ifeq ($(HOST_OS),HP-UX)
686 CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
689 # If we are building a universal binary on Mac OS/X, pass extra options. This
690 # is useful to people that want to link the LLVM libraries into their universal
693 # The following can be optionally specified:
694 # UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
695 # For Mac OS/X 10.4 Intel machines, the traditional one is:
696 # UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
697 # UNIVERSAL_ARCH can be optionally specified to be a list of architectures
698 # to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64". This defaults to
701 ifndef UNIVERSAL_ARCH
702 UNIVERSAL_ARCH := i386 ppc
704 UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
705 CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
706 ifdef UNIVERSAL_SDK_PATH
707 CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
710 # Building universal cannot compute dependencies automatically.
711 DISABLE_AUTO_DEPENDENCIES=1
713 ifeq ($(TARGET_OS),Darwin)
714 ifeq ($(ARCH),x86_64)
715 TargetCommonOpts = -m64
718 TargetCommonOpts = -m32
724 ifeq ($(HOST_OS),SunOS)
725 CPP.BaseFlags += -include llvm/Support/Solaris.h
728 ifeq ($(HOST_OS),AuroraUX)
729 CPP.BaseFlags += -include llvm/Support/Solaris.h
730 endif # !HOST_OS - AuroraUX.
732 # On Windows, SharedLibDir != LibDir. The order is important.
733 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
734 LD.Flags += -L$(SharedLibDir) -L$(LibDir) -L$(LLVMToolDir) -L$(LLVMLibDir)
736 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
739 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
740 # All -I flags should go here, so that they don't confuse llvm-config.
741 CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
742 $(patsubst %,-I%/include,\
743 $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
744 $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
747 ifeq ($(INCLUDE_BUILD_DIR),1)
748 CPP.Flags += -I$(ObjDir)
751 # SHOW_DIAGNOSTICS support.
752 ifeq ($(SHOW_DIAGNOSTICS),1)
753 Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
754 CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
759 Compile.C = $(Compile.Wrapper) \
760 $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
761 $(TargetCommonOpts) $(CompileCommonOpts) -c
762 Compile.CXX = $(Compile.Wrapper) \
763 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
764 $(TargetCommonOpts) $(CompileCommonOpts) -c
765 Preprocess.CXX= $(Compile.Wrapper) \
766 $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
767 $(CompileCommonOpts) $(CXX.Flags) -E
768 Link = $(Compile.Wrapper) \
769 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
770 $(LDFLAGS) $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
772 BCCompile.C = $(LLVMCC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
773 $(TargetCommonOpts) $(CompileCommonOpts)
774 Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
775 $(TargetCommonOpts) $(CompileCommonOpts) -E
777 BCCompile.CXX = $(LLVMCXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
778 $(TargetCommonOpts) $(CompileCommonOpts)
780 ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
781 ScriptInstall = $(INSTALL) -m 0755
782 DataInstall = $(INSTALL) -m 0644
784 # When compiling under Mingw/Cygwin, the tblgen tool expects Windows
785 # paths. In this case, the SYSPATH function (defined in
786 # Makefile.config) transforms Unix paths into Windows paths.
787 TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
788 -I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
789 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
790 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
791 LLVMTableGen = $(LLVM_TBLGEN) $(TableGen.Flags)
793 Archive = $(AR) $(AR.Flags)
794 LArchive = $(LLVMToolDir)/llvm-ar rcsf
803 #----------------------------------------------------------
804 # Get the list of source files and compute object file
806 #----------------------------------------------------------
809 Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
810 $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
812 Sources := $(SOURCES)
816 Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
819 BaseNameSources := $(sort $(basename $(Sources)))
821 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
822 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
824 #----------------------------------------------------------
825 # For Mingw MSYS bash and Python/w32:
827 # $(ECHOPATH) prints DOSish pathstring.
828 # ex) $(ECHOPATH) /include/sys/types.h
829 # --> C:/mingw/include/sys/types.h
830 # built-in "echo" does not transform path to DOSish path.
832 # FIXME: It would not be needed when MSYS's python
834 #----------------------------------------------------------
836 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
837 ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])"
839 ECHOPATH := $(Verb)$(ECHO)
842 ###############################################################################
843 # DIRECTORIES: Handle recursive descent of directory structure
844 ###############################################################################
846 #---------------------------------------------------------
847 # Provide rules to make install dirs. This must be early
848 # in the file so they get built before dependencies
849 #---------------------------------------------------------
851 $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
854 # To create other directories, as needed, and timestamp their creation
856 $(Verb) $(MKDIR) $* > /dev/null
857 $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
859 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
860 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
862 #---------------------------------------------------------
863 # Handle the DIRS options for sequential construction
864 #---------------------------------------------------------
870 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
871 $(RecursiveTargets)::
872 $(Verb) for dir in $(DIRS); do \
873 if ([ ! -f $$dir/Makefile ] || \
874 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
876 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
878 ($(MAKE) -C $$dir $@ ) || exit 1; \
881 $(RecursiveTargets)::
882 $(Verb) for dir in $(DIRS); do \
883 ($(MAKE) -C $$dir $@ ) || exit 1; \
889 #---------------------------------------------------------
890 # Handle the EXPERIMENTAL_DIRS options ensuring success
891 # after each directory is built.
892 #---------------------------------------------------------
893 ifdef EXPERIMENTAL_DIRS
894 $(RecursiveTargets)::
895 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
896 if ([ ! -f $$dir/Makefile ] || \
897 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
899 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
901 ($(MAKE) -C $$dir $@ ) || exit 0; \
905 #-----------------------------------------------------------
906 # Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
907 #-----------------------------------------------------------
908 ifdef OPTIONAL_PARALLEL_DIRS
909 PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) -o -f $(T)/Makefile && echo "$(T)"))
912 #-----------------------------------------------------------
913 # Handle the PARALLEL_DIRS options for parallel construction
914 #-----------------------------------------------------------
917 SubDirs += $(PARALLEL_DIRS)
919 # Unfortunately, this list must be maintained if new recursive targets are added
920 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
921 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
922 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
923 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
924 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
925 install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
926 unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS))
928 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
932 SD=$(PROJ_SRC_DIR)/$(@D); \
934 if [ ! -f $$SD/Makefile ]; then \
936 DD=$(notdir $(@D)); \
938 if ([ ! -f $$DD/Makefile ] || \
939 command test $$DD/Makefile -ot \
940 $$SD/Makefile ); then \
942 $(CP) $$SD/Makefile $$DD/Makefile; \
944 $(MAKE) -C $$DD $(subst $(@D)/.make,,$@)
947 #---------------------------------------------------------
948 # Handle the OPTIONAL_DIRS options for directores that may
950 #---------------------------------------------------------
953 SubDirs += $(OPTIONAL_DIRS)
955 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
956 $(RecursiveTargets)::
957 $(Verb) for dir in $(OPTIONAL_DIRS); do \
958 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
959 if ([ ! -f $$dir/Makefile ] || \
960 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
962 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
964 ($(MAKE) -C$$dir $@ ) || exit 1; \
968 $(RecursiveTargets)::
969 $(Verb) for dir in $(OPTIONAL_DIRS); do \
970 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
971 ($(MAKE) -C$$dir $@ ) || exit 1; \
977 #---------------------------------------------------------
978 # Handle the CONFIG_FILES options
979 #---------------------------------------------------------
984 $(Echo) Install circumvented with NO_INSTALL
986 $(Echo) UnInstall circumvented with NO_INSTALL
988 install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
989 $(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir)
990 $(Verb)for file in $(CONFIG_FILES); do \
991 if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
992 $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
993 elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
994 $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
996 $(ECHO) Error: cannot find config file $${file}. ; \
1001 $(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
1002 $(Verb)for file in $(CONFIG_FILES); do \
1003 $(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
1009 ###############################################################################
1010 # Set up variables for building libraries
1011 ###############################################################################
1013 #---------------------------------------------------------
1014 # Define various command line options pertaining to the
1015 # libraries needed when linking. There are "Proj" libs
1016 # (defined by the user's project) and "LLVM" libs (defined
1017 # by the LLVM project).
1018 #---------------------------------------------------------
1021 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
1022 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
1023 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
1024 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
1028 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
1029 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
1030 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
1031 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
1034 # Loadable module for Win32 requires all symbols resolved for linking.
1035 # Then all symbols in LLVM.dll will be available.
1036 ifeq ($(ENABLE_SHARED),1)
1037 ifdef LOADABLE_MODULE
1038 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
1039 LINK_COMPONENTS += all
1044 ifndef IS_CLEANING_TARGET
1045 ifdef LINK_COMPONENTS
1047 # If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make
1048 # clean in tools, then do a make in tools (instead of at the top level).
1050 @echo "*** llvm-config doesn't exist - rebuilding it."
1051 @$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config
1053 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
1055 ifeq ($(ENABLE_SHARED), 1)
1056 # We can take the "auto-import" feature to get rid of using dllimport.
1057 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1058 LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
1061 LLVMLibsOptions += -lLLVM-$(LLVMVersion)
1062 LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT)
1065 ifndef NO_LLVM_CONFIG
1066 LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)
1067 ifeq ($(LLVMConfigLibs),Error)
1068 $(error llvm-config --libs failed)
1070 LLVMLibsOptions += $(LLVMConfigLibs)
1071 LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error)
1072 ifeq ($(LLVMConfigLibfiles),Error)
1073 $(error llvm-config --libfiles failed)
1075 LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles)
1082 # Set up the library exports file.
1083 ifdef EXPORTED_SYMBOL_FILE
1085 # First, set up the native export file, which may differ from the source
1088 ifeq ($(HOST_OS),Darwin)
1089 # Darwin convention prefixes symbols with underscores.
1090 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed
1091 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1092 $(Verb) sed -e 's/^/_/' < $< > $@
1094 -$(Verb) $(RM) -f $(NativeExportsFile)
1096 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1097 # Gold and BFD ld require a version script rather than a plain list.
1098 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
1099 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1100 $(Verb) echo "{" > $@
1101 $(Verb) grep -q '[[:alnum:]_]' $< && echo " global:" >> $@ || :
1102 $(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@
1103 ifneq ($(HOST_OS),OpenBSD)
1104 $(Verb) echo " local: *;" >> $@
1106 $(Verb) echo "};" >> $@
1108 -$(Verb) $(RM) -f $(NativeExportsFile)
1110 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1111 # GNU ld Win32 accepts .DEF files that contain "DATA" entries.
1112 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def))
1113 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1114 $(Echo) Generating $(notdir $@)
1115 $(Verb) $(ECHO) "EXPORTS" > $@
1116 $(Verb) $(CAT) $< >> $@
1118 -$(Verb) $(RM) -f $(NativeExportsFile)
1120 # Default behavior: just use the exports file verbatim.
1121 NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
1126 # Now add the linker command-line options to use the native export file.
1129 ifeq ($(HOST_OS),Darwin)
1130 LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
1133 # gold, bfd ld, etc.
1134 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1135 LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
1139 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1140 # LLVMLibsOptions is invalidated at processing tools/llvm-shlib.
1141 SharedLinkOptions += $(NativeExportsFile)
1146 ###############################################################################
1147 # Library Build Rules: Four ways to build a library
1148 ###############################################################################
1150 #---------------------------------------------------------
1151 # Bytecode Module Targets:
1152 # If the user set MODULE_NAME then they want to build a
1153 # bytecode module from the sources. We compile all the
1154 # sources and link it together into a single bytecode
1156 #---------------------------------------------------------
1159 ifeq ($(strip $(LLVMCC)),)
1160 $(warning Modules require LLVM capable compiler but none is available ****)
1163 Module := $(LibDir)/$(MODULE_NAME).bc
1164 LinkModule := $(LLVMLINK)
1167 ifdef EXPORTED_SYMBOL_FILE
1168 LinkModule += -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1171 $(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(LLVMLINK)
1172 $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
1173 $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
1175 all-local:: $(Module)
1178 ifneq ($(strip $(Module)),)
1179 -$(Verb) $(RM) -f $(Module)
1182 ifdef BYTECODE_DESTINATION
1183 ModuleDestDir := $(BYTECODE_DESTINATION)
1185 ModuleDestDir := $(DESTDIR)$(PROJ_libdir)
1190 $(Echo) Install circumvented with NO_INSTALL
1192 $(Echo) Uninstall circumvented with NO_INSTALL
1194 DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
1196 install-module:: $(DestModule)
1197 install-local:: $(DestModule)
1199 $(DestModule): $(ModuleDestDir) $(Module)
1200 $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
1201 $(Verb) $(DataInstall) $(Module) $(DestModule)
1204 $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
1205 -$(Verb) $(RM) -f $(DestModule)
1211 # if we're building a library ...
1214 # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option
1215 LIBRARYNAME := $(strip $(LIBRARYNAME))
1216 ifdef LOADABLE_MODULE
1217 BaseLibName.A := $(LIBRARYNAME).a
1218 BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT)
1220 BaseLibName.A := lib$(LIBRARYNAME).a
1221 BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
1223 LibName.A := $(LibDir)/$(BaseLibName.A)
1224 LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
1225 LibName.O := $(LibDir)/$(LIBRARYNAME).o
1226 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
1228 #---------------------------------------------------------
1229 # Shared Library Targets:
1230 # If the user asked for a shared library to be built
1231 # with the SHARED_LIBRARY variable, then we provide
1232 # targets for building them.
1233 #---------------------------------------------------------
1234 ifdef SHARED_LIBRARY
1236 all-local:: $(LibName.SO)
1238 ifdef EXPORTED_SYMBOL_FILE
1239 $(LibName.SO): $(NativeExportsFile)
1242 ifdef LINK_LIBS_IN_SHARED
1243 ifdef LOADABLE_MODULE
1244 SharedLibKindMessage := "Loadable Module"
1245 SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions)
1247 SharedLibKindMessage := "Shared Library"
1249 $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
1250 $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
1252 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
1253 $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
1255 $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
1256 $(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
1257 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
1261 ifneq ($(strip $(LibName.SO)),)
1262 -$(Verb) $(RM) -f $(LibName.SO)
1267 $(Echo) Install circumvented with NO_INSTALL
1269 $(Echo) Uninstall circumvented with NO_INSTALL
1272 # Win32.DLL prefers to be located on the "PATH" of binaries.
1273 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1274 DestSharedLibDir := $(DESTDIR)$(PROJ_bindir)
1276 DestSharedLibDir := $(DESTDIR)$(PROJ_libdir)
1278 DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
1280 install-local:: $(DestSharedLib)
1282 $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir)
1283 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
1284 $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
1287 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
1288 -$(Verb) $(RM) -f $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME).*
1292 #---------------------------------------------------------
1293 # Bytecode Library Targets:
1294 # If the user asked for a bytecode library to be built
1295 # with the BYTECODE_LIBRARY variable, then we provide
1296 # targets for building them.
1297 #---------------------------------------------------------
1298 ifdef BYTECODE_LIBRARY
1299 ifeq ($(strip $(LLVMCC)),)
1300 $(warning Bytecode libraries require LLVM capable compiler but none is available ****)
1303 all-local:: $(LibName.BCA)
1305 ifdef EXPORTED_SYMBOL_FILE
1306 BCLinkLib = $(LLVMLINK) -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1308 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLINK) \
1309 $(LLVMToolDir)/llvm-ar
1310 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
1312 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).internalize $(ObjectsBC)
1314 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).internalize.bc
1316 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
1317 $(LLVMToolDir)/llvm-ar
1318 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
1320 $(Verb) $(LArchive) $@ $(ObjectsBC)
1325 ifneq ($(strip $(LibName.BCA)),)
1326 -$(Verb) $(RM) -f $(LibName.BCA)
1329 ifdef BYTECODE_DESTINATION
1330 BytecodeDestDir := $(BYTECODE_DESTINATION)
1332 BytecodeDestDir := $(DESTDIR)$(PROJ_libdir)
1335 DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).bca
1337 install-bytecode-local:: $(DestBytecodeLib)
1341 $(Echo) Install circumvented with NO_INSTALL
1343 $(Echo) Uninstall circumvented with NO_INSTALL
1345 install-local:: $(DestBytecodeLib)
1347 $(DestBytecodeLib): $(LibName.BCA) $(BytecodeDestDir)
1348 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1349 $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
1352 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1353 -$(Verb) $(RM) -f $(DestBytecodeLib)
1358 #---------------------------------------------------------
1360 # If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
1361 # building an archive.
1362 #---------------------------------------------------------
1363 ifndef NO_BUILD_ARCHIVE
1364 ifndef BUILD_ARCHIVE
1365 ifndef LOADABLE_MODULE
1371 #---------------------------------------------------------
1372 # Archive Library Targets:
1373 # If the user wanted a regular archive library built,
1374 # then we provide targets for building them.
1375 #---------------------------------------------------------
1378 all-local:: $(LibName.A)
1380 $(LibName.A): $(ObjectsO) $(LibDir)/.dir
1381 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
1382 -$(Verb) $(RM) -f $@
1383 $(Verb) $(Archive) $@ $(ObjectsO)
1384 $(Verb) $(Ranlib) $@
1387 ifneq ($(strip $(LibName.A)),)
1388 -$(Verb) $(RM) -f $(LibName.A)
1393 $(Echo) Install circumvented with NO_INSTALL
1395 $(Echo) Uninstall circumvented with NO_INSTALL
1397 ifdef NO_INSTALL_ARCHIVES
1399 $(Echo) Install circumvented with NO_INSTALL
1401 $(Echo) Uninstall circumvented with NO_INSTALL
1403 DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a
1405 install-local:: $(DestArchiveLib)
1407 $(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
1408 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
1409 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
1410 $(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
1413 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
1414 -$(Verb) $(RM) -f $(DestArchiveLib)
1422 ###############################################################################
1423 # Tool Build Rules: Build executable tool based on TOOLNAME option
1424 ###############################################################################
1428 #---------------------------------------------------------
1429 # Set up variables for building a tool.
1430 #---------------------------------------------------------
1431 TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
1433 ToolBuildPath := $(ExmplDir)/$(TOOLEXENAME)
1435 ToolBuildPath := $(ToolDir)/$(TOOLEXENAME)
1438 # TOOLALIAS is a name to symlink (or copy) the tool to.
1441 ToolAliasBuildPath := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1443 ToolAliasBuildPath := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1447 #---------------------------------------------------------
1449 #---------------------------------------------------------
1451 # If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
1452 # not exporting all of the weak symbols from the binary. This reduces dyld
1453 # startup time by 4x on darwin in some cases.
1454 ifdef TOOL_NO_EXPORTS
1455 ifeq ($(HOST_OS),Darwin)
1457 # Tiger tools don't support this.
1458 ifneq ($(DARWIN_MAJVERS),4)
1459 LD.Flags += -Wl,-exported_symbol,_main
1463 ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU))
1464 ifneq ($(ARCH), Mips)
1465 LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
1470 #---------------------------------------------------------
1471 # Tool Order File Support
1472 #---------------------------------------------------------
1474 ifeq ($(HOST_OS),Darwin)
1475 ifdef TOOL_ORDER_FILE
1477 LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
1482 #---------------------------------------------------------
1483 # Tool Version Info Support
1484 #---------------------------------------------------------
1486 ifeq ($(HOST_OS),Darwin)
1487 ifdef TOOL_INFO_PLIST
1489 LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST)
1491 $(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST)
1493 $(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir
1494 $(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..."
1495 $(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \
1496 -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \
1497 -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \
1498 -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \
1504 #---------------------------------------------------------
1505 # Provide targets for building the tools
1506 #---------------------------------------------------------
1507 all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
1510 ifneq ($(strip $(ToolBuildPath)),)
1511 -$(Verb) $(RM) -f $(ToolBuildPath)
1513 ifneq ($(strip $(ToolAliasBuildPath)),)
1514 -$(Verb) $(RM) -f $(ToolAliasBuildPath)
1518 $(ToolBuildPath): $(ExmplDir)/.dir
1520 $(ToolBuildPath): $(ToolDir)/.dir
1523 ifdef CODESIGN_TOOLS
1524 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1525 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1526 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1527 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1528 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1530 $(Echo) ======= Code-Signing $(BuildMode) Executable $(TOOLNAME)
1531 $(Verb) codesign -s - $@
1533 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1534 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1535 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1536 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1537 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1541 ifneq ($(strip $(ToolAliasBuildPath)),)
1542 $(ToolAliasBuildPath): $(ToolBuildPath)
1543 $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
1544 $(Verb) $(RM) -f $(ToolAliasBuildPath)
1545 $(Verb) $(AliasTool) $(notdir $(ToolBuildPath)) $(ToolAliasBuildPath)
1546 $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
1552 $(Echo) Install circumvented with NO_INSTALL
1554 $(Echo) Uninstall circumvented with NO_INSTALL
1558 ToolBinDir = $(DESTDIR)$(PROJ_internal_prefix)/bin
1560 ToolBinDir = $(DESTDIR)$(PROJ_bindir)
1562 DestTool = $(ToolBinDir)/$(program_prefix)$(TOOLEXENAME)
1564 install-local:: $(DestTool)
1566 $(DestTool): $(ToolBuildPath)
1567 $(Echo) Installing $(BuildMode) $(DestTool)
1568 $(Verb) $(MKDIR) $(ToolBinDir)
1569 $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
1572 $(Echo) Uninstalling $(BuildMode) $(DestTool)
1573 -$(Verb) $(RM) -f $(DestTool)
1575 # TOOLALIAS install.
1577 DestToolAlias = $(ToolBinDir)/$(program_prefix)$(TOOLALIAS)$(EXEEXT)
1579 install-local:: $(DestToolAlias)
1581 $(DestToolAlias): $(DestTool)
1582 $(Echo) Installing $(BuildMode) $(DestToolAlias)
1583 $(Verb) $(RM) -f $(DestToolAlias)
1584 $(Verb) $(AliasTool) $(notdir $(DestTool)) $(DestToolAlias)
1587 $(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
1588 -$(Verb) $(RM) -f $(DestToolAlias)
1594 ###############################################################################
1595 # Object Build Rules: Build object files based on sources
1596 ###############################################################################
1598 # FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
1599 ifeq ($(HOST_OS),HP-UX)
1600 DISABLE_AUTO_DEPENDENCIES=1
1603 # Provide rule sets for when dependency generation is enabled
1604 ifndef DISABLE_AUTO_DEPENDENCIES
1606 #---------------------------------------------------------
1607 # Create .o files in the ObjDir directory from the .cpp and .c files...
1608 #---------------------------------------------------------
1610 DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
1611 -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
1613 # If the build succeeded, move the dependency file over, otherwise
1615 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
1616 else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
1618 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1619 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1620 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1623 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1624 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1625 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1628 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1629 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1630 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1633 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1634 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1635 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1638 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1639 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1640 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1643 #---------------------------------------------------------
1644 # Create .bc files in the ObjDir directory from .cpp .cc and .c files...
1645 #---------------------------------------------------------
1647 BC_DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.bc.d.tmp" \
1648 -MT "$(ObjDir)/$*.ll" -MT "$(ObjDir)/$*.bc.d"
1650 # If the build succeeded, move the dependency file over, otherwise
1652 BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d"; \
1653 else $(RM) "$(ObjDir)/$*.bc.d.tmp"; exit 1; fi
1655 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1656 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1657 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1658 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1659 $(BC_DEPEND_MOVEFILE)
1661 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1662 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1663 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1664 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1665 $(BC_DEPEND_MOVEFILE)
1667 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1668 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1669 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1670 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1671 $(BC_DEPEND_MOVEFILE)
1673 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1674 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1675 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1676 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1677 $(BC_DEPEND_MOVEFILE)
1679 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1680 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1681 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1682 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1683 $(BC_DEPEND_MOVEFILE)
1685 # Provide alternate rule sets if dependencies are disabled
1688 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1689 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1690 $(Compile.CXX) $< -o $@
1692 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1693 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1694 $(Compile.CXX) $< -o $@
1696 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1697 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1698 $(Compile.CXX) $< -o $@
1700 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1701 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1702 $(Compile.C) $< -o $@
1704 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1705 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1706 $(Compile.C) $< -o $@
1708 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1709 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1710 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1712 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1713 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1714 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1716 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1717 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1718 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1720 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1721 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1722 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1724 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1725 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1726 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1731 ## Rules for building preprocessed (.i/.ii) outputs.
1732 $(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1733 $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
1734 $(Verb) $(Preprocess.CXX) $< -o $@
1736 $(BuildMode)/%.ii: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1737 $(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file"
1738 $(Verb) $(Preprocess.CXX) $< -o $@
1740 $(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1741 $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
1742 $(Verb) $(Preprocess.CXX) $< -o $@
1744 $(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1745 $(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
1746 $(Verb) $(Preprocess.C) $< -o $@
1748 $(BuildMode)/%.i: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1749 $(Echo) "Compiling $*.m for $(BuildMode) build to .i file"
1750 $(Verb) $(Preprocess.C) $< -o $@
1753 $(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1754 $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
1755 $(Compile.CXX) $< -o $@ -S
1757 $(ObjDir)/%.s: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1758 $(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG)
1759 $(Compile.CXX) $< -o $@ -S
1761 $(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1762 $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
1763 $(Compile.CXX) $< -o $@ -S
1765 $(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1766 $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
1767 $(Compile.C) $< -o $@ -S
1769 $(ObjDir)/%.s: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1770 $(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG)
1771 $(Compile.C) $< -o $@ -S
1774 # make the C and C++ compilers strip debug info out of bytecode libraries.
1776 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1777 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1778 $(Verb) $(LOPT) $< -std-compile-opts -o $@
1780 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1781 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1782 $(Verb) $(LOPT) $< -std-compile-opts -strip-debug -o $@
1786 #---------------------------------------------------------
1787 # Provide rule to build .bc files from .ll sources,
1788 # regardless of dependencies
1789 #---------------------------------------------------------
1790 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
1791 $(Echo) "Compiling $*.ll for $(BuildMode) build"
1792 $(Verb) $(LLVMAS) $< -f -o $@
1794 ###############################################################################
1795 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
1796 ###############################################################################
1799 TABLEGEN_INC_FILES_COMMON = 1
1802 ifdef TABLEGEN_INC_FILES_COMMON
1804 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
1805 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1806 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
1808 # INCFiles rule: All of the tblgen generated files are emitted to
1809 # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
1810 # us to only "touch" the real file if the contents of it change. IOW, if
1811 # tblgen is modified, all of the .inc.tmp files are regenerated, but no
1812 # dependencies of the .inc files are, unless the contents of the .inc file
1814 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
1815 $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
1817 endif # TABLEGEN_INC_FILES_COMMON
1821 TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
1822 $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \
1823 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \
1824 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \
1825 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \
1826 $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
1827 $(wildcard $(LLVM_SRC_ROOT)/include/llvm/IR/Intrinsics*.td)
1829 # All .inc.tmp files depend on the .td files.
1830 $(INCTMPFiles) : $(TDFiles)
1832 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1833 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1834 $(Echo) "Building $(<F) register info implementation with tblgen"
1835 $(Verb) $(LLVMTableGen) -gen-register-info -o $(call SYSPATH, $@) $<
1837 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1838 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1839 $(Echo) "Building $(<F) instruction information with tblgen"
1840 $(Verb) $(LLVMTableGen) -gen-instr-info -o $(call SYSPATH, $@) $<
1842 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1843 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1844 $(Echo) "Building $(<F) assembly writer with tblgen"
1845 $(Verb) $(LLVMTableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
1847 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1848 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1849 $(Echo) "Building $(<F) assembly writer #1 with tblgen"
1850 $(Verb) $(LLVMTableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
1852 $(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
1853 $(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1854 $(Echo) "Building $(<F) assembly matcher with tblgen"
1855 $(Verb) $(LLVMTableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
1857 $(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \
1858 $(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1859 $(Echo) "Building $(<F) MC code emitter with tblgen"
1860 $(Verb) $(LLVMTableGen) -gen-emitter -mc-emitter -o $(call SYSPATH, $@) $<
1862 $(TARGET:%=$(ObjDir)/%GenMCPseudoLowering.inc.tmp): \
1863 $(ObjDir)/%GenMCPseudoLowering.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1864 $(Echo) "Building $(<F) MC Pseudo instruction expander with tblgen"
1865 $(Verb) $(LLVMTableGen) -gen-pseudo-lowering -o $(call SYSPATH, $@) $<
1867 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1868 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1869 $(Echo) "Building $(<F) code emitter with tblgen"
1870 $(Verb) $(LLVMTableGen) -gen-emitter -o $(call SYSPATH, $@) $<
1872 $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
1873 $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1874 $(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
1875 $(Verb) $(LLVMTableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
1877 $(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \
1878 $(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1879 $(Echo) "Building $(<F) disassembly tables with tblgen"
1880 $(Verb) $(LLVMTableGen) -gen-disassembler -o $(call SYSPATH, $@) $<
1882 $(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
1883 $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1884 $(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
1885 $(Verb) $(LLVMTableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
1887 $(TARGET:%=$(ObjDir)/%GenSubtargetInfo.inc.tmp): \
1888 $(ObjDir)/%GenSubtargetInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1889 $(Echo) "Building $(<F) subtarget information with tblgen"
1890 $(Verb) $(LLVMTableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
1892 $(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
1893 $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1894 $(Echo) "Building $(<F) calling convention information with tblgen"
1895 $(Verb) $(LLVMTableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
1897 $(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
1898 $(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1899 $(Echo) "Building $(<F) intrinsics information with tblgen"
1900 $(Verb) $(LLVMTableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
1902 $(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1903 $(Echo) "Building $(<F) decoder tables with tblgen"
1904 $(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $<
1906 $(ObjDir)/%GenDFAPacketizer.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1907 $(Echo) "Building $(<F) DFA packetizer tables with tblgen"
1908 $(Verb) $(LLVMTableGen) -gen-dfa-packetizer -o $(call SYSPATH, $@) $<
1911 -$(Verb) $(RM) -f $(INCFiles)
1915 ###############################################################################
1916 # OTHER RULES: Other rules needed
1917 ###############################################################################
1919 # To create postscript files from dot files...
1920 ifneq ($(DOT),false)
1922 $(DOT) -Tps < $< > $@
1925 $(Echo) "Cannot build $@: The program dot is not installed"
1928 # This rules ensures that header files that are removed still have a rule for
1929 # which they can be "generated." This allows make to ignore them and
1930 # reproduce the dependency lists.
1934 # Define clean-local to clean the current directory. Note that this uses a
1935 # very conservative approach ensuring that empty variables do not cause
1936 # errors or disastrous removal.
1938 ifneq ($(strip $(ObjRootDir)),)
1939 -$(Verb) $(RM) -rf $(ObjRootDir)
1941 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1942 -$(Verb) $(RM) -f *$(SHLIBEXT)
1946 -$(Verb) $(RM) -rf Debug Release Profile
1949 ###############################################################################
1950 # DEPENDENCIES: Include the dependency files if we should
1951 ###############################################################################
1952 ifndef DISABLE_AUTO_DEPENDENCIES
1954 # If its not one of the cleaning targets
1955 ifndef IS_CLEANING_TARGET
1957 # Get the list of dependency files
1958 DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources)))
1959 DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
1961 # Include bitcode dependency files if using bitcode libraries
1962 ifdef BYTECODE_LIBRARY
1963 DependFiles += $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.bc.d)
1966 -include $(DependFiles) ""
1972 ###############################################################################
1973 # CHECK: Running the test suite
1974 ###############################################################################
1977 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1978 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1979 $(EchoCmd) Running test suite ; \
1980 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
1981 TESTSUITE=$(TESTSUITE) ; \
1983 $(EchoCmd) No Makefile in test directory ; \
1986 $(EchoCmd) No test directory ; \
1989 # An alias dating from when both lit and DejaGNU test runners were used.
1993 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1994 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1995 $(EchoCmd) Running test suite ; \
1996 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \
1998 $(EchoCmd) No Makefile in test directory ; \
2001 $(EchoCmd) No test directory ; \
2004 ###############################################################################
2005 # UNITTESTS: Running the unittests test suite
2006 ###############################################################################
2009 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
2010 if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
2011 $(EchoCmd) Running unittests test suite ; \
2012 $(MAKE) -C $(PROJ_OBJ_ROOT)/unittests unitcheck; \
2014 $(EchoCmd) No Makefile in unittests directory ; \
2017 $(EchoCmd) No unittests directory ; \
2020 ###############################################################################
2021 # DISTRIBUTION: Handle construction of a distribution tarball
2022 ###############################################################################
2024 #------------------------------------------------------------------------
2025 # Define distribution related variables
2026 #------------------------------------------------------------------------
2027 DistName := $(PROJECT_NAME)-$(PROJ_VERSION)
2028 DistDir := $(PROJ_OBJ_ROOT)/$(DistName)
2029 TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName)
2030 DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
2031 DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip
2032 DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
2033 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
2034 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
2035 Makefile.config.in configure autoconf
2036 DistOther := $(notdir $(wildcard \
2037 $(PROJ_SRC_DIR)/*.h \
2038 $(PROJ_SRC_DIR)/*.td \
2039 $(PROJ_SRC_DIR)/*.def \
2040 $(PROJ_SRC_DIR)/*.ll \
2041 $(PROJ_SRC_DIR)/*.in))
2042 DistSubDirs := $(SubDirs)
2043 DistSources = $(Sources) $(EXTRA_DIST)
2044 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
2046 #------------------------------------------------------------------------
2047 # We MUST build distribution with OBJ_DIR != SRC_DIR
2048 #------------------------------------------------------------------------
2049 ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
2050 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
2051 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
2055 #------------------------------------------------------------------------
2056 # Prevent attempt to run dist targets from anywhere but the top level
2057 #------------------------------------------------------------------------
2059 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
2060 $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
2063 #------------------------------------------------------------------------
2064 # Provide the top level targets
2065 #------------------------------------------------------------------------
2067 dist-gzip:: $(DistTarGZip)
2069 $(DistTarGZip) : $(TopDistDir)/.makedistdir
2070 $(Echo) Packing gzipped distribution tar file.
2071 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
2072 $(GZIP) -c > "$(DistTarGZip)"
2074 dist-bzip2:: $(DistTarBZ2)
2076 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
2077 $(Echo) Packing bzipped distribution tar file.
2078 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
2079 $(BZIP2) -c >$(DistTarBZ2)
2081 dist-zip:: $(DistZip)
2083 $(DistZip) : $(TopDistDir)/.makedistdir
2084 $(Echo) Packing zipped distribution file.
2085 $(Verb) rm -f $(DistZip)
2086 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
2088 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
2089 $(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL =====
2091 DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
2093 dist-check:: $(DistTarGZip)
2094 $(Echo) Checking distribution tar file.
2095 $(Verb) if test -d $(DistCheckDir) ; then \
2096 $(RM) -rf $(DistCheckDir) ; \
2098 $(Verb) $(MKDIR) $(DistCheckDir)
2099 $(Verb) cd $(DistCheckDir) && \
2100 $(MKDIR) $(DistCheckDir)/build && \
2101 $(MKDIR) $(DistCheckDir)/install && \
2102 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
2104 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
2105 --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
2108 $(MAKE) unittests && \
2109 $(MAKE) install && \
2110 $(MAKE) uninstall && \
2111 $(MAKE) dist-clean && \
2112 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
2115 $(Echo) Cleaning distribution files
2116 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
2121 #------------------------------------------------------------------------
2122 # Provide the recursive distdir target for building the distribution directory
2123 #------------------------------------------------------------------------
2124 distdir: $(DistDir)/.makedistdir
2125 $(DistDir)/.makedistdir: $(DistSources)
2126 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2127 if test -d "$(DistDir)" ; then \
2128 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
2131 $(EchoCmd) Removing old $(DistDir) ; \
2132 $(RM) -rf $(DistDir); \
2133 $(EchoCmd) Making 'all' to verify build ; \
2134 $(MAKE) ENABLE_OPTIMIZED=1 all ; \
2136 $(Echo) Building Distribution Directory $(DistDir)
2137 $(Verb) $(MKDIR) $(DistDir)
2138 $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
2139 srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
2140 for file in $(DistFiles) ; do \
2142 $(PROJ_SRC_DIR)/*) \
2143 file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
2145 $(PROJ_SRC_ROOT)/*) \
2146 file=`echo "$$file" | \
2147 sed "s#^$$srcrootstrip/##"` \
2150 if test -f "$(PROJ_SRC_DIR)/$$file" || \
2151 test -d "$(PROJ_SRC_DIR)/$$file" ; then \
2152 from_dir="$(PROJ_SRC_DIR)" ; \
2153 elif test -f "$$file" || test -d "$$file" ; then \
2156 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
2157 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
2158 to_dir="$(DistDir)/$$dir"; \
2159 $(MKDIR) "$$to_dir" ; \
2161 to_dir="$(DistDir)"; \
2163 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
2164 if test -n "$$mid_dir" ; then \
2165 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
2167 if test -d "$$from_dir/$$file"; then \
2168 if test -d "$(PROJ_SRC_DIR)/$$file" && \
2169 test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
2170 cd $(PROJ_SRC_DIR) ; \
2171 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2172 ( cd $$to_dir ; $(TAR) xf - ) ; \
2173 cd $(PROJ_OBJ_DIR) ; \
2176 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2177 ( cd $$to_dir ; $(TAR) xf - ) ; \
2178 cd $(PROJ_OBJ_DIR) ; \
2180 elif test -f "$$from_dir/$$file" ; then \
2181 $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
2182 elif test -L "$$from_dir/$$file" ; then \
2183 $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
2184 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
2185 $(EchoCmd) "===== WARNING: Distribution Source " \
2186 "$$from_dir/$$file Not Found!" ; \
2187 elif test "$(Verb)" != '@' ; then \
2188 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
2191 $(Verb) for subdir in $(DistSubDirs) ; do \
2192 if test "$$subdir" \!= "." ; then \
2193 new_distdir="$(DistDir)/$$subdir" ; \
2194 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
2195 ( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
2196 DistDir="$$new_distdir" distdir ) || exit 1; \
2199 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2200 $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
2201 $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
2202 -name .svn \) -print` ;\
2203 $(MAKE) dist-hook ; \
2204 $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
2205 -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
2206 -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
2207 -o ! -type d ! -perm -444 -exec \
2208 $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
2209 || chmod -R a+r $(DistDir) ; \
2212 # This is invoked by distdir target, define it as a no-op to avoid errors if not
2218 ###############################################################################
2219 # TOP LEVEL - targets only to apply at the top level directory
2220 ###############################################################################
2224 #------------------------------------------------------------------------
2225 # Install support for the project's include files:
2226 #------------------------------------------------------------------------
2229 $(Echo) Install circumvented with NO_INSTALL
2231 $(Echo) Uninstall circumvented with NO_INSTALL
2234 $(Echo) Installing include files
2235 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
2236 $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
2237 cd $(PROJ_SRC_ROOT)/include && \
2238 for hdr in `find . -type f \
2239 '(' -name LICENSE.TXT \
2244 ')' -print | grep -v CVS | \
2245 grep -v .svn` ; do \
2246 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2247 if test \! -d "$$instdir" ; then \
2248 $(EchoCmd) Making install directory $$instdir ; \
2249 $(MKDIR) $$instdir ;\
2251 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2254 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
2255 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
2256 cd $(PROJ_OBJ_ROOT)/include && \
2257 for hdr in `find . -type f \
2258 '(' -name LICENSE.TXT \
2263 ')' -print | grep -v CVS | \
2264 grep -v .svn` ; do \
2265 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2266 if test \! -d "$$instdir" ; then \
2267 $(EchoCmd) Making install directory $$instdir ; \
2268 $(MKDIR) $$instdir ;\
2270 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2276 $(Echo) Uninstalling include files
2277 $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
2278 cd $(PROJ_SRC_ROOT)/include && \
2279 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
2280 '!' '(' -name '*~' -o -name '.#*' \
2281 -o -name '*.in' ')' -print ')' | \
2282 grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2283 cd $(PROJ_SRC_ROOT)/include && \
2284 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
2285 -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2291 @echo searching for overlength lines in files: $(Sources)
2294 egrep -n '.{81}' $(Sources) /dev/null
2297 @echo searching for tabs in files: $(Sources)
2300 egrep -n ' ' $(Sources) /dev/null
2303 @ls -l $(LibDir) | awk '\
2304 BEGIN { sum = 0; } \
2306 END { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2307 @ls -l $(ToolDir) | awk '\
2308 BEGIN { sum = 0; } \
2310 END { printf("Programs: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2311 #------------------------------------------------------------------------
2312 # Print out the directories used for building
2313 #------------------------------------------------------------------------
2315 $(Echo) "BuildMode : " '$(BuildMode)'
2316 $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
2317 $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
2318 $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
2319 $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
2320 $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
2321 $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
2322 $(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
2323 $(Echo) "PROJ_internal_prefix : " '$(PROJ_internal_prefix)'
2324 $(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
2325 $(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
2326 $(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
2327 $(Echo) "PROJ_includedir : " '$(PROJ_includedir)'
2328 $(Echo) "UserTargets : " '$(UserTargets)'
2329 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
2330 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
2331 $(Echo) "ObjDir : " '$(ObjDir)'
2332 $(Echo) "LibDir : " '$(LibDir)'
2333 $(Echo) "ToolDir : " '$(ToolDir)'
2334 $(Echo) "ExmplDir : " '$(ExmplDir)'
2335 $(Echo) "Sources : " '$(Sources)'
2336 $(Echo) "TDFiles : " '$(TDFiles)'
2337 $(Echo) "INCFiles : " '$(INCFiles)'
2338 $(Echo) "INCTMPFiles : " '$(INCTMPFiles)'
2339 $(Echo) "PreConditions: " '$(PreConditions)'
2340 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
2341 $(Echo) "Compile.C : " '$(Compile.C)'
2342 $(Echo) "Archive : " '$(Archive)'
2343 $(Echo) "YaccFiles : " '$(YaccFiles)'
2344 $(Echo) "LexFiles : " '$(LexFiles)'
2345 $(Echo) "Module : " '$(Module)'
2346 $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
2347 $(Echo) "SubDirs : " '$(SubDirs)'
2348 $(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
2349 $(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
2354 # General debugging rule, use 'make dbg-print-XXX' to print the
2355 # definition, value and origin of XXX.
2357 $(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))