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 CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
284 C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
285 LD.Flags += $(OPTIMIZE_OPTION)
287 BuildMode := $(BuildMode)+Debug
294 ifdef NO_DEBUG_SYMBOLS
295 BuildMode := Unoptimized
309 ifeq ($(ENABLE_LIBCPP),1)
310 CXX.Flags += -stdlib=libc++
311 LD.Flags += -stdlib=libc++
314 ifeq ($(ENABLE_CXX11),1)
315 CXX.Flags += -std=c++11
318 ifeq ($(ENABLE_WERROR),1)
323 ifeq ($(ENABLE_PROFILING),1)
324 BuildMode := $(BuildMode)+Profile
325 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
326 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) -pg -g
327 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg -g
331 ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
332 CXX.Flags += -fvisibility-inlines-hidden
335 ifdef ENABLE_EXPENSIVE_CHECKS
336 # GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above.
337 # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40160
341 # IF REQUIRES_EH=1 is specified then don't disable exceptions
343 CXX.Flags += -fno-exceptions
345 # If the library requires EH, it also requires RTTI.
349 ifdef REQUIRES_FRAME_POINTER
350 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags))
351 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags))
352 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags))
355 # If REQUIRES_RTTI=1 is specified then don't disable run-time type id.
356 ifneq ($(REQUIRES_RTTI), 1)
357 CXX.Flags += -fno-rtti
360 ifeq ($(ENABLE_COVERAGE),1)
361 BuildMode := $(BuildMode)+Coverage
362 CXX.Flags += -ftest-coverage -fprofile-arcs
363 C.Flags += -ftest-coverage -fprofile-arcs
366 # If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
367 # then disable assertions by defining the appropriate preprocessor symbols.
368 ifeq ($(DISABLE_ASSERTIONS),1)
369 CPP.Defines += -DNDEBUG
371 BuildMode := $(BuildMode)+Asserts
372 CPP.Defines += -D_DEBUG
375 # If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
376 # configured), then enable expensive checks by defining the
377 # appropriate preprocessor symbols.
378 ifeq ($(ENABLE_EXPENSIVE_CHECKS),1)
379 BuildMode := $(BuildMode)+Checks
380 CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
383 # LOADABLE_MODULE implies several other things so we force them to be
385 ifdef LOADABLE_MODULE
387 LINK_LIBS_IN_SHARED := 1
395 ifeq ($(ENABLE_PIC),1)
396 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
397 # Nothing. Win32 defaults to PIC and warns when given -fPIC
399 ifeq ($(HOST_OS),Darwin)
400 # Common symbols not allowed in dylib files
401 CXX.Flags += -fno-common
402 C.Flags += -fno-common
404 # Linux and others; pass -fPIC
410 ifeq ($(HOST_OS),Darwin)
411 CXX.Flags += -mdynamic-no-pic
412 C.Flags += -mdynamic-no-pic
416 # Support makefile variable to disable any kind of timestamp/non-deterministic
417 # info from being used in the build.
418 ifeq ($(ENABLE_TIMESTAMPS),1)
419 DOTDIR_TIMESTAMP_COMMAND := $(DATE)
421 DOTDIR_TIMESTAMP_COMMAND := echo 'Created.'
424 ifeq ($(HOST_OS),MingW)
426 CPP.Defines += -D__NO_CTYPE_INLINE
427 ifeq ($(LLVM_CROSS_COMPILING),1)
428 # Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016
430 LD.Flags += -Wl,--allow-multiple-definition
435 CXX.Flags += -Woverloaded-virtual
436 CPP.BaseFlags += $(CPP.Defines)
439 # Make Floating point IEEE compliant on Alpha.
442 CPP.BaseFlags += -mieee
443 ifeq ($(ENABLE_PIC),0)
445 CPP.BaseFlags += -fPIC
448 LD.Flags += -Wl,--no-relax
451 # GNU ld/PECOFF accepts but ignores them below;
455 # FIXME: autoconf should be aware of them.
456 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
457 HAVE_LINK_VERSION_SCRIPT := 0
459 RDYNAMIC := -Wl,--export-all-symbols
462 #--------------------------------------------------------------------
463 # Directory locations
464 #--------------------------------------------------------------------
466 ifeq ($(LLVM_CROSS_COMPILING),1)
467 BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin
470 ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode)
471 ObjDir := $(ObjRootDir)
472 LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
473 ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
474 ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
475 LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
476 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
477 LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
479 #--------------------------------------------------------------------
480 # Locations of shared libraries
481 #--------------------------------------------------------------------
484 SharedLibDir := $(LibDir)
485 LLVMSharedLibDir := $(LLVMLibDir)
487 # Win32.DLL prefers to be located on the "PATH" of binaries.
488 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
489 SharedLibDir := $(ToolDir)
490 LLVMSharedLibDir := $(LLVMToolDir)
492 ifeq ($(HOST_OS),Cygwin)
499 #--------------------------------------------------------------------
500 # LLVM Capable Compiler
501 #--------------------------------------------------------------------
503 ifneq ($(findstring llvm-gcc,$(LLVMCC_OPTION)),)
505 LLVMCXX := $(LLVMGXX)
507 ifneq ($(findstring clang,$(LLVMCC_OPTION)),)
508 ifneq ($(CLANGPATH),)
509 LLVMCC := $(CLANGPATH)
510 LLVMCXX := $(CLANGXXPATH)
512 ifeq ($(ENABLE_BUILT_CLANG),1)
513 LLVMCC := $(LLVMToolDir)/clang
514 LLVMCXX := $(LLVMToolDir)/clang++
520 #--------------------------------------------------------------------
521 # Full Paths To Compiled Tools and Utilities
522 #--------------------------------------------------------------------
523 EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
524 ifdef BUILD_DIRS_ONLY
525 EchoCmd := $(EchoCmd) "(build tools)":
530 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
533 ifeq ($(LLVM_CROSS_COMPILING),1)
534 LLVM_TBLGEN := $(BuildLLVMToolDir)/llvm-tblgen$(BUILD_EXEEXT)
536 LLVM_TBLGEN := $(LLVMToolDir)/llvm-tblgen$(EXEEXT)
539 ifeq ($(LLVM_CROSS_COMPILING),1)
540 LLVM_CONFIG := $(BuildLLVMToolDir)/llvm-config$(BUILD_EXEEXT)
542 LLVM_CONFIG := $(LLVMToolDir)/llvm-config$(EXEEXT)
545 LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
548 LLI := $(LLVMToolDir)/lli$(EXEEXT)
551 LLC := $(LLVMToolDir)/llc$(EXEEXT)
554 LOPT := $(LLVMToolDir)/opt$(EXEEXT)
557 LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
560 LLVMLINK := $(LLVMToolDir)/llvm-link$(EXEEXT)
563 #--------------------------------------------------------------------
564 # Adjust to user's request
565 #--------------------------------------------------------------------
567 ifeq ($(HOST_OS),Darwin)
568 ifdef MACOSX_DEPLOYMENT_TARGET
569 DARWIN_VERSION := $(MACOSX_DEPLOYMENT_TARGET)
571 DARWIN_VERSION := `sw_vers -productVersion`
573 # Strip a number like 10.4.7 to 10.4
574 DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/')
575 # Get "4" out of 10.4 for later pieces in the makefile.
576 DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
578 LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress
579 SharedLinkOptions := -dynamiclib
580 ifdef DEPLOYMENT_TARGET
581 SharedLinkOptions += $(DEPLOYMENT_TARGET)
584 SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
588 SharedLinkOptions=-shared
591 ifeq ($(TARGET_OS),Darwin)
592 ifdef DEPLOYMENT_TARGET
593 TargetCommonOpts += $(DEPLOYMENT_TARGET)
596 TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
602 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
603 ifneq ($(HOST_OS),Darwin)
604 LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
616 # Adjust settings for verbose mode
619 AR.Flags += >/dev/null 2>/dev/null
620 ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
622 ConfigureScriptFLAGS :=
625 # By default, strip symbol information from executable
627 Strip := $(PLATFORMSTRIPOPTS)
628 StripWarnMsg := "(without symbols)"
629 Install.StripFlag += -s
632 ifdef TOOL_NO_EXPORTS
635 DynamicFlag := $(RDYNAMIC)
638 # Adjust linker flags for building an executable
639 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
640 ifneq ($(HOST_OS), Darwin)
642 LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib' $(DynamicFlag)
645 ifneq ($(DARWIN_MAJVERS),4)
646 LD.Flags += $(RPATH) -Wl,@executable_path/../lib
649 TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX)
650 LD.Flags += -Wl,-object_path_lto -Wl,$(TempFile)
656 #----------------------------------------------------------
657 # Options To Invoke Tools
658 #----------------------------------------------------------
660 ifdef EXTRA_LD_OPTIONS
661 LD.Flags += $(EXTRA_LD_OPTIONS)
665 CompileCommonOpts += -pedantic -Wno-long-long
667 CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
668 $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT) \
669 $(NO_UNINITIALIZED) $(NO_MAYBE_UNINITIALIZED) \
670 $(NO_MISSING_FIELD_INITIALIZERS)
671 # Enable cast-qual for C++; the workaround is to use const_cast.
672 CXX.Flags += -Wcast-qual
674 ifeq ($(HOST_OS),HP-UX)
675 CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
678 # If we are building a universal binary on Mac OS/X, pass extra options. This
679 # is useful to people that want to link the LLVM libraries into their universal
682 # The following can be optionally specified:
683 # UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
684 # For Mac OS/X 10.4 Intel machines, the traditional one is:
685 # UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
686 # UNIVERSAL_ARCH can be optionally specified to be a list of architectures
687 # to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64". This defaults to
690 ifndef UNIVERSAL_ARCH
691 UNIVERSAL_ARCH := i386 ppc
693 UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
694 TargetCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
695 ifdef UNIVERSAL_SDK_PATH
696 TargetCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
699 # Building universal cannot compute dependencies automatically.
700 DISABLE_AUTO_DEPENDENCIES=1
702 ifeq ($(TARGET_OS),Darwin)
703 ifeq ($(ARCH),x86_64)
704 TargetCommonOpts = -m64
707 TargetCommonOpts = -m32
713 ifeq ($(HOST_OS),SunOS)
714 CPP.BaseFlags += -include llvm/Support/Solaris.h
717 ifeq ($(HOST_OS),AuroraUX)
718 CPP.BaseFlags += -include llvm/Support/Solaris.h
719 endif # !HOST_OS - AuroraUX.
721 # On Windows, SharedLibDir != LibDir. The order is important.
722 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
723 LD.Flags += -L$(SharedLibDir) -L$(LibDir) -L$(LLVMToolDir) -L$(LLVMLibDir)
725 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
728 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
729 # All -I flags should go here, so that they don't confuse llvm-config.
730 CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
731 $(patsubst %,-I%/include,\
732 $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
733 $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
736 ifeq ($(INCLUDE_BUILD_DIR),1)
737 CPP.Flags += -I$(ObjDir)
740 # SHOW_DIAGNOSTICS support.
741 ifeq ($(SHOW_DIAGNOSTICS),1)
742 Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
743 CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
748 Compile.C = $(Compile.Wrapper) \
749 $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
750 $(TargetCommonOpts) $(CompileCommonOpts) -c
751 Compile.CXX = $(Compile.Wrapper) \
752 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
753 $(TargetCommonOpts) $(CompileCommonOpts) -c
754 Preprocess.CXX= $(Compile.Wrapper) \
755 $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
756 $(CompileCommonOpts) $(CXX.Flags) -E
757 Link = $(Compile.Wrapper) \
758 $(CXX) $(LD.Flags) $(LDFLAGS) $(TargetCommonOpts) $(Strip)
760 BCCompile.C = $(LLVMCC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
761 $(TargetCommonOpts) $(CompileCommonOpts)
762 Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
763 $(TargetCommonOpts) $(CompileCommonOpts) -E
765 BCCompile.CXX = $(LLVMCXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
766 $(TargetCommonOpts) $(CompileCommonOpts)
768 ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
769 ScriptInstall = $(INSTALL) -m 0755
770 DataInstall = $(INSTALL) -m 0644
772 # When compiling under Mingw/Cygwin, the tblgen tool expects Windows
773 # paths. In this case, the SYSPATH function (defined in
774 # Makefile.config) transforms Unix paths into Windows paths.
775 TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
776 -I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
777 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
778 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
779 LLVMTableGen = $(LLVM_TBLGEN) $(TableGen.Flags)
781 Archive = $(AR) $(AR.Flags)
782 LArchive = $(LLVMToolDir)/llvm-ar rcsf
791 #----------------------------------------------------------
792 # Get the list of source files and compute object file
794 #----------------------------------------------------------
797 Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
798 $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
800 Sources := $(SOURCES)
804 Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
807 BaseNameSources := $(sort $(basename $(Sources)))
809 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
810 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
812 #----------------------------------------------------------
813 # For Mingw MSYS bash and Python/w32:
815 # $(ECHOPATH) prints DOSish pathstring.
816 # ex) $(ECHOPATH) /include/sys/types.h
817 # --> C:/mingw/include/sys/types.h
818 # built-in "echo" does not transform path to DOSish path.
820 # FIXME: It would not be needed when MSYS's python
822 #----------------------------------------------------------
824 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
825 ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])"
827 ECHOPATH := $(Verb)$(ECHO)
830 ###############################################################################
831 # DIRECTORIES: Handle recursive descent of directory structure
832 ###############################################################################
834 #---------------------------------------------------------
835 # Provide rules to make install dirs. This must be early
836 # in the file so they get built before dependencies
837 #---------------------------------------------------------
839 $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
842 # To create other directories, as needed, and timestamp their creation
844 $(Verb) $(MKDIR) $* > /dev/null
845 $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
847 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
848 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
850 #---------------------------------------------------------
851 # Handle the DIRS options for sequential construction
852 #---------------------------------------------------------
858 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
859 $(RecursiveTargets)::
860 $(Verb) for dir in $(DIRS); do \
861 if ([ ! -f $$dir/Makefile ] || \
862 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
864 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
866 ($(MAKE) -C $$dir $@ ) || exit 1; \
869 $(RecursiveTargets)::
870 $(Verb) for dir in $(DIRS); do \
871 ($(MAKE) -C $$dir $@ ) || exit 1; \
877 #---------------------------------------------------------
878 # Handle the EXPERIMENTAL_DIRS options ensuring success
879 # after each directory is built.
880 #---------------------------------------------------------
881 ifdef EXPERIMENTAL_DIRS
882 $(RecursiveTargets)::
883 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
884 if ([ ! -f $$dir/Makefile ] || \
885 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
887 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
889 ($(MAKE) -C $$dir $@ ) || exit 0; \
893 #-----------------------------------------------------------
894 # Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
895 #-----------------------------------------------------------
896 ifdef OPTIONAL_PARALLEL_DIRS
897 PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) -o -f $(T)/Makefile && echo "$(T)"))
900 #-----------------------------------------------------------
901 # Handle the PARALLEL_DIRS options for parallel construction
902 #-----------------------------------------------------------
905 SubDirs += $(PARALLEL_DIRS)
907 # Unfortunately, this list must be maintained if new recursive targets are added
908 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
909 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
910 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
911 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
912 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
913 install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
914 unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS))
916 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
920 SD=$(PROJ_SRC_DIR)/$(@D); \
922 if [ ! -f $$SD/Makefile ]; then \
924 DD=$(notdir $(@D)); \
926 if ([ ! -f $$DD/Makefile ] || \
927 command test $$DD/Makefile -ot \
928 $$SD/Makefile ); then \
930 $(CP) $$SD/Makefile $$DD/Makefile; \
932 $(MAKE) -C $$DD $(subst $(@D)/.make,,$@)
935 #---------------------------------------------------------
936 # Handle the OPTIONAL_DIRS options for directores that may
938 #---------------------------------------------------------
941 SubDirs += $(OPTIONAL_DIRS)
943 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
944 $(RecursiveTargets)::
945 $(Verb) for dir in $(OPTIONAL_DIRS); do \
946 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
947 if ([ ! -f $$dir/Makefile ] || \
948 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
950 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
952 ($(MAKE) -C$$dir $@ ) || exit 1; \
956 $(RecursiveTargets)::
957 $(Verb) for dir in $(OPTIONAL_DIRS); do \
958 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
959 ($(MAKE) -C$$dir $@ ) || exit 1; \
965 #---------------------------------------------------------
966 # Handle the CONFIG_FILES options
967 #---------------------------------------------------------
972 $(Echo) Install circumvented with NO_INSTALL
974 $(Echo) UnInstall circumvented with NO_INSTALL
976 install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
977 $(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir)
978 $(Verb)for file in $(CONFIG_FILES); do \
979 if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
980 $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
981 elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
982 $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
984 $(ECHO) Error: cannot find config file $${file}. ; \
989 $(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
990 $(Verb)for file in $(CONFIG_FILES); do \
991 $(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
997 ###############################################################################
998 # Set up variables for building libraries
999 ###############################################################################
1001 #---------------------------------------------------------
1002 # Define various command line options pertaining to the
1003 # libraries needed when linking. There are "Proj" libs
1004 # (defined by the user's project) and "LLVM" libs (defined
1005 # by the LLVM project).
1006 #---------------------------------------------------------
1009 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
1010 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
1011 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
1012 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
1016 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
1017 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
1018 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
1019 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
1022 # Loadable module for Win32 requires all symbols resolved for linking.
1023 # Then all symbols in LLVM.dll will be available.
1024 ifeq ($(ENABLE_SHARED),1)
1025 ifdef LOADABLE_MODULE
1026 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
1027 LINK_COMPONENTS += all
1032 ifndef IS_CLEANING_TARGET
1033 ifdef LINK_COMPONENTS
1035 # If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make
1036 # clean in tools, then do a make in tools (instead of at the top level).
1038 @echo "*** llvm-config doesn't exist - rebuilding it."
1039 @$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config
1041 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
1043 ifeq ($(ENABLE_SHARED), 1)
1044 # We can take the "auto-import" feature to get rid of using dllimport.
1045 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1046 LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
1049 LLVMLibsOptions += -lLLVM-$(LLVMVersion)
1050 LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT)
1053 ifndef NO_LLVM_CONFIG
1054 LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)
1055 ifeq ($(LLVMConfigLibs),Error)
1056 $(error llvm-config --libs failed)
1058 LLVMLibsOptions += $(LLVMConfigLibs)
1059 LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error)
1060 ifeq ($(LLVMConfigLibfiles),Error)
1061 $(error llvm-config --libfiles failed)
1063 LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles)
1070 # Set up the library exports file.
1071 ifdef EXPORTED_SYMBOL_FILE
1073 # First, set up the native export file, which may differ from the source
1076 ifeq ($(HOST_OS),Darwin)
1077 # Darwin convention prefixes symbols with underscores.
1078 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed
1079 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1080 $(Verb) sed -e 's/^/_/' < $< > $@
1082 -$(Verb) $(RM) -f $(NativeExportsFile)
1084 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1085 # Gold and BFD ld require a version script rather than a plain list.
1086 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
1087 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1088 $(Verb) echo "{" > $@
1089 $(Verb) grep -q '[[:alnum:]_]' $< && echo " global:" >> $@ || :
1090 $(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@
1091 ifneq ($(HOST_OS),OpenBSD)
1092 $(Verb) echo " local: *;" >> $@
1094 $(Verb) echo "};" >> $@
1096 -$(Verb) $(RM) -f $(NativeExportsFile)
1098 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1099 # GNU ld Win32 accepts .DEF files that contain "DATA" entries.
1100 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def))
1101 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1102 $(Echo) Generating $(notdir $@)
1103 $(Verb) $(ECHO) "EXPORTS" > $@
1104 $(Verb) $(CAT) $< >> $@
1106 -$(Verb) $(RM) -f $(NativeExportsFile)
1108 # Default behavior: just use the exports file verbatim.
1109 NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
1114 # Now add the linker command-line options to use the native export file.
1117 ifeq ($(HOST_OS),Darwin)
1118 LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
1121 # gold, bfd ld, etc.
1122 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1123 LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
1127 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1128 # LLVMLibsOptions is invalidated at processing tools/llvm-shlib.
1129 SharedLinkOptions += $(NativeExportsFile)
1134 ###############################################################################
1135 # Library Build Rules: Four ways to build a library
1136 ###############################################################################
1138 #---------------------------------------------------------
1139 # Bytecode Module Targets:
1140 # If the user set MODULE_NAME then they want to build a
1141 # bytecode module from the sources. We compile all the
1142 # sources and link it together into a single bytecode
1144 #---------------------------------------------------------
1147 ifeq ($(strip $(LLVMCC)),)
1148 $(warning Modules require LLVM capable compiler but none is available ****)
1151 Module := $(LibDir)/$(MODULE_NAME).bc
1152 LinkModule := $(LLVMLINK)
1155 ifdef EXPORTED_SYMBOL_FILE
1156 LinkModule += -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1159 $(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(LLVMLINK)
1160 $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
1161 $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
1163 all-local:: $(Module)
1166 ifneq ($(strip $(Module)),)
1167 -$(Verb) $(RM) -f $(Module)
1170 ifdef BYTECODE_DESTINATION
1171 ModuleDestDir := $(BYTECODE_DESTINATION)
1173 ModuleDestDir := $(DESTDIR)$(PROJ_libdir)
1178 $(Echo) Install circumvented with NO_INSTALL
1180 $(Echo) Uninstall circumvented with NO_INSTALL
1182 DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
1184 install-module:: $(DestModule)
1185 install-local:: $(DestModule)
1187 $(DestModule): $(ModuleDestDir) $(Module)
1188 $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
1189 $(Verb) $(DataInstall) $(Module) $(DestModule)
1192 $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
1193 -$(Verb) $(RM) -f $(DestModule)
1199 # if we're building a library ...
1202 # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option
1203 LIBRARYNAME := $(strip $(LIBRARYNAME))
1204 ifdef LOADABLE_MODULE
1205 BaseLibName.A := $(LIBRARYNAME).a
1206 BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT)
1208 BaseLibName.A := lib$(LIBRARYNAME).a
1209 BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
1211 LibName.A := $(LibDir)/$(BaseLibName.A)
1212 LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
1213 LibName.O := $(LibDir)/$(LIBRARYNAME).o
1214 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
1216 #---------------------------------------------------------
1217 # Shared Library Targets:
1218 # If the user asked for a shared library to be built
1219 # with the SHARED_LIBRARY variable, then we provide
1220 # targets for building them.
1221 #---------------------------------------------------------
1222 ifdef SHARED_LIBRARY
1224 all-local:: $(LibName.SO)
1226 ifdef EXPORTED_SYMBOL_FILE
1227 $(LibName.SO): $(NativeExportsFile)
1230 ifdef LINK_LIBS_IN_SHARED
1231 ifdef LOADABLE_MODULE
1232 SharedLibKindMessage := "Loadable Module"
1233 SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions)
1235 SharedLibKindMessage := "Shared Library"
1237 $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
1238 $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
1240 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
1241 $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
1243 $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
1244 $(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
1245 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
1249 ifneq ($(strip $(LibName.SO)),)
1250 -$(Verb) $(RM) -f $(LibName.SO)
1255 $(Echo) Install circumvented with NO_INSTALL
1257 $(Echo) Uninstall circumvented with NO_INSTALL
1260 # Win32.DLL prefers to be located on the "PATH" of binaries.
1261 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1262 DestSharedLibDir := $(DESTDIR)$(PROJ_bindir)
1264 DestSharedLibDir := $(DESTDIR)$(PROJ_libdir)
1266 DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
1268 install-local:: $(DestSharedLib)
1270 $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir)
1271 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
1272 $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
1275 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
1276 -$(Verb) $(RM) -f $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME).*
1280 #---------------------------------------------------------
1281 # Bytecode Library Targets:
1282 # If the user asked for a bytecode library to be built
1283 # with the BYTECODE_LIBRARY variable, then we provide
1284 # targets for building them.
1285 #---------------------------------------------------------
1286 ifdef BYTECODE_LIBRARY
1287 ifeq ($(strip $(LLVMCC)),)
1288 $(warning Bytecode libraries require LLVM capable compiler but none is available ****)
1291 all-local:: $(LibName.BCA)
1293 ifdef EXPORTED_SYMBOL_FILE
1294 BCLinkLib = $(LLVMLINK) -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1296 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLINK) \
1297 $(LLVMToolDir)/llvm-ar
1298 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
1300 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).internalize $(ObjectsBC)
1302 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).internalize.bc
1304 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
1305 $(LLVMToolDir)/llvm-ar
1306 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
1308 $(Verb) $(LArchive) $@ $(ObjectsBC)
1313 ifneq ($(strip $(LibName.BCA)),)
1314 -$(Verb) $(RM) -f $(LibName.BCA)
1317 ifdef BYTECODE_DESTINATION
1318 BytecodeDestDir := $(BYTECODE_DESTINATION)
1320 BytecodeDestDir := $(DESTDIR)$(PROJ_libdir)
1323 DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).bca
1325 install-bytecode-local:: $(DestBytecodeLib)
1329 $(Echo) Install circumvented with NO_INSTALL
1331 $(Echo) Uninstall circumvented with NO_INSTALL
1333 install-local:: $(DestBytecodeLib)
1335 $(DestBytecodeLib): $(LibName.BCA) $(BytecodeDestDir)
1336 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1337 $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
1340 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1341 -$(Verb) $(RM) -f $(DestBytecodeLib)
1346 #---------------------------------------------------------
1348 # If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
1349 # building an archive.
1350 #---------------------------------------------------------
1351 ifndef NO_BUILD_ARCHIVE
1352 ifndef BUILD_ARCHIVE
1353 ifndef LOADABLE_MODULE
1359 #---------------------------------------------------------
1360 # Archive Library Targets:
1361 # If the user wanted a regular archive library built,
1362 # then we provide targets for building them.
1363 #---------------------------------------------------------
1366 all-local:: $(LibName.A)
1368 $(LibName.A): $(ObjectsO) $(LibDir)/.dir
1369 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
1370 -$(Verb) $(RM) -f $@
1371 $(Verb) $(Archive) $@ $(ObjectsO)
1372 $(Verb) $(Ranlib) $@
1375 ifneq ($(strip $(LibName.A)),)
1376 -$(Verb) $(RM) -f $(LibName.A)
1381 $(Echo) Install circumvented with NO_INSTALL
1383 $(Echo) Uninstall circumvented with NO_INSTALL
1385 ifdef NO_INSTALL_ARCHIVES
1387 $(Echo) Install circumvented with NO_INSTALL
1389 $(Echo) Uninstall circumvented with NO_INSTALL
1391 DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a
1393 install-local:: $(DestArchiveLib)
1395 $(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
1396 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
1397 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
1398 $(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
1401 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
1402 -$(Verb) $(RM) -f $(DestArchiveLib)
1410 ###############################################################################
1411 # Tool Build Rules: Build executable tool based on TOOLNAME option
1412 ###############################################################################
1416 #---------------------------------------------------------
1417 # Set up variables for building a tool.
1418 #---------------------------------------------------------
1419 TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
1421 ToolBuildPath := $(ExmplDir)/$(TOOLEXENAME)
1423 ToolBuildPath := $(ToolDir)/$(TOOLEXENAME)
1426 # TOOLALIAS is a name to symlink (or copy) the tool to.
1429 ToolAliasBuildPath := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1431 ToolAliasBuildPath := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1435 #---------------------------------------------------------
1437 #---------------------------------------------------------
1439 # If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
1440 # not exporting all of the weak symbols from the binary. This reduces dyld
1441 # startup time by 4x on darwin in some cases.
1442 ifdef TOOL_NO_EXPORTS
1443 ifeq ($(HOST_OS),Darwin)
1445 # Tiger tools don't support this.
1446 ifneq ($(DARWIN_MAJVERS),4)
1447 LD.Flags += -Wl,-exported_symbol,_main
1451 ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU))
1452 ifneq ($(ARCH), Mips)
1453 LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
1458 #---------------------------------------------------------
1459 # Tool Order File Support
1460 #---------------------------------------------------------
1462 ifeq ($(HOST_OS),Darwin)
1463 ifdef TOOL_ORDER_FILE
1465 LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
1470 #---------------------------------------------------------
1471 # Tool Version Info Support
1472 #---------------------------------------------------------
1474 ifeq ($(HOST_OS),Darwin)
1475 ifdef TOOL_INFO_PLIST
1477 LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST)
1479 $(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST)
1481 $(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir
1482 $(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..."
1483 $(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \
1484 -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \
1485 -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \
1486 -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \
1492 #---------------------------------------------------------
1493 # Provide targets for building the tools
1494 #---------------------------------------------------------
1495 all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
1498 ifneq ($(strip $(ToolBuildPath)),)
1499 -$(Verb) $(RM) -f $(ToolBuildPath)
1501 ifneq ($(strip $(ToolAliasBuildPath)),)
1502 -$(Verb) $(RM) -f $(ToolAliasBuildPath)
1506 $(ToolBuildPath): $(ExmplDir)/.dir
1508 $(ToolBuildPath): $(ToolDir)/.dir
1511 ifdef CODESIGN_TOOLS
1512 TOOL_CODESIGN_IDENTITY ?= -
1514 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1515 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1516 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1517 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1518 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1520 $(Echo) ======= Code-Signing $(BuildMode) Executable $(TOOLNAME)
1521 $(Verb) codesign -s $(TOOL_CODESIGN_IDENTITY) $@
1523 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1524 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1525 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1526 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1527 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1531 ifneq ($(strip $(ToolAliasBuildPath)),)
1532 $(ToolAliasBuildPath): $(ToolBuildPath)
1533 $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
1534 $(Verb) $(RM) -f $(ToolAliasBuildPath)
1535 $(Verb) $(AliasTool) $(notdir $(ToolBuildPath)) $(ToolAliasBuildPath)
1536 $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
1542 $(Echo) Install circumvented with NO_INSTALL
1544 $(Echo) Uninstall circumvented with NO_INSTALL
1548 ToolBinDir = $(DESTDIR)$(PROJ_internal_prefix)/bin
1550 ToolBinDir = $(DESTDIR)$(PROJ_bindir)
1552 DestTool = $(ToolBinDir)/$(program_prefix)$(TOOLEXENAME)
1554 install-local:: $(DestTool)
1556 $(DestTool): $(ToolBuildPath)
1557 $(Echo) Installing $(BuildMode) $(DestTool)
1558 $(Verb) $(MKDIR) $(ToolBinDir)
1559 $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
1562 $(Echo) Uninstalling $(BuildMode) $(DestTool)
1563 -$(Verb) $(RM) -f $(DestTool)
1565 # TOOLALIAS install.
1567 DestToolAlias = $(ToolBinDir)/$(program_prefix)$(TOOLALIAS)$(EXEEXT)
1569 install-local:: $(DestToolAlias)
1571 $(DestToolAlias): $(DestTool)
1572 $(Echo) Installing $(BuildMode) $(DestToolAlias)
1573 $(Verb) $(RM) -f $(DestToolAlias)
1574 $(Verb) $(AliasTool) $(notdir $(DestTool)) $(DestToolAlias)
1577 $(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
1578 -$(Verb) $(RM) -f $(DestToolAlias)
1584 ###############################################################################
1585 # Object Build Rules: Build object files based on sources
1586 ###############################################################################
1588 # FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
1589 ifeq ($(HOST_OS),HP-UX)
1590 DISABLE_AUTO_DEPENDENCIES=1
1593 # Provide rule sets for when dependency generation is enabled
1594 ifndef DISABLE_AUTO_DEPENDENCIES
1596 #---------------------------------------------------------
1597 # Create .o files in the ObjDir directory from the .cpp and .c files...
1598 #---------------------------------------------------------
1600 DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
1601 -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
1603 # If the build succeeded, move the dependency file over, otherwise
1605 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
1606 else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
1608 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1609 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1610 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1613 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1614 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1615 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1618 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1619 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1620 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1623 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1624 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1625 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1628 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1629 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1630 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1633 #---------------------------------------------------------
1634 # Create .bc files in the ObjDir directory from .cpp .cc and .c files...
1635 #---------------------------------------------------------
1637 BC_DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.bc.d.tmp" \
1638 -MT "$(ObjDir)/$*.ll" -MT "$(ObjDir)/$*.bc.d"
1640 # If the build succeeded, move the dependency file over, otherwise
1642 BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d"; \
1643 else $(RM) "$(ObjDir)/$*.bc.d.tmp"; exit 1; fi
1645 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1646 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1647 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1648 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1649 $(BC_DEPEND_MOVEFILE)
1651 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1652 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1653 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1654 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1655 $(BC_DEPEND_MOVEFILE)
1657 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1658 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1659 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1660 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1661 $(BC_DEPEND_MOVEFILE)
1663 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1664 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1665 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1666 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1667 $(BC_DEPEND_MOVEFILE)
1669 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1670 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1671 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1672 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1673 $(BC_DEPEND_MOVEFILE)
1675 # Provide alternate rule sets if dependencies are disabled
1678 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1679 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1680 $(Compile.CXX) $< -o $@
1682 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1683 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1684 $(Compile.CXX) $< -o $@
1686 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1687 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1688 $(Compile.CXX) $< -o $@
1690 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1691 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1692 $(Compile.C) $< -o $@
1694 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1695 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1696 $(Compile.C) $< -o $@
1698 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1699 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1700 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1702 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1703 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1704 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1706 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1707 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1708 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1710 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1711 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1712 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1714 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1715 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1716 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1721 ## Rules for building preprocessed (.i/.ii) outputs.
1722 $(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1723 $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
1724 $(Verb) $(Preprocess.CXX) $< -o $@
1726 $(BuildMode)/%.ii: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1727 $(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file"
1728 $(Verb) $(Preprocess.CXX) $< -o $@
1730 $(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1731 $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
1732 $(Verb) $(Preprocess.CXX) $< -o $@
1734 $(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1735 $(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
1736 $(Verb) $(Preprocess.C) $< -o $@
1738 $(BuildMode)/%.i: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1739 $(Echo) "Compiling $*.m for $(BuildMode) build to .i file"
1740 $(Verb) $(Preprocess.C) $< -o $@
1743 $(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1744 $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
1745 $(Compile.CXX) $< -o $@ -S
1747 $(ObjDir)/%.s: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1748 $(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG)
1749 $(Compile.CXX) $< -o $@ -S
1751 $(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1752 $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
1753 $(Compile.CXX) $< -o $@ -S
1755 $(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1756 $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
1757 $(Compile.C) $< -o $@ -S
1759 $(ObjDir)/%.s: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1760 $(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG)
1761 $(Compile.C) $< -o $@ -S
1764 # make the C and C++ compilers strip debug info out of bytecode libraries.
1766 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1767 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1768 $(Verb) $(LOPT) $< -std-compile-opts -o $@
1770 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1771 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1772 $(Verb) $(LOPT) $< -std-compile-opts -strip-debug -o $@
1776 #---------------------------------------------------------
1777 # Provide rule to build .bc files from .ll sources,
1778 # regardless of dependencies
1779 #---------------------------------------------------------
1780 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
1781 $(Echo) "Compiling $*.ll for $(BuildMode) build"
1782 $(Verb) $(LLVMAS) $< -f -o $@
1784 ###############################################################################
1785 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
1786 ###############################################################################
1789 TABLEGEN_INC_FILES_COMMON = 1
1792 ifdef TABLEGEN_INC_FILES_COMMON
1794 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
1795 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1796 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
1798 # INCFiles rule: All of the tblgen generated files are emitted to
1799 # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
1800 # us to only "touch" the real file if the contents of it change. IOW, if
1801 # tblgen is modified, all of the .inc.tmp files are regenerated, but no
1802 # dependencies of the .inc files are, unless the contents of the .inc file
1804 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
1805 $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
1807 endif # TABLEGEN_INC_FILES_COMMON
1811 TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
1812 $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \
1813 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \
1814 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \
1815 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \
1816 $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
1817 $(wildcard $(LLVM_SRC_ROOT)/include/llvm/IR/Intrinsics*.td)
1819 # All .inc.tmp files depend on the .td files.
1820 $(INCTMPFiles) : $(TDFiles)
1822 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1823 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1824 $(Echo) "Building $(<F) register info implementation with tblgen"
1825 $(Verb) $(LLVMTableGen) -gen-register-info -o $(call SYSPATH, $@) $<
1827 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1828 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1829 $(Echo) "Building $(<F) instruction information with tblgen"
1830 $(Verb) $(LLVMTableGen) -gen-instr-info -o $(call SYSPATH, $@) $<
1832 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1833 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1834 $(Echo) "Building $(<F) assembly writer with tblgen"
1835 $(Verb) $(LLVMTableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
1837 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1838 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1839 $(Echo) "Building $(<F) assembly writer #1 with tblgen"
1840 $(Verb) $(LLVMTableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
1842 $(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
1843 $(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1844 $(Echo) "Building $(<F) assembly matcher with tblgen"
1845 $(Verb) $(LLVMTableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
1847 $(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \
1848 $(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1849 $(Echo) "Building $(<F) MC code emitter with tblgen"
1850 $(Verb) $(LLVMTableGen) -gen-emitter -mc-emitter -o $(call SYSPATH, $@) $<
1852 $(TARGET:%=$(ObjDir)/%GenMCPseudoLowering.inc.tmp): \
1853 $(ObjDir)/%GenMCPseudoLowering.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1854 $(Echo) "Building $(<F) MC Pseudo instruction expander with tblgen"
1855 $(Verb) $(LLVMTableGen) -gen-pseudo-lowering -o $(call SYSPATH, $@) $<
1857 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1858 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1859 $(Echo) "Building $(<F) code emitter with tblgen"
1860 $(Verb) $(LLVMTableGen) -gen-emitter -o $(call SYSPATH, $@) $<
1862 $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
1863 $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1864 $(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
1865 $(Verb) $(LLVMTableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
1867 $(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \
1868 $(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1869 $(Echo) "Building $(<F) disassembly tables with tblgen"
1870 $(Verb) $(LLVMTableGen) -gen-disassembler -o $(call SYSPATH, $@) $<
1872 $(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
1873 $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1874 $(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
1875 $(Verb) $(LLVMTableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
1877 $(TARGET:%=$(ObjDir)/%GenSubtargetInfo.inc.tmp): \
1878 $(ObjDir)/%GenSubtargetInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1879 $(Echo) "Building $(<F) subtarget information with tblgen"
1880 $(Verb) $(LLVMTableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
1882 $(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
1883 $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1884 $(Echo) "Building $(<F) calling convention information with tblgen"
1885 $(Verb) $(LLVMTableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
1887 $(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
1888 $(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1889 $(Echo) "Building $(<F) intrinsics information with tblgen"
1890 $(Verb) $(LLVMTableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
1892 $(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1893 $(Echo) "Building $(<F) decoder tables with tblgen"
1894 $(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $<
1896 $(ObjDir)/%GenDFAPacketizer.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1897 $(Echo) "Building $(<F) DFA packetizer tables with tblgen"
1898 $(Verb) $(LLVMTableGen) -gen-dfa-packetizer -o $(call SYSPATH, $@) $<
1901 -$(Verb) $(RM) -f $(INCFiles)
1905 ###############################################################################
1906 # OTHER RULES: Other rules needed
1907 ###############################################################################
1909 # To create postscript files from dot files...
1910 ifneq ($(DOT),false)
1912 $(DOT) -Tps < $< > $@
1915 $(Echo) "Cannot build $@: The program dot is not installed"
1918 # This rules ensures that header files that are removed still have a rule for
1919 # which they can be "generated." This allows make to ignore them and
1920 # reproduce the dependency lists.
1924 # Define clean-local to clean the current directory. Note that this uses a
1925 # very conservative approach ensuring that empty variables do not cause
1926 # errors or disastrous removal.
1928 ifneq ($(strip $(ObjRootDir)),)
1929 -$(Verb) $(RM) -rf $(ObjRootDir)
1931 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1932 -$(Verb) $(RM) -f *$(SHLIBEXT)
1936 -$(Verb) $(RM) -rf Debug Release Profile
1939 ###############################################################################
1940 # DEPENDENCIES: Include the dependency files if we should
1941 ###############################################################################
1942 ifndef DISABLE_AUTO_DEPENDENCIES
1944 # If its not one of the cleaning targets
1945 ifndef IS_CLEANING_TARGET
1947 # Get the list of dependency files
1948 DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources)))
1949 DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
1951 # Include bitcode dependency files if using bitcode libraries
1952 ifdef BYTECODE_LIBRARY
1953 DependFiles += $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.bc.d)
1956 -include $(DependFiles) ""
1962 ###############################################################################
1963 # CHECK: Running the test suite
1964 ###############################################################################
1967 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1968 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1969 $(EchoCmd) Running test suite ; \
1970 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
1971 TESTSUITE=$(TESTSUITE) ; \
1973 $(EchoCmd) No Makefile in test directory ; \
1976 $(EchoCmd) No test directory ; \
1979 # An alias dating from when both lit and DejaGNU test runners were used.
1983 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1984 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1985 $(EchoCmd) Running test suite ; \
1986 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \
1988 $(EchoCmd) No Makefile in test directory ; \
1991 $(EchoCmd) No test directory ; \
1994 ###############################################################################
1995 # UNITTESTS: Running the unittests test suite
1996 ###############################################################################
1999 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
2000 if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
2001 $(EchoCmd) Running unittests test suite ; \
2002 $(MAKE) -C $(PROJ_OBJ_ROOT)/unittests unitcheck; \
2004 $(EchoCmd) No Makefile in unittests directory ; \
2007 $(EchoCmd) No unittests directory ; \
2010 ###############################################################################
2011 # DISTRIBUTION: Handle construction of a distribution tarball
2012 ###############################################################################
2014 #------------------------------------------------------------------------
2015 # Define distribution related variables
2016 #------------------------------------------------------------------------
2017 DistName := $(PROJECT_NAME)-$(PROJ_VERSION)
2018 DistDir := $(PROJ_OBJ_ROOT)/$(DistName)
2019 TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName)
2020 DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
2021 DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip
2022 DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
2023 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
2024 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
2025 Makefile.config.in configure autoconf
2026 DistOther := $(notdir $(wildcard \
2027 $(PROJ_SRC_DIR)/*.h \
2028 $(PROJ_SRC_DIR)/*.td \
2029 $(PROJ_SRC_DIR)/*.def \
2030 $(PROJ_SRC_DIR)/*.ll \
2031 $(PROJ_SRC_DIR)/*.in))
2032 DistSubDirs := $(SubDirs)
2033 DistSources = $(Sources) $(EXTRA_DIST)
2034 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
2036 #------------------------------------------------------------------------
2037 # We MUST build distribution with OBJ_DIR != SRC_DIR
2038 #------------------------------------------------------------------------
2039 ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
2040 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
2041 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
2045 #------------------------------------------------------------------------
2046 # Prevent attempt to run dist targets from anywhere but the top level
2047 #------------------------------------------------------------------------
2049 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
2050 $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
2053 #------------------------------------------------------------------------
2054 # Provide the top level targets
2055 #------------------------------------------------------------------------
2057 dist-gzip:: $(DistTarGZip)
2059 $(DistTarGZip) : $(TopDistDir)/.makedistdir
2060 $(Echo) Packing gzipped distribution tar file.
2061 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
2062 $(GZIP) -c > "$(DistTarGZip)"
2064 dist-bzip2:: $(DistTarBZ2)
2066 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
2067 $(Echo) Packing bzipped distribution tar file.
2068 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
2069 $(BZIP2) -c >$(DistTarBZ2)
2071 dist-zip:: $(DistZip)
2073 $(DistZip) : $(TopDistDir)/.makedistdir
2074 $(Echo) Packing zipped distribution file.
2075 $(Verb) rm -f $(DistZip)
2076 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
2078 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
2079 $(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL =====
2081 DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
2083 dist-check:: $(DistTarGZip)
2084 $(Echo) Checking distribution tar file.
2085 $(Verb) if test -d $(DistCheckDir) ; then \
2086 $(RM) -rf $(DistCheckDir) ; \
2088 $(Verb) $(MKDIR) $(DistCheckDir)
2089 $(Verb) cd $(DistCheckDir) && \
2090 $(MKDIR) $(DistCheckDir)/build && \
2091 $(MKDIR) $(DistCheckDir)/install && \
2092 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
2094 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
2095 --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
2098 $(MAKE) unittests && \
2099 $(MAKE) install && \
2100 $(MAKE) uninstall && \
2101 $(MAKE) dist-clean && \
2102 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
2105 $(Echo) Cleaning distribution files
2106 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
2111 #------------------------------------------------------------------------
2112 # Provide the recursive distdir target for building the distribution directory
2113 #------------------------------------------------------------------------
2114 distdir: $(DistDir)/.makedistdir
2115 $(DistDir)/.makedistdir: $(DistSources)
2116 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2117 if test -d "$(DistDir)" ; then \
2118 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
2121 $(EchoCmd) Removing old $(DistDir) ; \
2122 $(RM) -rf $(DistDir); \
2123 $(EchoCmd) Making 'all' to verify build ; \
2124 $(MAKE) ENABLE_OPTIMIZED=1 all ; \
2126 $(Echo) Building Distribution Directory $(DistDir)
2127 $(Verb) $(MKDIR) $(DistDir)
2128 $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
2129 srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
2130 for file in $(DistFiles) ; do \
2132 $(PROJ_SRC_DIR)/*) \
2133 file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
2135 $(PROJ_SRC_ROOT)/*) \
2136 file=`echo "$$file" | \
2137 sed "s#^$$srcrootstrip/##"` \
2140 if test -f "$(PROJ_SRC_DIR)/$$file" || \
2141 test -d "$(PROJ_SRC_DIR)/$$file" ; then \
2142 from_dir="$(PROJ_SRC_DIR)" ; \
2143 elif test -f "$$file" || test -d "$$file" ; then \
2146 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
2147 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
2148 to_dir="$(DistDir)/$$dir"; \
2149 $(MKDIR) "$$to_dir" ; \
2151 to_dir="$(DistDir)"; \
2153 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
2154 if test -n "$$mid_dir" ; then \
2155 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
2157 if test -d "$$from_dir/$$file"; then \
2158 if test -d "$(PROJ_SRC_DIR)/$$file" && \
2159 test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
2160 cd $(PROJ_SRC_DIR) ; \
2161 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2162 ( cd $$to_dir ; $(TAR) xf - ) ; \
2163 cd $(PROJ_OBJ_DIR) ; \
2166 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2167 ( cd $$to_dir ; $(TAR) xf - ) ; \
2168 cd $(PROJ_OBJ_DIR) ; \
2170 elif test -f "$$from_dir/$$file" ; then \
2171 $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
2172 elif test -L "$$from_dir/$$file" ; then \
2173 $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
2174 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
2175 $(EchoCmd) "===== WARNING: Distribution Source " \
2176 "$$from_dir/$$file Not Found!" ; \
2177 elif test "$(Verb)" != '@' ; then \
2178 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
2181 $(Verb) for subdir in $(DistSubDirs) ; do \
2182 if test "$$subdir" \!= "." ; then \
2183 new_distdir="$(DistDir)/$$subdir" ; \
2184 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
2185 ( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
2186 DistDir="$$new_distdir" distdir ) || exit 1; \
2189 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2190 $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
2191 $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
2192 -name .svn \) -print` ;\
2193 $(MAKE) dist-hook ; \
2194 $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
2195 -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
2196 -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
2197 -o ! -type d ! -perm -444 -exec \
2198 $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
2199 || chmod -R a+r $(DistDir) ; \
2202 # This is invoked by distdir target, define it as a no-op to avoid errors if not
2208 ###############################################################################
2209 # TOP LEVEL - targets only to apply at the top level directory
2210 ###############################################################################
2214 #------------------------------------------------------------------------
2215 # Install support for the project's include files:
2216 #------------------------------------------------------------------------
2219 $(Echo) Install circumvented with NO_INSTALL
2221 $(Echo) Uninstall circumvented with NO_INSTALL
2224 $(Echo) Installing include files
2225 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
2226 $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
2227 cd $(PROJ_SRC_ROOT)/include && \
2228 for hdr in `find . -type f \
2229 '(' -name LICENSE.TXT \
2234 ')' -print | grep -v CVS | \
2235 grep -v .svn` ; do \
2236 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2237 if test \! -d "$$instdir" ; then \
2238 $(EchoCmd) Making install directory $$instdir ; \
2239 $(MKDIR) $$instdir ;\
2241 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2244 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
2245 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
2246 cd $(PROJ_OBJ_ROOT)/include && \
2247 for hdr in `find . -type f \
2248 '(' -name LICENSE.TXT \
2253 ')' -print | grep -v CVS | \
2254 grep -v .svn` ; do \
2255 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2256 if test \! -d "$$instdir" ; then \
2257 $(EchoCmd) Making install directory $$instdir ; \
2258 $(MKDIR) $$instdir ;\
2260 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2266 $(Echo) Uninstalling include files
2267 $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
2268 cd $(PROJ_SRC_ROOT)/include && \
2269 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
2270 '!' '(' -name '*~' -o -name '.#*' \
2271 -o -name '*.in' ')' -print ')' | \
2272 grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2273 cd $(PROJ_SRC_ROOT)/include && \
2274 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
2275 -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2281 @echo searching for overlength lines in files: $(Sources)
2284 egrep -n '.{81}' $(Sources) /dev/null
2287 @echo searching for tabs in files: $(Sources)
2290 egrep -n ' ' $(Sources) /dev/null
2293 @ls -l $(LibDir) | awk '\
2294 BEGIN { sum = 0; } \
2296 END { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2297 @ls -l $(ToolDir) | awk '\
2298 BEGIN { sum = 0; } \
2300 END { printf("Programs: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2301 #------------------------------------------------------------------------
2302 # Print out the directories used for building
2303 #------------------------------------------------------------------------
2305 $(Echo) "BuildMode : " '$(BuildMode)'
2306 $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
2307 $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
2308 $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
2309 $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
2310 $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
2311 $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
2312 $(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
2313 $(Echo) "PROJ_internal_prefix : " '$(PROJ_internal_prefix)'
2314 $(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
2315 $(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
2316 $(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
2317 $(Echo) "PROJ_includedir : " '$(PROJ_includedir)'
2318 $(Echo) "UserTargets : " '$(UserTargets)'
2319 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
2320 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
2321 $(Echo) "ObjDir : " '$(ObjDir)'
2322 $(Echo) "LibDir : " '$(LibDir)'
2323 $(Echo) "ToolDir : " '$(ToolDir)'
2324 $(Echo) "ExmplDir : " '$(ExmplDir)'
2325 $(Echo) "Sources : " '$(Sources)'
2326 $(Echo) "TDFiles : " '$(TDFiles)'
2327 $(Echo) "INCFiles : " '$(INCFiles)'
2328 $(Echo) "INCTMPFiles : " '$(INCTMPFiles)'
2329 $(Echo) "PreConditions: " '$(PreConditions)'
2330 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
2331 $(Echo) "Compile.C : " '$(Compile.C)'
2332 $(Echo) "Archive : " '$(Archive)'
2333 $(Echo) "YaccFiles : " '$(YaccFiles)'
2334 $(Echo) "LexFiles : " '$(LexFiles)'
2335 $(Echo) "Module : " '$(Module)'
2336 $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
2337 $(Echo) "SubDirs : " '$(SubDirs)'
2338 $(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
2339 $(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
2344 # General debugging rule, use 'make dbg-print-XXX' to print the
2345 # definition, value and origin of XXX.
2347 $(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))