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) $(LLVMBuildTool) \
101 --native-target "$(TARGET_NATIVE_ARCH)" \
102 --enable-targets "$(TARGETS_TO_BUILD)" \
103 --write-library-table $(LLVMConfigLibraryDependenciesInc) \
104 --write-make-fragment $(LLVMBuildMakeFrag)
106 # For completeness, let Make know how the extra files are generated.
107 $(LLVMConfigLibraryDependenciesInc): $(LLVMBuildMakeFrag)
109 # Include the generated Makefile fragment.
111 # We currently only include the dependencies for the fragment itself if we are
112 # at the top-level. Otherwise, recursive invocations would ends up doing
113 # substantially more redundant stat'ing.
115 # This means that we won't properly regenerate things for developers used to
116 # building from a subdirectory, but that is always somewhat unreliable.
118 LLVMBUILD_INCLUDE_DEPENDENCIES := 1
120 # Clean the generated makefile fragment at the top-level.
122 -$(Verb) $(RM) -f $(LLVMBuildMakeFrag)
124 -include $(LLVMBuildMakeFrag)
126 ################################################################################
127 # PRECONDITIONS: that which must be built/checked first
128 ################################################################################
130 SrcMakefiles := $(filter %Makefile %Makefile.tests,\
131 $(wildcard $(PROJ_SRC_DIR)/Makefile*))
132 ObjMakefiles := $(subst $(PROJ_SRC_DIR),$(PROJ_OBJ_DIR),$(SrcMakefiles))
133 ConfigureScript := $(PROJ_SRC_ROOT)/configure
134 ConfigStatusScript := $(PROJ_OBJ_ROOT)/config.status
135 MakefileConfigIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.config.in))
136 MakefileCommonIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.common.in))
137 MakefileConfig := $(PROJ_OBJ_ROOT)/Makefile.config
138 MakefileCommon := $(PROJ_OBJ_ROOT)/Makefile.common
139 PreConditions := $(ConfigStatusScript) $(ObjMakefiles)
140 ifneq ($(MakefileCommonIn),)
141 PreConditions += $(MakefileCommon)
144 ifneq ($(MakefileConfigIn),)
145 PreConditions += $(MakefileConfig)
148 preconditions: $(PreConditions)
150 #------------------------------------------------------------------------
151 # Make sure the BUILT_SOURCES are built first
152 #------------------------------------------------------------------------
153 $(filter-out clean clean-local,$(UserTargets)):: $(BUILT_SOURCES)
156 ifneq ($(strip $(BUILT_SOURCES)),)
157 -$(Verb) $(RM) -f $(BUILT_SOURCES)
160 ifneq ($(PROJ_OBJ_ROOT),$(PROJ_SRC_ROOT))
162 $(Verb) if test -x config.status ; then \
163 $(EchoCmd) Wiping out $(PROJ_OBJ_ROOT) ; \
164 $(MKDIR) .spotless.save ; \
165 $(MV) config.status .spotless.save ; \
166 $(MV) mklib .spotless.save ; \
167 $(MV) projects .spotless.save ; \
169 $(MV) .spotless.save/config.status . ; \
170 $(MV) .spotless.save/mklib . ; \
171 $(MV) .spotless.save/projects . ; \
172 $(RM) -rf .spotless.save ; \
173 $(EchoCmd) Rebuilding configuration of $(PROJ_OBJ_ROOT) ; \
174 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
175 $(ConfigStatusScript) ; \
177 $(EchoCmd) "make spotless" can only be run from $(PROJ_OBJ_ROOT); \
181 $(EchoCmd) "spotless target not supported for objdir == srcdir"
184 $(BUILT_SOURCES) : $(ObjMakefiles)
186 #------------------------------------------------------------------------
187 # Make sure we're not using a stale configuration
188 #------------------------------------------------------------------------
190 $(Echo) Reconfiguring $(PROJ_OBJ_ROOT)
191 $(Verb) cd $(PROJ_OBJ_ROOT) && \
192 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
193 $(ConfigStatusScript)
195 .PRECIOUS: $(ConfigStatusScript)
196 $(ConfigStatusScript): $(ConfigureScript)
197 $(Echo) Reconfiguring with $<
198 $(Verb) cd $(PROJ_OBJ_ROOT) && \
199 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
200 $(ConfigStatusScript)
202 #------------------------------------------------------------------------
203 # Make sure the configuration makefile is up to date
204 #------------------------------------------------------------------------
205 ifneq ($(MakefileConfigIn),)
206 $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
207 $(Echo) Regenerating $@
208 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
211 ifneq ($(MakefileCommonIn),)
212 $(MakefileCommon): $(MakefileCommonIn) $(ConfigStatusScript)
213 $(Echo) Regenerating $@
214 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.common
217 #------------------------------------------------------------------------
218 # If the Makefile in the source tree has been updated, copy it over into the
219 # build tree. But, only do this if the source and object makefiles differ
220 #------------------------------------------------------------------------
222 PROJ_MAKEFILE := $(PROJ_SRC_DIR)/Makefile
225 ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
227 Makefile: $(PROJ_MAKEFILE) $(ExtraMakefiles)
228 $(Echo) "Updating Makefile"
229 $(Verb) $(MKDIR) $(@D)
230 $(Verb) $(CP) -f $< $@
232 # Copy the Makefile.* files unless we're in the root directory which avoids
233 # the copying of Makefile.config.in or other things that should be explicitly
235 $(PROJ_OBJ_DIR)/Makefile% : $(PROJ_MAKEFILE)%
237 *Makefile.rules) ;; \
239 *) $(EchoCmd) "Updating $(@F)" ; \
246 #------------------------------------------------------------------------
247 # Set up the basic dependencies
248 #------------------------------------------------------------------------
249 $(UserTargets):: $(PreConditions)
253 clean-all:: clean-local clean-all-local
254 install:: install-local
255 uninstall:: uninstall-local
256 install-local:: all-local
257 install-bytecode:: install-bytecode-local
259 ###############################################################################
260 # VARIABLES: Set up various variables based on configuration data
261 ###############################################################################
263 # Variable for if this make is for a "cleaning" target
264 ifneq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),)
268 #--------------------------------------------------------------------
269 # Variables derived from configuration we are building
270 #--------------------------------------------------------------------
273 ifeq ($(ENABLE_OPTIMIZED),1)
275 # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
276 ifneq ($(HOST_OS),FreeBSD)
277 ifneq ($(HOST_OS),Darwin)
278 OmitFramePointer := -fomit-frame-pointer
282 # Darwin requires -fstrict-aliasing to be explicitly enabled.
283 # Avoid -fstrict-aliasing on Darwin for now, there are unresolved issues
284 # with -fstrict-aliasing and ipa-type-escape radr://6756684
285 #ifeq ($(HOST_OS),Darwin)
286 # EXTRA_OPTIONS += -fstrict-aliasing -Wstrict-aliasing
288 CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
289 C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
290 LD.Flags += $(OPTIMIZE_OPTION)
292 BuildMode := $(BuildMode)+Debug
299 ifdef NO_DEBUG_SYMBOLS
300 BuildMode := Unoptimized
314 ifeq ($(ENABLE_LIBCPP),1)
315 CXX.Flags += -stdlib=libc++
316 LD.Flags += -stdlib=libc++
319 ifeq ($(ENABLE_PROFILING),1)
320 BuildMode := $(BuildMode)+Profile
321 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
322 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) -pg -g
323 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg -g
327 ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
328 CXX.Flags += -fvisibility-inlines-hidden
331 ifdef ENABLE_EXPENSIVE_CHECKS
332 # GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above.
333 # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40160
337 # IF REQUIRES_EH=1 is specified then don't disable exceptions
339 CXX.Flags += -fno-exceptions
341 # If the library requires EH, it also requires RTTI.
345 ifdef REQUIRES_FRAME_POINTER
346 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags))
347 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags))
348 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags))
351 # If REQUIRES_RTTI=1 is specified then don't disable run-time type id.
352 ifneq ($(REQUIRES_RTTI), 1)
353 CXX.Flags += -fno-rtti
356 ifeq ($(ENABLE_COVERAGE),1)
357 BuildMode := $(BuildMode)+Coverage
358 CXX.Flags += -ftest-coverage -fprofile-arcs
359 C.Flags += -ftest-coverage -fprofile-arcs
362 # If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
363 # then disable assertions by defining the appropriate preprocessor symbols.
364 ifeq ($(DISABLE_ASSERTIONS),1)
365 CPP.Defines += -DNDEBUG
367 BuildMode := $(BuildMode)+Asserts
368 CPP.Defines += -D_DEBUG
371 # If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
372 # configured), then enable expensive checks by defining the
373 # appropriate preprocessor symbols.
374 ifeq ($(ENABLE_EXPENSIVE_CHECKS),1)
375 BuildMode := $(BuildMode)+Checks
376 CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
379 # LOADABLE_MODULE implies several other things so we force them to be
381 ifdef LOADABLE_MODULE
383 LINK_LIBS_IN_SHARED := 1
391 ifeq ($(ENABLE_PIC),1)
392 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
393 # Nothing. Win32 defaults to PIC and warns when given -fPIC
395 ifeq ($(HOST_OS),Darwin)
396 # Common symbols not allowed in dylib files
397 CXX.Flags += -fno-common
398 C.Flags += -fno-common
400 # Linux and others; pass -fPIC
406 ifeq ($(HOST_OS),Darwin)
407 CXX.Flags += -mdynamic-no-pic
408 C.Flags += -mdynamic-no-pic
412 # Support makefile variable to disable any kind of timestamp/non-deterministic
413 # info from being used in the build.
414 ifeq ($(ENABLE_TIMESTAMPS),1)
415 DOTDIR_TIMESTAMP_COMMAND := $(DATE)
417 DOTDIR_TIMESTAMP_COMMAND := echo 'Created.'
420 ifeq ($(HOST_OS),MingW)
422 CPP.Defines += -D__NO_CTYPE_INLINE
423 ifeq ($(LLVM_CROSS_COMPILING),1)
424 # Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016
426 LD.Flags += -Wl,--allow-multiple-definition
431 CXX.Flags += -Woverloaded-virtual
432 CPP.BaseFlags += $(CPP.Defines)
435 # Make Floating point IEEE compliant on Alpha.
438 CPP.BaseFlags += -mieee
439 ifeq ($(ENABLE_PIC),0)
441 CPP.BaseFlags += -fPIC
444 LD.Flags += -Wl,--no-relax
447 # GNU ld/PECOFF accepts but ignores them below;
451 # FIXME: autoconf should be aware of them.
452 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
453 HAVE_LINK_VERSION_SCRIPT := 0
455 RDYNAMIC := -Wl,--export-all-symbols
458 #--------------------------------------------------------------------
459 # Directory locations
460 #--------------------------------------------------------------------
462 ifeq ($(LLVM_CROSS_COMPILING),1)
463 BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin
466 ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode)
467 ObjDir := $(ObjRootDir)
468 LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
469 ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
470 ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
471 LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
472 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
473 LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
475 #--------------------------------------------------------------------
476 # Locations of shared libraries
477 #--------------------------------------------------------------------
480 SharedLibDir := $(LibDir)
481 LLVMSharedLibDir := $(LLVMLibDir)
483 # Win32.DLL prefers to be located on the "PATH" of binaries.
484 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
485 SharedLibDir := $(ToolDir)
486 LLVMSharedLibDir := $(LLVMToolDir)
488 ifeq ($(HOST_OS),Cygwin)
495 #--------------------------------------------------------------------
496 # LLVM Capable Compiler
497 #--------------------------------------------------------------------
499 ifneq ($(findstring llvm-gcc,$(LLVMCC_OPTION)),)
501 LLVMCXX := $(LLVMGXX)
503 ifneq ($(findstring clang,$(LLVMCC_OPTION)),)
504 ifneq ($(CLANGPATH),)
505 LLVMCC := $(CLANGPATH)
506 LLVMCXX := $(CLANGXXPATH)
508 ifeq ($(ENABLE_BUILT_CLANG),1)
509 LLVMCC := $(LLVMToolDir)/clang
510 LLVMCXX := $(LLVMToolDir)/clang++
516 #--------------------------------------------------------------------
517 # Full Paths To Compiled Tools and Utilities
518 #--------------------------------------------------------------------
519 EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
520 ifdef BUILD_DIRS_ONLY
521 EchoCmd := $(EchoCmd) "(build tools)":
526 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
529 ifeq ($(LLVM_CROSS_COMPILING),1)
530 LLVM_TBLGEN := $(BuildLLVMToolDir)/llvm-tblgen$(BUILD_EXEEXT)
532 LLVM_TBLGEN := $(LLVMToolDir)/llvm-tblgen$(EXEEXT)
535 ifeq ($(LLVM_CROSS_COMPILING),1)
536 LLVM_CONFIG := $(BuildLLVMToolDir)/llvm-config$(BUILD_EXEEXT)
538 LLVM_CONFIG := $(LLVMToolDir)/llvm-config$(EXEEXT)
541 LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
544 LLI := $(LLVMToolDir)/lli$(EXEEXT)
547 LLC := $(LLVMToolDir)/llc$(EXEEXT)
550 LOPT := $(LLVMToolDir)/opt$(EXEEXT)
553 LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
556 #--------------------------------------------------------------------
557 # Adjust to user's request
558 #--------------------------------------------------------------------
560 ifeq ($(HOST_OS),Darwin)
561 DARWIN_VERSION := `sw_vers -productVersion`
562 # Strip a number like 10.4.7 to 10.4
563 DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/')
564 # Get "4" out of 10.4 for later pieces in the makefile.
565 DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
567 LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress
568 SharedLinkOptions := -dynamiclib
570 SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
573 SharedLinkOptions=-shared
576 ifeq ($(TARGET_OS),Darwin)
578 TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
583 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
584 ifneq ($(HOST_OS),Darwin)
585 LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
597 # Adjust settings for verbose mode
600 AR.Flags += >/dev/null 2>/dev/null
601 ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
603 ConfigureScriptFLAGS :=
606 # By default, strip symbol information from executable
608 Strip := $(PLATFORMSTRIPOPTS)
609 StripWarnMsg := "(without symbols)"
610 Install.StripFlag += -s
613 ifdef TOOL_NO_EXPORTS
616 DynamicFlag := $(RDYNAMIC)
619 # Adjust linker flags for building an executable
620 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
621 ifneq ($(HOST_OS), Darwin)
623 LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
625 LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
627 LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
631 ifneq ($(DARWIN_MAJVERS),4)
632 LD.Flags += $(RPATH) -Wl,@executable_path/../lib
638 #----------------------------------------------------------
639 # Options To Invoke Tools
640 #----------------------------------------------------------
642 ifdef EXTRA_LD_OPTIONS
643 LD.Flags += $(EXTRA_LD_OPTIONS)
647 CompileCommonOpts += -pedantic -Wno-long-long
649 CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
650 $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT)
651 # Enable cast-qual for C++; the workaround is to use const_cast.
652 CXX.Flags += -Wcast-qual
654 ifeq ($(HOST_OS),HP-UX)
655 CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
658 # If we are building a universal binary on Mac OS/X, pass extra options. This
659 # is useful to people that want to link the LLVM libraries into their universal
662 # The following can be optionally specified:
663 # UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
664 # For Mac OS/X 10.4 Intel machines, the traditional one is:
665 # UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
666 # UNIVERSAL_ARCH can be optionally specified to be a list of architectures
667 # to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64". This defaults to
670 ifndef UNIVERSAL_ARCH
671 UNIVERSAL_ARCH := i386 ppc
673 UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
674 CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
675 ifdef UNIVERSAL_SDK_PATH
676 CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
679 # Building universal cannot compute dependencies automatically.
680 DISABLE_AUTO_DEPENDENCIES=1
682 ifeq ($(TARGET_OS),Darwin)
683 ifeq ($(ARCH),x86_64)
684 TargetCommonOpts = -m64
687 TargetCommonOpts = -m32
693 ifeq ($(HOST_OS),SunOS)
694 CPP.BaseFlags += -include llvm/Support/Solaris.h
697 ifeq ($(HOST_OS),AuroraUX)
698 CPP.BaseFlags += -include llvm/Support/Solaris.h
699 endif # !HOST_OS - AuroraUX.
701 # On Windows, SharedLibDir != LibDir. The order is important.
702 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
703 LD.Flags += -L$(SharedLibDir) -L$(LibDir) -L$(LLVMToolDir) -L$(LLVMLibDir)
705 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
708 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
709 # All -I flags should go here, so that they don't confuse llvm-config.
710 CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
711 $(patsubst %,-I%/include,\
712 $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
713 $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
716 ifeq ($(INCLUDE_BUILD_DIR),1)
717 CPP.Flags += -I$(ObjDir)
720 # SHOW_DIAGNOSTICS support.
721 ifeq ($(SHOW_DIAGNOSTICS),1)
722 Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
723 CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
728 Compile.C = $(Compile.Wrapper) \
729 $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
730 $(TargetCommonOpts) $(CompileCommonOpts) -c
731 Compile.CXX = $(Compile.Wrapper) \
732 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
733 $(TargetCommonOpts) $(CompileCommonOpts) -c
734 Preprocess.CXX= $(Compile.Wrapper) \
735 $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
736 $(CompileCommonOpts) $(CXX.Flags) -E
737 Link = $(Compile.Wrapper) \
738 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
739 $(LDFLAGS) $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
741 BCCompile.C = $(LLVMCC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
742 $(TargetCommonOpts) $(CompileCommonOpts)
743 Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
744 $(TargetCommonOpts) $(CompileCommonOpts) -E
746 BCCompile.CXX = $(LLVMCXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
747 $(TargetCommonOpts) $(CompileCommonOpts)
749 ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
750 ScriptInstall = $(INSTALL) -m 0755
751 DataInstall = $(INSTALL) -m 0644
753 # When compiling under Mingw/Cygwin, the tblgen tool expects Windows
754 # paths. In this case, the SYSPATH function (defined in
755 # Makefile.config) transforms Unix paths into Windows paths.
756 TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
757 -I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
758 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
759 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
760 LLVMTableGen = $(LLVM_TBLGEN) $(TableGen.Flags)
762 Archive = $(AR) $(AR.Flags)
763 LArchive = $(LLVMToolDir)/llvm-ar rcsf
772 #----------------------------------------------------------
773 # Get the list of source files and compute object file
775 #----------------------------------------------------------
778 Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
779 $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
781 Sources := $(SOURCES)
785 Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
788 BaseNameSources := $(sort $(basename $(Sources)))
790 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
791 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
793 #----------------------------------------------------------
794 # For Mingw MSYS bash and Python/w32:
796 # $(ECHOPATH) prints DOSish pathstring.
797 # ex) $(ECHOPATH) /include/sys/types.h
798 # --> C:/mingw/include/sys/types.h
799 # built-in "echo" does not transform path to DOSish path.
801 # FIXME: It would not be needed when MSYS's python
803 #----------------------------------------------------------
805 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
806 ECHOPATH := $(Verb)python -u -c "import sys;print ' '.join(sys.argv[1:])"
808 ECHOPATH := $(Verb)$(ECHO)
811 ###############################################################################
812 # DIRECTORIES: Handle recursive descent of directory structure
813 ###############################################################################
815 #---------------------------------------------------------
816 # Provide rules to make install dirs. This must be early
817 # in the file so they get built before dependencies
818 #---------------------------------------------------------
820 $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
823 # To create other directories, as needed, and timestamp their creation
825 $(Verb) $(MKDIR) $* > /dev/null
826 $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
828 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
829 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
831 #---------------------------------------------------------
832 # Handle the DIRS options for sequential construction
833 #---------------------------------------------------------
839 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
840 $(RecursiveTargets)::
841 $(Verb) for dir in $(DIRS); do \
842 if ([ ! -f $$dir/Makefile ] || \
843 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
845 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
847 ($(MAKE) -C $$dir $@ ) || exit 1; \
850 $(RecursiveTargets)::
851 $(Verb) for dir in $(DIRS); do \
852 ($(MAKE) -C $$dir $@ ) || exit 1; \
858 #---------------------------------------------------------
859 # Handle the EXPERIMENTAL_DIRS options ensuring success
860 # after each directory is built.
861 #---------------------------------------------------------
862 ifdef EXPERIMENTAL_DIRS
863 $(RecursiveTargets)::
864 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
865 if ([ ! -f $$dir/Makefile ] || \
866 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
868 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
870 ($(MAKE) -C $$dir $@ ) || exit 0; \
874 #-----------------------------------------------------------
875 # Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
876 #-----------------------------------------------------------
877 ifdef OPTIONAL_PARALLEL_DIRS
878 PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) -o -f $(T)/Makefile && echo "$(T)"))
881 #-----------------------------------------------------------
882 # Handle the PARALLEL_DIRS options for parallel construction
883 #-----------------------------------------------------------
886 SubDirs += $(PARALLEL_DIRS)
888 # Unfortunately, this list must be maintained if new recursive targets are added
889 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
890 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
891 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
892 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
893 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
894 install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
895 unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS))
897 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
901 SD=$(PROJ_SRC_DIR)/$(@D); \
903 if [ ! -f $$SD/Makefile ]; then \
905 DD=$(notdir $(@D)); \
907 if ([ ! -f $$DD/Makefile ] || \
908 command test $$DD/Makefile -ot \
909 $$SD/Makefile ); then \
911 $(CP) $$SD/Makefile $$DD/Makefile; \
913 $(MAKE) -C $$DD $(subst $(@D)/.make,,$@)
916 #---------------------------------------------------------
917 # Handle the OPTIONAL_DIRS options for directores that may
919 #---------------------------------------------------------
922 SubDirs += $(OPTIONAL_DIRS)
924 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
925 $(RecursiveTargets)::
926 $(Verb) for dir in $(OPTIONAL_DIRS); do \
927 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
928 if ([ ! -f $$dir/Makefile ] || \
929 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
931 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
933 ($(MAKE) -C$$dir $@ ) || exit 1; \
937 $(RecursiveTargets)::
938 $(Verb) for dir in $(OPTIONAL_DIRS); do \
939 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
940 ($(MAKE) -C$$dir $@ ) || exit 1; \
946 #---------------------------------------------------------
947 # Handle the CONFIG_FILES options
948 #---------------------------------------------------------
953 $(Echo) Install circumvented with NO_INSTALL
955 $(Echo) UnInstall circumvented with NO_INSTALL
957 install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
958 $(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir)
959 $(Verb)for file in $(CONFIG_FILES); do \
960 if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
961 $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
962 elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
963 $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
965 $(ECHO) Error: cannot find config file $${file}. ; \
970 $(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
971 $(Verb)for file in $(CONFIG_FILES); do \
972 $(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
978 ###############################################################################
979 # Set up variables for building libraries
980 ###############################################################################
982 #---------------------------------------------------------
983 # Define various command line options pertaining to the
984 # libraries needed when linking. There are "Proj" libs
985 # (defined by the user's project) and "LLVM" libs (defined
986 # by the LLVM project).
987 #---------------------------------------------------------
990 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
991 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
992 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
993 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
997 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
998 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
999 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
1000 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
1003 # Loadable module for Win32 requires all symbols resolved for linking.
1004 # Then all symbols in LLVM.dll will be available.
1005 ifeq ($(ENABLE_SHARED),1)
1006 ifdef LOADABLE_MODULE
1007 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
1008 LINK_COMPONENTS += all
1013 ifndef IS_CLEANING_TARGET
1014 ifdef LINK_COMPONENTS
1016 # If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make
1017 # clean in tools, then do a make in tools (instead of at the top level).
1019 @echo "*** llvm-config doesn't exist - rebuilding it."
1020 @$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config
1022 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
1024 ifeq ($(ENABLE_SHARED), 1)
1025 # We can take the "auto-import" feature to get rid of using dllimport.
1026 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1027 LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
1030 LLVMLibsOptions += -lLLVM-$(LLVMVersion)
1031 LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT)
1034 ifndef NO_LLVM_CONFIG
1035 LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)
1036 ifeq ($(LLVMConfigLibs),Error)
1037 $(error llvm-config --libs failed)
1039 LLVMLibsOptions += $(LLVMConfigLibs)
1040 LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error)
1041 ifeq ($(LLVMConfigLibfiles),Error)
1042 $(error llvm-config --libfiles failed)
1044 LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles)
1051 # Set up the library exports file.
1052 ifdef EXPORTED_SYMBOL_FILE
1054 # First, set up the native export file, which may differ from the source
1057 ifeq ($(HOST_OS),Darwin)
1058 # Darwin convention prefixes symbols with underscores.
1059 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed
1060 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1061 $(Verb) sed -e 's/^/_/' < $< > $@
1063 -$(Verb) $(RM) -f $(NativeExportsFile)
1065 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1066 # Gold and BFD ld require a version script rather than a plain list.
1067 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
1068 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1069 $(Verb) echo "{" > $@
1070 $(Verb) grep -q '[[:alnum:]_]' $< && echo " global:" >> $@ || :
1071 $(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@
1072 ifneq ($(HOST_OS),OpenBSD)
1073 $(Verb) echo " local: *;" >> $@
1075 $(Verb) echo "};" >> $@
1077 -$(Verb) $(RM) -f $(NativeExportsFile)
1079 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1080 # GNU ld Win32 accepts .DEF files that contain "DATA" entries.
1081 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def))
1082 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1083 $(Echo) Generating $(notdir $@)
1084 $(Verb) $(ECHO) "EXPORTS" > $@
1085 $(Verb) $(CAT) $< >> $@
1087 -$(Verb) $(RM) -f $(NativeExportsFile)
1089 # Default behavior: just use the exports file verbatim.
1090 NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
1095 # Now add the linker command-line options to use the native export file.
1098 ifeq ($(HOST_OS),Darwin)
1099 LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
1102 # gold, bfd ld, etc.
1103 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1104 LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
1108 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1109 # LLVMLibsOptions is invalidated at processing tools/llvm-shlib.
1110 SharedLinkOptions += $(NativeExportsFile)
1115 ###############################################################################
1116 # Library Build Rules: Four ways to build a library
1117 ###############################################################################
1119 #---------------------------------------------------------
1120 # Bytecode Module Targets:
1121 # If the user set MODULE_NAME then they want to build a
1122 # bytecode module from the sources. We compile all the
1123 # sources and link it together into a single bytecode
1125 #---------------------------------------------------------
1128 ifeq ($(strip $(LLVMCC)),)
1129 $(warning Modules require LLVM capable compiler but none is available ****)
1132 Module := $(LibDir)/$(MODULE_NAME).bc
1133 LinkModule := $(LLVMLD) -r
1136 ifdef EXPORTED_SYMBOL_FILE
1137 LinkModule += -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1140 $(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(LLVMLD)
1141 $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
1142 $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
1144 all-local:: $(Module)
1147 ifneq ($(strip $(Module)),)
1148 -$(Verb) $(RM) -f $(Module)
1151 ifdef BYTECODE_DESTINATION
1152 ModuleDestDir := $(BYTECODE_DESTINATION)
1154 ModuleDestDir := $(DESTDIR)$(PROJ_libdir)
1159 $(Echo) Install circumvented with NO_INSTALL
1161 $(Echo) Uninstall circumvented with NO_INSTALL
1163 DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
1165 install-module:: $(DestModule)
1166 install-local:: $(DestModule)
1168 $(DestModule): $(ModuleDestDir) $(Module)
1169 $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
1170 $(Verb) $(DataInstall) $(Module) $(DestModule)
1173 $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
1174 -$(Verb) $(RM) -f $(DestModule)
1180 # if we're building a library ...
1183 # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option
1184 LIBRARYNAME := $(strip $(LIBRARYNAME))
1185 ifdef LOADABLE_MODULE
1186 BaseLibName.A := $(LIBRARYNAME).a
1187 BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT)
1189 BaseLibName.A := lib$(LIBRARYNAME).a
1190 BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
1192 LibName.A := $(LibDir)/$(BaseLibName.A)
1193 LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
1194 LibName.O := $(LibDir)/$(LIBRARYNAME).o
1195 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
1197 #---------------------------------------------------------
1198 # Shared Library Targets:
1199 # If the user asked for a shared library to be built
1200 # with the SHARED_LIBRARY variable, then we provide
1201 # targets for building them.
1202 #---------------------------------------------------------
1203 ifdef SHARED_LIBRARY
1205 all-local:: $(LibName.SO)
1207 ifdef EXPORTED_SYMBOL_FILE
1208 $(LibName.SO): $(NativeExportsFile)
1211 ifdef LINK_LIBS_IN_SHARED
1212 ifdef LOADABLE_MODULE
1213 SharedLibKindMessage := "Loadable Module"
1214 SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions)
1216 SharedLibKindMessage := "Shared Library"
1218 $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
1219 $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
1221 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
1222 $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
1224 $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
1225 $(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
1226 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
1230 ifneq ($(strip $(LibName.SO)),)
1231 -$(Verb) $(RM) -f $(LibName.SO)
1236 $(Echo) Install circumvented with NO_INSTALL
1238 $(Echo) Uninstall circumvented with NO_INSTALL
1241 # Win32.DLL prefers to be located on the "PATH" of binaries.
1242 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1243 DestSharedLibDir := $(DESTDIR)$(PROJ_bindir)
1245 DestSharedLibDir := $(DESTDIR)$(PROJ_libdir)
1247 DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
1249 install-local:: $(DestSharedLib)
1251 $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir)
1252 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
1253 $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
1256 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
1257 -$(Verb) $(RM) -f $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME).*
1261 #---------------------------------------------------------
1262 # Bytecode Library Targets:
1263 # If the user asked for a bytecode library to be built
1264 # with the BYTECODE_LIBRARY variable, then we provide
1265 # targets for building them.
1266 #---------------------------------------------------------
1267 ifdef BYTECODE_LIBRARY
1268 ifeq ($(strip $(LLVMCC)),)
1269 $(warning Bytecode libraries require LLVM capable compiler but none is available ****)
1272 all-local:: $(LibName.BCA)
1274 ifdef EXPORTED_SYMBOL_FILE
1275 BCLinkLib = $(LLVMLD) -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1277 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLD) \
1278 $(LLVMToolDir)/llvm-ar
1279 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
1281 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).internalize $(ObjectsBC)
1283 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).internalize.bc
1285 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
1286 $(LLVMToolDir)/llvm-ar
1287 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
1289 $(Verb) $(LArchive) $@ $(ObjectsBC)
1294 ifneq ($(strip $(LibName.BCA)),)
1295 -$(Verb) $(RM) -f $(LibName.BCA)
1298 ifdef BYTECODE_DESTINATION
1299 BytecodeDestDir := $(BYTECODE_DESTINATION)
1301 BytecodeDestDir := $(DESTDIR)$(PROJ_libdir)
1304 DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).bca
1306 install-bytecode-local:: $(DestBytecodeLib)
1310 $(Echo) Install circumvented with NO_INSTALL
1312 $(Echo) Uninstall circumvented with NO_INSTALL
1314 install-local:: $(DestBytecodeLib)
1316 $(DestBytecodeLib): $(LibName.BCA) $(BytecodeDestDir)
1317 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1318 $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
1321 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1322 -$(Verb) $(RM) -f $(DestBytecodeLib)
1327 #---------------------------------------------------------
1329 # If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
1330 # building an archive.
1331 #---------------------------------------------------------
1332 ifndef NO_BUILD_ARCHIVE
1333 ifndef BUILD_ARCHIVE
1334 ifndef LOADABLE_MODULE
1340 #---------------------------------------------------------
1341 # Archive Library Targets:
1342 # If the user wanted a regular archive library built,
1343 # then we provide targets for building them.
1344 #---------------------------------------------------------
1347 all-local:: $(LibName.A)
1349 $(LibName.A): $(ObjectsO) $(LibDir)/.dir
1350 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
1351 -$(Verb) $(RM) -f $@
1352 $(Verb) $(Archive) $@ $(ObjectsO)
1353 $(Verb) $(Ranlib) $@
1356 ifneq ($(strip $(LibName.A)),)
1357 -$(Verb) $(RM) -f $(LibName.A)
1362 $(Echo) Install circumvented with NO_INSTALL
1364 $(Echo) Uninstall circumvented with NO_INSTALL
1366 ifdef NO_INSTALL_ARCHIVES
1368 $(Echo) Install circumvented with NO_INSTALL
1370 $(Echo) Uninstall circumvented with NO_INSTALL
1372 DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a
1374 install-local:: $(DestArchiveLib)
1376 $(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
1377 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
1378 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
1379 $(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
1382 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
1383 -$(Verb) $(RM) -f $(DestArchiveLib)
1391 ###############################################################################
1392 # Tool Build Rules: Build executable tool based on TOOLNAME option
1393 ###############################################################################
1397 #---------------------------------------------------------
1398 # Set up variables for building a tool.
1399 #---------------------------------------------------------
1400 TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
1402 ToolBuildPath := $(ExmplDir)/$(TOOLEXENAME)
1404 ToolBuildPath := $(ToolDir)/$(TOOLEXENAME)
1407 # TOOLALIAS is a name to symlink (or copy) the tool to.
1410 ToolAliasBuildPath := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1412 ToolAliasBuildPath := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1416 #---------------------------------------------------------
1418 #---------------------------------------------------------
1420 # If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
1421 # not exporting all of the weak symbols from the binary. This reduces dyld
1422 # startup time by 4x on darwin in some cases.
1423 ifdef TOOL_NO_EXPORTS
1424 ifeq ($(HOST_OS),Darwin)
1426 # Tiger tools don't support this.
1427 ifneq ($(DARWIN_MAJVERS),4)
1428 LD.Flags += -Wl,-exported_symbol,_main
1432 ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU))
1433 ifneq ($(ARCH), Mips)
1434 LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
1439 #---------------------------------------------------------
1440 # Tool Order File Support
1441 #---------------------------------------------------------
1443 ifeq ($(HOST_OS),Darwin)
1444 ifdef TOOL_ORDER_FILE
1446 LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
1451 #---------------------------------------------------------
1452 # Tool Version Info Support
1453 #---------------------------------------------------------
1455 ifeq ($(HOST_OS),Darwin)
1456 ifdef TOOL_INFO_PLIST
1458 LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST)
1460 $(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST)
1462 $(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir
1463 $(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..."
1464 $(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \
1465 -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \
1466 -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \
1467 -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \
1473 #---------------------------------------------------------
1474 # Provide targets for building the tools
1475 #---------------------------------------------------------
1476 all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
1479 ifneq ($(strip $(ToolBuildPath)),)
1480 -$(Verb) $(RM) -f $(ToolBuildPath)
1482 ifneq ($(strip $(ToolAliasBuildPath)),)
1483 -$(Verb) $(RM) -f $(ToolAliasBuildPath)
1487 $(ToolBuildPath): $(ExmplDir)/.dir
1489 $(ToolBuildPath): $(ToolDir)/.dir
1492 ifdef CODESIGN_TOOLS
1493 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1494 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1495 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1496 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1497 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1499 $(Echo) ======= Code-Signing $(BuildMode) Executable $(TOOLNAME)
1500 $(Verb) codesign -s - $@
1502 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1503 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1504 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1505 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1506 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1510 ifneq ($(strip $(ToolAliasBuildPath)),)
1511 $(ToolAliasBuildPath): $(ToolBuildPath)
1512 $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
1513 $(Verb) $(RM) -f $(ToolAliasBuildPath)
1514 $(Verb) $(AliasTool) $(TOOLEXENAME) $(ToolAliasBuildPath)
1515 $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
1521 $(Echo) Install circumvented with NO_INSTALL
1523 $(Echo) Uninstall circumvented with NO_INSTALL
1527 ToolBinDir = $(DESTDIR)$(PROJ_internal_prefix)/bin
1529 ToolBinDir = $(DESTDIR)$(PROJ_bindir)
1531 DestTool = $(ToolBinDir)/$(TOOLEXENAME)
1533 install-local:: $(DestTool)
1535 $(DestTool): $(ToolBuildPath)
1536 $(Echo) Installing $(BuildMode) $(DestTool)
1537 $(Verb) $(MKDIR) $(ToolBinDir)
1538 $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
1541 $(Echo) Uninstalling $(BuildMode) $(DestTool)
1542 -$(Verb) $(RM) -f $(DestTool)
1544 # TOOLALIAS install.
1546 DestToolAlias = $(ToolBinDir)/$(TOOLALIAS)$(EXEEXT)
1548 install-local:: $(DestToolAlias)
1550 $(DestToolAlias): $(DestTool)
1551 $(Echo) Installing $(BuildMode) $(DestToolAlias)
1552 $(Verb) $(RM) -f $(DestToolAlias)
1553 $(Verb) $(AliasTool) $(TOOLEXENAME) $(DestToolAlias)
1556 $(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
1557 -$(Verb) $(RM) -f $(DestToolAlias)
1563 ###############################################################################
1564 # Object Build Rules: Build object files based on sources
1565 ###############################################################################
1567 # FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
1568 ifeq ($(HOST_OS),HP-UX)
1569 DISABLE_AUTO_DEPENDENCIES=1
1572 # Provide rule sets for when dependency generation is enabled
1573 ifndef DISABLE_AUTO_DEPENDENCIES
1575 #---------------------------------------------------------
1576 # Create .o files in the ObjDir directory from the .cpp and .c files...
1577 #---------------------------------------------------------
1579 DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
1580 -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
1582 # If the build succeeded, move the dependency file over, otherwise
1584 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
1585 else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
1587 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1588 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1589 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1592 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1593 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1594 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1597 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1598 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1599 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1602 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1603 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1604 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1607 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1608 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1609 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1612 #---------------------------------------------------------
1613 # Create .bc files in the ObjDir directory from .cpp .cc and .c files...
1614 #---------------------------------------------------------
1616 BC_DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.bc.d.tmp" \
1617 -MT "$(ObjDir)/$*.ll" -MT "$(ObjDir)/$*.bc.d"
1619 # If the build succeeded, move the dependency file over, otherwise
1621 BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d"; \
1622 else $(RM) "$(ObjDir)/$*.bc.d.tmp"; exit 1; fi
1624 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1625 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1626 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1627 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1628 $(BC_DEPEND_MOVEFILE)
1630 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1631 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1632 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1633 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1634 $(BC_DEPEND_MOVEFILE)
1636 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1637 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1638 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1639 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1640 $(BC_DEPEND_MOVEFILE)
1642 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1643 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1644 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1645 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1646 $(BC_DEPEND_MOVEFILE)
1648 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1649 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1650 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1651 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1652 $(BC_DEPEND_MOVEFILE)
1654 # Provide alternate rule sets if dependencies are disabled
1657 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1658 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1659 $(Compile.CXX) $< -o $@
1661 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1662 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1663 $(Compile.CXX) $< -o $@
1665 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1666 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1667 $(Compile.CXX) $< -o $@
1669 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1670 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1671 $(Compile.C) $< -o $@
1673 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1674 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1675 $(Compile.C) $< -o $@
1677 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1678 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1679 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1681 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1682 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1683 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1685 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1686 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1687 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1689 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1690 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1691 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1693 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1694 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1695 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1700 ## Rules for building preprocessed (.i/.ii) outputs.
1701 $(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1702 $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
1703 $(Verb) $(Preprocess.CXX) $< -o $@
1705 $(BuildMode)/%.ii: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1706 $(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file"
1707 $(Verb) $(Preprocess.CXX) $< -o $@
1709 $(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1710 $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
1711 $(Verb) $(Preprocess.CXX) $< -o $@
1713 $(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1714 $(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
1715 $(Verb) $(Preprocess.C) $< -o $@
1717 $(BuildMode)/%.i: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1718 $(Echo) "Compiling $*.m for $(BuildMode) build to .i file"
1719 $(Verb) $(Preprocess.C) $< -o $@
1722 $(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1723 $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
1724 $(Compile.CXX) $< -o $@ -S
1726 $(ObjDir)/%.s: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1727 $(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG)
1728 $(Compile.CXX) $< -o $@ -S
1730 $(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1731 $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
1732 $(Compile.CXX) $< -o $@ -S
1734 $(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1735 $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
1736 $(Compile.C) $< -o $@ -S
1738 $(ObjDir)/%.s: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1739 $(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG)
1740 $(Compile.C) $< -o $@ -S
1743 # make the C and C++ compilers strip debug info out of bytecode libraries.
1745 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1746 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1747 $(Verb) $(LOPT) $< -std-compile-opts -o $@
1749 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1750 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1751 $(Verb) $(LOPT) $< -std-compile-opts -strip-debug -o $@
1755 #---------------------------------------------------------
1756 # Provide rule to build .bc files from .ll sources,
1757 # regardless of dependencies
1758 #---------------------------------------------------------
1759 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
1760 $(Echo) "Compiling $*.ll for $(BuildMode) build"
1761 $(Verb) $(LLVMAS) $< -f -o $@
1763 ###############################################################################
1764 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
1765 ###############################################################################
1768 TABLEGEN_INC_FILES_COMMON = 1
1771 ifdef TABLEGEN_INC_FILES_COMMON
1773 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
1774 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1775 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
1777 # INCFiles rule: All of the tblgen generated files are emitted to
1778 # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
1779 # us to only "touch" the real file if the contents of it change. IOW, if
1780 # tblgen is modified, all of the .inc.tmp files are regenerated, but no
1781 # dependencies of the .inc files are, unless the contents of the .inc file
1783 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
1784 $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
1786 endif # TABLEGEN_INC_FILES_COMMON
1790 TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
1791 $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \
1792 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \
1793 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \
1794 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \
1795 $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
1796 $(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td)
1798 # All .inc.tmp files depend on the .td files.
1799 $(INCTMPFiles) : $(TDFiles)
1801 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1802 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1803 $(Echo) "Building $(<F) register info implementation with tblgen"
1804 $(Verb) $(LLVMTableGen) -gen-register-info -o $(call SYSPATH, $@) $<
1806 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1807 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1808 $(Echo) "Building $(<F) instruction information with tblgen"
1809 $(Verb) $(LLVMTableGen) -gen-instr-info -o $(call SYSPATH, $@) $<
1811 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1812 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1813 $(Echo) "Building $(<F) assembly writer with tblgen"
1814 $(Verb) $(LLVMTableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
1816 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1817 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1818 $(Echo) "Building $(<F) assembly writer #1 with tblgen"
1819 $(Verb) $(LLVMTableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
1821 $(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
1822 $(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1823 $(Echo) "Building $(<F) assembly matcher with tblgen"
1824 $(Verb) $(LLVMTableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
1826 $(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \
1827 $(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1828 $(Echo) "Building $(<F) MC code emitter with tblgen"
1829 $(Verb) $(LLVMTableGen) -gen-emitter -mc-emitter -o $(call SYSPATH, $@) $<
1831 $(TARGET:%=$(ObjDir)/%GenMCPseudoLowering.inc.tmp): \
1832 $(ObjDir)/%GenMCPseudoLowering.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1833 $(Echo) "Building $(<F) MC Pseudo instruction expander with tblgen"
1834 $(Verb) $(LLVMTableGen) -gen-pseudo-lowering -o $(call SYSPATH, $@) $<
1836 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1837 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1838 $(Echo) "Building $(<F) code emitter with tblgen"
1839 $(Verb) $(LLVMTableGen) -gen-emitter -o $(call SYSPATH, $@) $<
1841 $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
1842 $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1843 $(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
1844 $(Verb) $(LLVMTableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
1846 $(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \
1847 $(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1848 $(Echo) "Building $(<F) disassembly tables with tblgen"
1849 $(Verb) $(LLVMTableGen) -gen-disassembler -o $(call SYSPATH, $@) $<
1851 $(TARGET:%=$(ObjDir)/%GenEDInfo.inc.tmp): \
1852 $(ObjDir)/%GenEDInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1853 $(Echo) "Building $(<F) enhanced disassembly information with tblgen"
1854 $(Verb) $(LLVMTableGen) -gen-enhanced-disassembly-info -o $(call SYSPATH, $@) $<
1856 $(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
1857 $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1858 $(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
1859 $(Verb) $(LLVMTableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
1861 $(TARGET:%=$(ObjDir)/%GenSubtargetInfo.inc.tmp): \
1862 $(ObjDir)/%GenSubtargetInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1863 $(Echo) "Building $(<F) subtarget information with tblgen"
1864 $(Verb) $(LLVMTableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
1866 $(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
1867 $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1868 $(Echo) "Building $(<F) calling convention information with tblgen"
1869 $(Verb) $(LLVMTableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
1871 $(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
1872 $(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1873 $(Echo) "Building $(<F) intrinsics information with tblgen"
1874 $(Verb) $(LLVMTableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
1876 $(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1877 $(Echo) "Building $(<F) decoder tables with tblgen"
1878 $(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $<
1880 $(ObjDir)/%GenDFAPacketizer.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1881 $(Echo) "Building $(<F) DFA packetizer tables with tblgen"
1882 $(Verb) $(LLVMTableGen) -gen-dfa-packetizer -o $(call SYSPATH, $@) $<
1885 -$(Verb) $(RM) -f $(INCFiles)
1889 ###############################################################################
1890 # OTHER RULES: Other rules needed
1891 ###############################################################################
1893 # To create postscript files from dot files...
1894 ifneq ($(DOT),false)
1896 $(DOT) -Tps < $< > $@
1899 $(Echo) "Cannot build $@: The program dot is not installed"
1902 # This rules ensures that header files that are removed still have a rule for
1903 # which they can be "generated." This allows make to ignore them and
1904 # reproduce the dependency lists.
1908 # Define clean-local to clean the current directory. Note that this uses a
1909 # very conservative approach ensuring that empty variables do not cause
1910 # errors or disastrous removal.
1912 ifneq ($(strip $(ObjRootDir)),)
1913 -$(Verb) $(RM) -rf $(ObjRootDir)
1915 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1916 -$(Verb) $(RM) -f *$(SHLIBEXT)
1920 -$(Verb) $(RM) -rf Debug Release Profile
1923 ###############################################################################
1924 # DEPENDENCIES: Include the dependency files if we should
1925 ###############################################################################
1926 ifndef DISABLE_AUTO_DEPENDENCIES
1928 # If its not one of the cleaning targets
1929 ifndef IS_CLEANING_TARGET
1931 # Get the list of dependency files
1932 DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources)))
1933 DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
1935 # Include bitcode dependency files if using bitcode libraries
1936 ifdef BYTECODE_LIBRARY
1937 DependFiles += $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.bc.d)
1940 -include $(DependFiles) ""
1946 ###############################################################################
1947 # CHECK: Running the test suite
1948 ###############################################################################
1951 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1952 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1953 $(EchoCmd) Running test suite ; \
1954 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
1955 TESTSUITE=$(TESTSUITE) ; \
1957 $(EchoCmd) No Makefile in test directory ; \
1960 $(EchoCmd) No test directory ; \
1966 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1967 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1968 $(EchoCmd) Running test suite ; \
1969 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-dg ; \
1971 $(EchoCmd) No Makefile in test directory ; \
1974 $(EchoCmd) No test directory ; \
1978 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1979 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1980 $(EchoCmd) Running test suite ; \
1981 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \
1983 $(EchoCmd) No Makefile in test directory ; \
1986 $(EchoCmd) No test directory ; \
1989 ###############################################################################
1990 # UNITTESTS: Running the unittests test suite
1991 ###############################################################################
1994 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
1995 if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
1996 $(EchoCmd) Running unittests test suite ; \
1997 $(MAKE) -C $(PROJ_OBJ_ROOT)/unittests unitcheck; \
1999 $(EchoCmd) No Makefile in unittests directory ; \
2002 $(EchoCmd) No unittests directory ; \
2005 ###############################################################################
2006 # DISTRIBUTION: Handle construction of a distribution tarball
2007 ###############################################################################
2009 #------------------------------------------------------------------------
2010 # Define distribution related variables
2011 #------------------------------------------------------------------------
2012 DistName := $(PROJECT_NAME)-$(PROJ_VERSION)
2013 DistDir := $(PROJ_OBJ_ROOT)/$(DistName)
2014 TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName)
2015 DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
2016 DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip
2017 DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
2018 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
2019 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
2020 Makefile.config.in configure autoconf
2021 DistOther := $(notdir $(wildcard \
2022 $(PROJ_SRC_DIR)/*.h \
2023 $(PROJ_SRC_DIR)/*.td \
2024 $(PROJ_SRC_DIR)/*.def \
2025 $(PROJ_SRC_DIR)/*.ll \
2026 $(PROJ_SRC_DIR)/*.in))
2027 DistSubDirs := $(SubDirs)
2028 DistSources = $(Sources) $(EXTRA_DIST)
2029 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
2031 #------------------------------------------------------------------------
2032 # We MUST build distribution with OBJ_DIR != SRC_DIR
2033 #------------------------------------------------------------------------
2034 ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
2035 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
2036 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
2040 #------------------------------------------------------------------------
2041 # Prevent attempt to run dist targets from anywhere but the top level
2042 #------------------------------------------------------------------------
2044 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
2045 $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
2048 #------------------------------------------------------------------------
2049 # Provide the top level targets
2050 #------------------------------------------------------------------------
2052 dist-gzip:: $(DistTarGZip)
2054 $(DistTarGZip) : $(TopDistDir)/.makedistdir
2055 $(Echo) Packing gzipped distribution tar file.
2056 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
2057 $(GZIP) -c > "$(DistTarGZip)"
2059 dist-bzip2:: $(DistTarBZ2)
2061 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
2062 $(Echo) Packing bzipped distribution tar file.
2063 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
2064 $(BZIP2) -c >$(DistTarBZ2)
2066 dist-zip:: $(DistZip)
2068 $(DistZip) : $(TopDistDir)/.makedistdir
2069 $(Echo) Packing zipped distribution file.
2070 $(Verb) rm -f $(DistZip)
2071 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
2073 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
2074 $(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL =====
2076 DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
2078 dist-check:: $(DistTarGZip)
2079 $(Echo) Checking distribution tar file.
2080 $(Verb) if test -d $(DistCheckDir) ; then \
2081 $(RM) -rf $(DistCheckDir) ; \
2083 $(Verb) $(MKDIR) $(DistCheckDir)
2084 $(Verb) cd $(DistCheckDir) && \
2085 $(MKDIR) $(DistCheckDir)/build && \
2086 $(MKDIR) $(DistCheckDir)/install && \
2087 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
2089 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
2090 --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
2093 $(MAKE) unittests && \
2094 $(MAKE) install && \
2095 $(MAKE) uninstall && \
2096 $(MAKE) dist-clean && \
2097 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
2100 $(Echo) Cleaning distribution files
2101 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
2106 #------------------------------------------------------------------------
2107 # Provide the recursive distdir target for building the distribution directory
2108 #------------------------------------------------------------------------
2109 distdir: $(DistDir)/.makedistdir
2110 $(DistDir)/.makedistdir: $(DistSources)
2111 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2112 if test -d "$(DistDir)" ; then \
2113 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
2116 $(EchoCmd) Removing old $(DistDir) ; \
2117 $(RM) -rf $(DistDir); \
2118 $(EchoCmd) Making 'all' to verify build ; \
2119 $(MAKE) ENABLE_OPTIMIZED=1 all ; \
2121 $(Echo) Building Distribution Directory $(DistDir)
2122 $(Verb) $(MKDIR) $(DistDir)
2123 $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
2124 srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
2125 for file in $(DistFiles) ; do \
2127 $(PROJ_SRC_DIR)/*) \
2128 file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
2130 $(PROJ_SRC_ROOT)/*) \
2131 file=`echo "$$file" | \
2132 sed "s#^$$srcrootstrip/##"` \
2135 if test -f "$(PROJ_SRC_DIR)/$$file" || \
2136 test -d "$(PROJ_SRC_DIR)/$$file" ; then \
2137 from_dir="$(PROJ_SRC_DIR)" ; \
2138 elif test -f "$$file" || test -d "$$file" ; then \
2141 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
2142 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
2143 to_dir="$(DistDir)/$$dir"; \
2144 $(MKDIR) "$$to_dir" ; \
2146 to_dir="$(DistDir)"; \
2148 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
2149 if test -n "$$mid_dir" ; then \
2150 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
2152 if test -d "$$from_dir/$$file"; then \
2153 if test -d "$(PROJ_SRC_DIR)/$$file" && \
2154 test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
2155 cd $(PROJ_SRC_DIR) ; \
2156 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2157 ( cd $$to_dir ; $(TAR) xf - ) ; \
2158 cd $(PROJ_OBJ_DIR) ; \
2161 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2162 ( cd $$to_dir ; $(TAR) xf - ) ; \
2163 cd $(PROJ_OBJ_DIR) ; \
2165 elif test -f "$$from_dir/$$file" ; then \
2166 $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
2167 elif test -L "$$from_dir/$$file" ; then \
2168 $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
2169 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
2170 $(EchoCmd) "===== WARNING: Distribution Source " \
2171 "$$from_dir/$$file Not Found!" ; \
2172 elif test "$(Verb)" != '@' ; then \
2173 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
2176 $(Verb) for subdir in $(DistSubDirs) ; do \
2177 if test "$$subdir" \!= "." ; then \
2178 new_distdir="$(DistDir)/$$subdir" ; \
2179 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
2180 ( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
2181 DistDir="$$new_distdir" distdir ) || exit 1; \
2184 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2185 $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
2186 $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
2187 -name .svn \) -print` ;\
2188 $(MAKE) dist-hook ; \
2189 $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
2190 -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
2191 -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
2192 -o ! -type d ! -perm -444 -exec \
2193 $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
2194 || chmod -R a+r $(DistDir) ; \
2197 # This is invoked by distdir target, define it as a no-op to avoid errors if not
2203 ###############################################################################
2204 # TOP LEVEL - targets only to apply at the top level directory
2205 ###############################################################################
2209 #------------------------------------------------------------------------
2210 # Install support for the project's include files:
2211 #------------------------------------------------------------------------
2214 $(Echo) Install circumvented with NO_INSTALL
2216 $(Echo) Uninstall circumvented with NO_INSTALL
2219 $(Echo) Installing include files
2220 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
2221 $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
2222 cd $(PROJ_SRC_ROOT)/include && \
2223 for hdr in `find . -type f \
2224 '(' -name LICENSE.TXT \
2229 ')' -print | grep -v CVS | \
2230 grep -v .svn` ; do \
2231 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2232 if test \! -d "$$instdir" ; then \
2233 $(EchoCmd) Making install directory $$instdir ; \
2234 $(MKDIR) $$instdir ;\
2236 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2239 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
2240 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
2241 cd $(PROJ_OBJ_ROOT)/include && \
2242 for hdr in `find . -type f \
2243 '(' -name LICENSE.TXT \
2248 ')' -print | grep -v CVS | \
2249 grep -v .svn` ; do \
2250 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2251 if test \! -d "$$instdir" ; then \
2252 $(EchoCmd) Making install directory $$instdir ; \
2253 $(MKDIR) $$instdir ;\
2255 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2261 $(Echo) Uninstalling include files
2262 $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
2263 cd $(PROJ_SRC_ROOT)/include && \
2264 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
2265 '!' '(' -name '*~' -o -name '.#*' \
2266 -o -name '*.in' ')' -print ')' | \
2267 grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2268 cd $(PROJ_SRC_ROOT)/include && \
2269 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
2270 -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2276 @echo searching for overlength lines in files: $(Sources)
2279 egrep -n '.{81}' $(Sources) /dev/null
2282 @echo searching for tabs in files: $(Sources)
2285 egrep -n ' ' $(Sources) /dev/null
2288 @ls -l $(LibDir) | awk '\
2289 BEGIN { sum = 0; } \
2291 END { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2292 @ls -l $(ToolDir) | awk '\
2293 BEGIN { sum = 0; } \
2295 END { printf("Programs: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2296 #------------------------------------------------------------------------
2297 # Print out the directories used for building
2298 #------------------------------------------------------------------------
2300 $(Echo) "BuildMode : " '$(BuildMode)'
2301 $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
2302 $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
2303 $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
2304 $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
2305 $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
2306 $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
2307 $(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
2308 $(Echo) "PROJ_internal_prefix : " '$(PROJ_internal_prefix)'
2309 $(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
2310 $(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
2311 $(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
2312 $(Echo) "PROJ_includedir : " '$(PROJ_includedir)'
2313 $(Echo) "UserTargets : " '$(UserTargets)'
2314 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
2315 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
2316 $(Echo) "ObjDir : " '$(ObjDir)'
2317 $(Echo) "LibDir : " '$(LibDir)'
2318 $(Echo) "ToolDir : " '$(ToolDir)'
2319 $(Echo) "ExmplDir : " '$(ExmplDir)'
2320 $(Echo) "Sources : " '$(Sources)'
2321 $(Echo) "TDFiles : " '$(TDFiles)'
2322 $(Echo) "INCFiles : " '$(INCFiles)'
2323 $(Echo) "INCTMPFiles : " '$(INCTMPFiles)'
2324 $(Echo) "PreConditions: " '$(PreConditions)'
2325 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
2326 $(Echo) "Compile.C : " '$(Compile.C)'
2327 $(Echo) "Archive : " '$(Archive)'
2328 $(Echo) "YaccFiles : " '$(YaccFiles)'
2329 $(Echo) "LexFiles : " '$(LexFiles)'
2330 $(Echo) "Module : " '$(Module)'
2331 $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
2332 $(Echo) "SubDirs : " '$(SubDirs)'
2333 $(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
2334 $(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
2339 # General debugging rule, use 'make dbg-print-XXX' to print the
2340 # definition, value and origin of XXX.
2342 $(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))