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 LLVMLD := $(LLVMToolDir)/llvm-ld$(EXEEXT)
544 LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
547 LLI := $(LLVMToolDir)/lli$(EXEEXT)
550 LLC := $(LLVMToolDir)/llc$(EXEEXT)
553 LOPT := $(LLVMToolDir)/opt$(EXEEXT)
556 LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
559 #--------------------------------------------------------------------
560 # Adjust to user's request
561 #--------------------------------------------------------------------
563 ifeq ($(HOST_OS),Darwin)
564 DARWIN_VERSION := `sw_vers -productVersion`
565 # Strip a number like 10.4.7 to 10.4
566 DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/')
567 # Get "4" out of 10.4 for later pieces in the makefile.
568 DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
570 LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress
571 SharedLinkOptions := -dynamiclib
573 SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
576 SharedLinkOptions=-shared
579 ifeq ($(TARGET_OS),Darwin)
581 TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
586 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
587 ifneq ($(HOST_OS),Darwin)
588 LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
600 # Adjust settings for verbose mode
603 AR.Flags += >/dev/null 2>/dev/null
604 ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
606 ConfigureScriptFLAGS :=
609 # By default, strip symbol information from executable
611 Strip := $(PLATFORMSTRIPOPTS)
612 StripWarnMsg := "(without symbols)"
613 Install.StripFlag += -s
616 ifdef TOOL_NO_EXPORTS
619 DynamicFlag := $(RDYNAMIC)
622 # Adjust linker flags for building an executable
623 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
624 ifneq ($(HOST_OS), Darwin)
626 LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
628 LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
630 LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
634 ifneq ($(DARWIN_MAJVERS),4)
635 LD.Flags += $(RPATH) -Wl,@executable_path/../lib
641 #----------------------------------------------------------
642 # Options To Invoke Tools
643 #----------------------------------------------------------
645 ifdef EXTRA_LD_OPTIONS
646 LD.Flags += $(EXTRA_LD_OPTIONS)
650 CompileCommonOpts += -pedantic -Wno-long-long
652 CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
653 $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT)
654 # Enable cast-qual for C++; the workaround is to use const_cast.
655 CXX.Flags += -Wcast-qual
657 ifeq ($(HOST_OS),HP-UX)
658 CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
661 # If we are building a universal binary on Mac OS/X, pass extra options. This
662 # is useful to people that want to link the LLVM libraries into their universal
665 # The following can be optionally specified:
666 # UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
667 # For Mac OS/X 10.4 Intel machines, the traditional one is:
668 # UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
669 # UNIVERSAL_ARCH can be optionally specified to be a list of architectures
670 # to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64". This defaults to
673 ifndef UNIVERSAL_ARCH
674 UNIVERSAL_ARCH := i386 ppc
676 UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
677 CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
678 ifdef UNIVERSAL_SDK_PATH
679 CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
682 # Building universal cannot compute dependencies automatically.
683 DISABLE_AUTO_DEPENDENCIES=1
685 ifeq ($(TARGET_OS),Darwin)
686 ifeq ($(ARCH),x86_64)
687 TargetCommonOpts = -m64
690 TargetCommonOpts = -m32
696 ifeq ($(HOST_OS),SunOS)
697 CPP.BaseFlags += -include llvm/Support/Solaris.h
700 ifeq ($(HOST_OS),AuroraUX)
701 CPP.BaseFlags += -include llvm/Support/Solaris.h
702 endif # !HOST_OS - AuroraUX.
704 # On Windows, SharedLibDir != LibDir. The order is important.
705 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
706 LD.Flags += -L$(SharedLibDir) -L$(LibDir) -L$(LLVMToolDir) -L$(LLVMLibDir)
708 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
711 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
712 # All -I flags should go here, so that they don't confuse llvm-config.
713 CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
714 $(patsubst %,-I%/include,\
715 $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
716 $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
719 ifeq ($(INCLUDE_BUILD_DIR),1)
720 CPP.Flags += -I$(ObjDir)
723 # SHOW_DIAGNOSTICS support.
724 ifeq ($(SHOW_DIAGNOSTICS),1)
725 Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
726 CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
731 Compile.C = $(Compile.Wrapper) \
732 $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
733 $(TargetCommonOpts) $(CompileCommonOpts) -c
734 Compile.CXX = $(Compile.Wrapper) \
735 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
736 $(TargetCommonOpts) $(CompileCommonOpts) -c
737 Preprocess.CXX= $(Compile.Wrapper) \
738 $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
739 $(CompileCommonOpts) $(CXX.Flags) -E
740 Link = $(Compile.Wrapper) \
741 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
742 $(LDFLAGS) $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
744 BCCompile.C = $(LLVMCC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
745 $(TargetCommonOpts) $(CompileCommonOpts)
746 Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
747 $(TargetCommonOpts) $(CompileCommonOpts) -E
749 BCCompile.CXX = $(LLVMCXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
750 $(TargetCommonOpts) $(CompileCommonOpts)
752 ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
753 ScriptInstall = $(INSTALL) -m 0755
754 DataInstall = $(INSTALL) -m 0644
756 # When compiling under Mingw/Cygwin, the tblgen tool expects Windows
757 # paths. In this case, the SYSPATH function (defined in
758 # Makefile.config) transforms Unix paths into Windows paths.
759 TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
760 -I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
761 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
762 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
763 LLVMTableGen = $(LLVM_TBLGEN) $(TableGen.Flags)
765 Archive = $(AR) $(AR.Flags)
766 LArchive = $(LLVMToolDir)/llvm-ar rcsf
775 #----------------------------------------------------------
776 # Get the list of source files and compute object file
778 #----------------------------------------------------------
781 Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
782 $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
784 Sources := $(SOURCES)
788 Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
791 BaseNameSources := $(sort $(basename $(Sources)))
793 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
794 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
796 #----------------------------------------------------------
797 # For Mingw MSYS bash and Python/w32:
799 # $(ECHOPATH) prints DOSish pathstring.
800 # ex) $(ECHOPATH) /include/sys/types.h
801 # --> C:/mingw/include/sys/types.h
802 # built-in "echo" does not transform path to DOSish path.
804 # FIXME: It would not be needed when MSYS's python
806 #----------------------------------------------------------
808 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
809 ECHOPATH := $(Verb)python -u -c "import sys;print ' '.join(sys.argv[1:])"
811 ECHOPATH := $(Verb)$(ECHO)
814 ###############################################################################
815 # DIRECTORIES: Handle recursive descent of directory structure
816 ###############################################################################
818 #---------------------------------------------------------
819 # Provide rules to make install dirs. This must be early
820 # in the file so they get built before dependencies
821 #---------------------------------------------------------
823 $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
826 # To create other directories, as needed, and timestamp their creation
828 $(Verb) $(MKDIR) $* > /dev/null
829 $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
831 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
832 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
834 #---------------------------------------------------------
835 # Handle the DIRS options for sequential construction
836 #---------------------------------------------------------
842 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
843 $(RecursiveTargets)::
844 $(Verb) for dir in $(DIRS); do \
845 if ([ ! -f $$dir/Makefile ] || \
846 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
848 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
850 ($(MAKE) -C $$dir $@ ) || exit 1; \
853 $(RecursiveTargets)::
854 $(Verb) for dir in $(DIRS); do \
855 ($(MAKE) -C $$dir $@ ) || exit 1; \
861 #---------------------------------------------------------
862 # Handle the EXPERIMENTAL_DIRS options ensuring success
863 # after each directory is built.
864 #---------------------------------------------------------
865 ifdef EXPERIMENTAL_DIRS
866 $(RecursiveTargets)::
867 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
868 if ([ ! -f $$dir/Makefile ] || \
869 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
871 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
873 ($(MAKE) -C $$dir $@ ) || exit 0; \
877 #-----------------------------------------------------------
878 # Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
879 #-----------------------------------------------------------
880 ifdef OPTIONAL_PARALLEL_DIRS
881 PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) -o -f $(T)/Makefile && echo "$(T)"))
884 #-----------------------------------------------------------
885 # Handle the PARALLEL_DIRS options for parallel construction
886 #-----------------------------------------------------------
889 SubDirs += $(PARALLEL_DIRS)
891 # Unfortunately, this list must be maintained if new recursive targets are added
892 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
893 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
894 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
895 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
896 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
897 install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
898 unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS))
900 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
904 SD=$(PROJ_SRC_DIR)/$(@D); \
906 if [ ! -f $$SD/Makefile ]; then \
908 DD=$(notdir $(@D)); \
910 if ([ ! -f $$DD/Makefile ] || \
911 command test $$DD/Makefile -ot \
912 $$SD/Makefile ); then \
914 $(CP) $$SD/Makefile $$DD/Makefile; \
916 $(MAKE) -C $$DD $(subst $(@D)/.make,,$@)
919 #---------------------------------------------------------
920 # Handle the OPTIONAL_DIRS options for directores that may
922 #---------------------------------------------------------
925 SubDirs += $(OPTIONAL_DIRS)
927 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
928 $(RecursiveTargets)::
929 $(Verb) for dir in $(OPTIONAL_DIRS); do \
930 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
931 if ([ ! -f $$dir/Makefile ] || \
932 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
934 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
936 ($(MAKE) -C$$dir $@ ) || exit 1; \
940 $(RecursiveTargets)::
941 $(Verb) for dir in $(OPTIONAL_DIRS); do \
942 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
943 ($(MAKE) -C$$dir $@ ) || exit 1; \
949 #---------------------------------------------------------
950 # Handle the CONFIG_FILES options
951 #---------------------------------------------------------
956 $(Echo) Install circumvented with NO_INSTALL
958 $(Echo) UnInstall circumvented with NO_INSTALL
960 install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
961 $(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir)
962 $(Verb)for file in $(CONFIG_FILES); do \
963 if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
964 $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
965 elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
966 $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
968 $(ECHO) Error: cannot find config file $${file}. ; \
973 $(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
974 $(Verb)for file in $(CONFIG_FILES); do \
975 $(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
981 ###############################################################################
982 # Set up variables for building libraries
983 ###############################################################################
985 #---------------------------------------------------------
986 # Define various command line options pertaining to the
987 # libraries needed when linking. There are "Proj" libs
988 # (defined by the user's project) and "LLVM" libs (defined
989 # by the LLVM project).
990 #---------------------------------------------------------
993 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
994 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
995 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
996 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
1000 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
1001 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
1002 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
1003 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
1006 # Loadable module for Win32 requires all symbols resolved for linking.
1007 # Then all symbols in LLVM.dll will be available.
1008 ifeq ($(ENABLE_SHARED),1)
1009 ifdef LOADABLE_MODULE
1010 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
1011 LINK_COMPONENTS += all
1016 ifndef IS_CLEANING_TARGET
1017 ifdef LINK_COMPONENTS
1019 # If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make
1020 # clean in tools, then do a make in tools (instead of at the top level).
1022 @echo "*** llvm-config doesn't exist - rebuilding it."
1023 @$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config
1025 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
1027 ifeq ($(ENABLE_SHARED), 1)
1028 # We can take the "auto-import" feature to get rid of using dllimport.
1029 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1030 LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
1033 LLVMLibsOptions += -lLLVM-$(LLVMVersion)
1034 LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT)
1037 ifndef NO_LLVM_CONFIG
1038 LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)
1039 ifeq ($(LLVMConfigLibs),Error)
1040 $(error llvm-config --libs failed)
1042 LLVMLibsOptions += $(LLVMConfigLibs)
1043 LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error)
1044 ifeq ($(LLVMConfigLibfiles),Error)
1045 $(error llvm-config --libfiles failed)
1047 LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles)
1054 # Set up the library exports file.
1055 ifdef EXPORTED_SYMBOL_FILE
1057 # First, set up the native export file, which may differ from the source
1060 ifeq ($(HOST_OS),Darwin)
1061 # Darwin convention prefixes symbols with underscores.
1062 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed
1063 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1064 $(Verb) sed -e 's/^/_/' < $< > $@
1066 -$(Verb) $(RM) -f $(NativeExportsFile)
1068 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1069 # Gold and BFD ld require a version script rather than a plain list.
1070 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
1071 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1072 $(Verb) echo "{" > $@
1073 $(Verb) grep -q '[[:alnum:]_]' $< && echo " global:" >> $@ || :
1074 $(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@
1075 ifneq ($(HOST_OS),OpenBSD)
1076 $(Verb) echo " local: *;" >> $@
1078 $(Verb) echo "};" >> $@
1080 -$(Verb) $(RM) -f $(NativeExportsFile)
1082 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1083 # GNU ld Win32 accepts .DEF files that contain "DATA" entries.
1084 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def))
1085 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1086 $(Echo) Generating $(notdir $@)
1087 $(Verb) $(ECHO) "EXPORTS" > $@
1088 $(Verb) $(CAT) $< >> $@
1090 -$(Verb) $(RM) -f $(NativeExportsFile)
1092 # Default behavior: just use the exports file verbatim.
1093 NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
1098 # Now add the linker command-line options to use the native export file.
1101 ifeq ($(HOST_OS),Darwin)
1102 LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
1105 # gold, bfd ld, etc.
1106 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1107 LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
1111 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1112 # LLVMLibsOptions is invalidated at processing tools/llvm-shlib.
1113 SharedLinkOptions += $(NativeExportsFile)
1118 ###############################################################################
1119 # Library Build Rules: Four ways to build a library
1120 ###############################################################################
1122 #---------------------------------------------------------
1123 # Bytecode Module Targets:
1124 # If the user set MODULE_NAME then they want to build a
1125 # bytecode module from the sources. We compile all the
1126 # sources and link it together into a single bytecode
1128 #---------------------------------------------------------
1131 ifeq ($(strip $(LLVMCC)),)
1132 $(warning Modules require LLVM capable compiler but none is available ****)
1135 Module := $(LibDir)/$(MODULE_NAME).bc
1136 LinkModule := $(LLVMLD) -r
1139 ifdef EXPORTED_SYMBOL_FILE
1140 LinkModule += -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1143 $(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(LLVMLD)
1144 $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
1145 $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
1147 all-local:: $(Module)
1150 ifneq ($(strip $(Module)),)
1151 -$(Verb) $(RM) -f $(Module)
1154 ifdef BYTECODE_DESTINATION
1155 ModuleDestDir := $(BYTECODE_DESTINATION)
1157 ModuleDestDir := $(DESTDIR)$(PROJ_libdir)
1162 $(Echo) Install circumvented with NO_INSTALL
1164 $(Echo) Uninstall circumvented with NO_INSTALL
1166 DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
1168 install-module:: $(DestModule)
1169 install-local:: $(DestModule)
1171 $(DestModule): $(ModuleDestDir) $(Module)
1172 $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
1173 $(Verb) $(DataInstall) $(Module) $(DestModule)
1176 $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
1177 -$(Verb) $(RM) -f $(DestModule)
1183 # if we're building a library ...
1186 # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option
1187 LIBRARYNAME := $(strip $(LIBRARYNAME))
1188 ifdef LOADABLE_MODULE
1189 BaseLibName.A := $(LIBRARYNAME).a
1190 BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT)
1192 BaseLibName.A := lib$(LIBRARYNAME).a
1193 BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
1195 LibName.A := $(LibDir)/$(BaseLibName.A)
1196 LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
1197 LibName.O := $(LibDir)/$(LIBRARYNAME).o
1198 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
1200 #---------------------------------------------------------
1201 # Shared Library Targets:
1202 # If the user asked for a shared library to be built
1203 # with the SHARED_LIBRARY variable, then we provide
1204 # targets for building them.
1205 #---------------------------------------------------------
1206 ifdef SHARED_LIBRARY
1208 all-local:: $(LibName.SO)
1210 ifdef EXPORTED_SYMBOL_FILE
1211 $(LibName.SO): $(NativeExportsFile)
1214 ifdef LINK_LIBS_IN_SHARED
1215 ifdef LOADABLE_MODULE
1216 SharedLibKindMessage := "Loadable Module"
1217 SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions)
1219 SharedLibKindMessage := "Shared Library"
1221 $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
1222 $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
1224 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
1225 $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
1227 $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
1228 $(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
1229 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
1233 ifneq ($(strip $(LibName.SO)),)
1234 -$(Verb) $(RM) -f $(LibName.SO)
1239 $(Echo) Install circumvented with NO_INSTALL
1241 $(Echo) Uninstall circumvented with NO_INSTALL
1244 # Win32.DLL prefers to be located on the "PATH" of binaries.
1245 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1246 DestSharedLibDir := $(DESTDIR)$(PROJ_bindir)
1248 DestSharedLibDir := $(DESTDIR)$(PROJ_libdir)
1250 DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
1252 install-local:: $(DestSharedLib)
1254 $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir)
1255 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
1256 $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
1259 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
1260 -$(Verb) $(RM) -f $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME).*
1264 #---------------------------------------------------------
1265 # Bytecode Library Targets:
1266 # If the user asked for a bytecode library to be built
1267 # with the BYTECODE_LIBRARY variable, then we provide
1268 # targets for building them.
1269 #---------------------------------------------------------
1270 ifdef BYTECODE_LIBRARY
1271 ifeq ($(strip $(LLVMCC)),)
1272 $(warning Bytecode libraries require LLVM capable compiler but none is available ****)
1275 all-local:: $(LibName.BCA)
1277 ifdef EXPORTED_SYMBOL_FILE
1278 BCLinkLib = $(LLVMLD) -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1280 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLD) \
1281 $(LLVMToolDir)/llvm-ar
1282 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
1284 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).internalize $(ObjectsBC)
1286 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).internalize.bc
1288 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
1289 $(LLVMToolDir)/llvm-ar
1290 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
1292 $(Verb) $(LArchive) $@ $(ObjectsBC)
1297 ifneq ($(strip $(LibName.BCA)),)
1298 -$(Verb) $(RM) -f $(LibName.BCA)
1301 ifdef BYTECODE_DESTINATION
1302 BytecodeDestDir := $(BYTECODE_DESTINATION)
1304 BytecodeDestDir := $(DESTDIR)$(PROJ_libdir)
1307 DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).bca
1309 install-bytecode-local:: $(DestBytecodeLib)
1313 $(Echo) Install circumvented with NO_INSTALL
1315 $(Echo) Uninstall circumvented with NO_INSTALL
1317 install-local:: $(DestBytecodeLib)
1319 $(DestBytecodeLib): $(LibName.BCA) $(BytecodeDestDir)
1320 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1321 $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
1324 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1325 -$(Verb) $(RM) -f $(DestBytecodeLib)
1330 #---------------------------------------------------------
1332 # If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
1333 # building an archive.
1334 #---------------------------------------------------------
1335 ifndef NO_BUILD_ARCHIVE
1336 ifndef BUILD_ARCHIVE
1337 ifndef LOADABLE_MODULE
1343 #---------------------------------------------------------
1344 # Archive Library Targets:
1345 # If the user wanted a regular archive library built,
1346 # then we provide targets for building them.
1347 #---------------------------------------------------------
1350 all-local:: $(LibName.A)
1352 $(LibName.A): $(ObjectsO) $(LibDir)/.dir
1353 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
1354 -$(Verb) $(RM) -f $@
1355 $(Verb) $(Archive) $@ $(ObjectsO)
1356 $(Verb) $(Ranlib) $@
1359 ifneq ($(strip $(LibName.A)),)
1360 -$(Verb) $(RM) -f $(LibName.A)
1365 $(Echo) Install circumvented with NO_INSTALL
1367 $(Echo) Uninstall circumvented with NO_INSTALL
1369 ifdef NO_INSTALL_ARCHIVES
1371 $(Echo) Install circumvented with NO_INSTALL
1373 $(Echo) Uninstall circumvented with NO_INSTALL
1375 DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a
1377 install-local:: $(DestArchiveLib)
1379 $(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
1380 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
1381 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
1382 $(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
1385 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
1386 -$(Verb) $(RM) -f $(DestArchiveLib)
1394 ###############################################################################
1395 # Tool Build Rules: Build executable tool based on TOOLNAME option
1396 ###############################################################################
1400 #---------------------------------------------------------
1401 # Set up variables for building a tool.
1402 #---------------------------------------------------------
1403 TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
1405 ToolBuildPath := $(ExmplDir)/$(TOOLEXENAME)
1407 ToolBuildPath := $(ToolDir)/$(TOOLEXENAME)
1410 # TOOLALIAS is a name to symlink (or copy) the tool to.
1413 ToolAliasBuildPath := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1415 ToolAliasBuildPath := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1419 #---------------------------------------------------------
1421 #---------------------------------------------------------
1423 # If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
1424 # not exporting all of the weak symbols from the binary. This reduces dyld
1425 # startup time by 4x on darwin in some cases.
1426 ifdef TOOL_NO_EXPORTS
1427 ifeq ($(HOST_OS),Darwin)
1429 # Tiger tools don't support this.
1430 ifneq ($(DARWIN_MAJVERS),4)
1431 LD.Flags += -Wl,-exported_symbol,_main
1435 ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU))
1436 ifneq ($(ARCH), Mips)
1437 LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
1442 #---------------------------------------------------------
1443 # Tool Order File Support
1444 #---------------------------------------------------------
1446 ifeq ($(HOST_OS),Darwin)
1447 ifdef TOOL_ORDER_FILE
1449 LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
1454 #---------------------------------------------------------
1455 # Tool Version Info Support
1456 #---------------------------------------------------------
1458 ifeq ($(HOST_OS),Darwin)
1459 ifdef TOOL_INFO_PLIST
1461 LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST)
1463 $(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST)
1465 $(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir
1466 $(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..."
1467 $(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \
1468 -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \
1469 -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \
1470 -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \
1476 #---------------------------------------------------------
1477 # Provide targets for building the tools
1478 #---------------------------------------------------------
1479 all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
1482 ifneq ($(strip $(ToolBuildPath)),)
1483 -$(Verb) $(RM) -f $(ToolBuildPath)
1485 ifneq ($(strip $(ToolAliasBuildPath)),)
1486 -$(Verb) $(RM) -f $(ToolAliasBuildPath)
1490 $(ToolBuildPath): $(ExmplDir)/.dir
1492 $(ToolBuildPath): $(ToolDir)/.dir
1495 ifdef CODESIGN_TOOLS
1496 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1497 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1498 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1499 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1500 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1502 $(Echo) ======= Code-Signing $(BuildMode) Executable $(TOOLNAME)
1503 $(Verb) codesign -s - $@
1505 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1506 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1507 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1508 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1509 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1513 ifneq ($(strip $(ToolAliasBuildPath)),)
1514 $(ToolAliasBuildPath): $(ToolBuildPath)
1515 $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
1516 $(Verb) $(RM) -f $(ToolAliasBuildPath)
1517 $(Verb) $(AliasTool) $(TOOLEXENAME) $(ToolAliasBuildPath)
1518 $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
1524 $(Echo) Install circumvented with NO_INSTALL
1526 $(Echo) Uninstall circumvented with NO_INSTALL
1530 ToolBinDir = $(DESTDIR)$(PROJ_internal_prefix)/bin
1532 ToolBinDir = $(DESTDIR)$(PROJ_bindir)
1534 DestTool = $(ToolBinDir)/$(TOOLEXENAME)
1536 install-local:: $(DestTool)
1538 $(DestTool): $(ToolBuildPath)
1539 $(Echo) Installing $(BuildMode) $(DestTool)
1540 $(Verb) $(MKDIR) $(ToolBinDir)
1541 $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
1544 $(Echo) Uninstalling $(BuildMode) $(DestTool)
1545 -$(Verb) $(RM) -f $(DestTool)
1547 # TOOLALIAS install.
1549 DestToolAlias = $(ToolBinDir)/$(TOOLALIAS)$(EXEEXT)
1551 install-local:: $(DestToolAlias)
1553 $(DestToolAlias): $(DestTool)
1554 $(Echo) Installing $(BuildMode) $(DestToolAlias)
1555 $(Verb) $(RM) -f $(DestToolAlias)
1556 $(Verb) $(AliasTool) $(TOOLEXENAME) $(DestToolAlias)
1559 $(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
1560 -$(Verb) $(RM) -f $(DestToolAlias)
1566 ###############################################################################
1567 # Object Build Rules: Build object files based on sources
1568 ###############################################################################
1570 # FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
1571 ifeq ($(HOST_OS),HP-UX)
1572 DISABLE_AUTO_DEPENDENCIES=1
1575 # Provide rule sets for when dependency generation is enabled
1576 ifndef DISABLE_AUTO_DEPENDENCIES
1578 #---------------------------------------------------------
1579 # Create .o files in the ObjDir directory from the .cpp and .c files...
1580 #---------------------------------------------------------
1582 DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
1583 -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
1585 # If the build succeeded, move the dependency file over, otherwise
1587 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
1588 else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
1590 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1591 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1592 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1595 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1596 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1597 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1600 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1601 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1602 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1605 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1606 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1607 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1610 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1611 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1612 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1615 #---------------------------------------------------------
1616 # Create .bc files in the ObjDir directory from .cpp .cc and .c files...
1617 #---------------------------------------------------------
1619 BC_DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.bc.d.tmp" \
1620 -MT "$(ObjDir)/$*.ll" -MT "$(ObjDir)/$*.bc.d"
1622 # If the build succeeded, move the dependency file over, otherwise
1624 BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d"; \
1625 else $(RM) "$(ObjDir)/$*.bc.d.tmp"; exit 1; fi
1627 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1628 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1629 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1630 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1631 $(BC_DEPEND_MOVEFILE)
1633 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1634 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1635 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1636 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1637 $(BC_DEPEND_MOVEFILE)
1639 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1640 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1641 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1642 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1643 $(BC_DEPEND_MOVEFILE)
1645 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1646 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1647 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1648 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1649 $(BC_DEPEND_MOVEFILE)
1651 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1652 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1653 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1654 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1655 $(BC_DEPEND_MOVEFILE)
1657 # Provide alternate rule sets if dependencies are disabled
1660 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1661 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1662 $(Compile.CXX) $< -o $@
1664 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1665 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1666 $(Compile.CXX) $< -o $@
1668 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1669 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1670 $(Compile.CXX) $< -o $@
1672 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1673 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1674 $(Compile.C) $< -o $@
1676 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1677 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1678 $(Compile.C) $< -o $@
1680 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1681 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1682 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1684 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1685 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1686 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1688 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1689 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1690 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1692 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1693 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1694 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1696 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1697 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1698 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1703 ## Rules for building preprocessed (.i/.ii) outputs.
1704 $(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1705 $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
1706 $(Verb) $(Preprocess.CXX) $< -o $@
1708 $(BuildMode)/%.ii: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1709 $(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file"
1710 $(Verb) $(Preprocess.CXX) $< -o $@
1712 $(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1713 $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
1714 $(Verb) $(Preprocess.CXX) $< -o $@
1716 $(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1717 $(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
1718 $(Verb) $(Preprocess.C) $< -o $@
1720 $(BuildMode)/%.i: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1721 $(Echo) "Compiling $*.m for $(BuildMode) build to .i file"
1722 $(Verb) $(Preprocess.C) $< -o $@
1725 $(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1726 $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
1727 $(Compile.CXX) $< -o $@ -S
1729 $(ObjDir)/%.s: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1730 $(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG)
1731 $(Compile.CXX) $< -o $@ -S
1733 $(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1734 $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
1735 $(Compile.CXX) $< -o $@ -S
1737 $(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1738 $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
1739 $(Compile.C) $< -o $@ -S
1741 $(ObjDir)/%.s: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1742 $(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG)
1743 $(Compile.C) $< -o $@ -S
1746 # make the C and C++ compilers strip debug info out of bytecode libraries.
1748 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1749 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1750 $(Verb) $(LOPT) $< -std-compile-opts -o $@
1752 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1753 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1754 $(Verb) $(LOPT) $< -std-compile-opts -strip-debug -o $@
1758 #---------------------------------------------------------
1759 # Provide rule to build .bc files from .ll sources,
1760 # regardless of dependencies
1761 #---------------------------------------------------------
1762 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
1763 $(Echo) "Compiling $*.ll for $(BuildMode) build"
1764 $(Verb) $(LLVMAS) $< -f -o $@
1766 ###############################################################################
1767 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
1768 ###############################################################################
1771 TABLEGEN_INC_FILES_COMMON = 1
1774 ifdef TABLEGEN_INC_FILES_COMMON
1776 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
1777 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1778 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
1780 # INCFiles rule: All of the tblgen generated files are emitted to
1781 # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
1782 # us to only "touch" the real file if the contents of it change. IOW, if
1783 # tblgen is modified, all of the .inc.tmp files are regenerated, but no
1784 # dependencies of the .inc files are, unless the contents of the .inc file
1786 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
1787 $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
1789 endif # TABLEGEN_INC_FILES_COMMON
1793 TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
1794 $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \
1795 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \
1796 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \
1797 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \
1798 $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
1799 $(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td)
1801 # All .inc.tmp files depend on the .td files.
1802 $(INCTMPFiles) : $(TDFiles)
1804 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1805 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1806 $(Echo) "Building $(<F) register info implementation with tblgen"
1807 $(Verb) $(LLVMTableGen) -gen-register-info -o $(call SYSPATH, $@) $<
1809 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1810 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1811 $(Echo) "Building $(<F) instruction information with tblgen"
1812 $(Verb) $(LLVMTableGen) -gen-instr-info -o $(call SYSPATH, $@) $<
1814 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1815 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1816 $(Echo) "Building $(<F) assembly writer with tblgen"
1817 $(Verb) $(LLVMTableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
1819 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1820 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1821 $(Echo) "Building $(<F) assembly writer #1 with tblgen"
1822 $(Verb) $(LLVMTableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
1824 $(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
1825 $(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1826 $(Echo) "Building $(<F) assembly matcher with tblgen"
1827 $(Verb) $(LLVMTableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
1829 $(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \
1830 $(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1831 $(Echo) "Building $(<F) MC code emitter with tblgen"
1832 $(Verb) $(LLVMTableGen) -gen-emitter -mc-emitter -o $(call SYSPATH, $@) $<
1834 $(TARGET:%=$(ObjDir)/%GenMCPseudoLowering.inc.tmp): \
1835 $(ObjDir)/%GenMCPseudoLowering.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1836 $(Echo) "Building $(<F) MC Pseudo instruction expander with tblgen"
1837 $(Verb) $(LLVMTableGen) -gen-pseudo-lowering -o $(call SYSPATH, $@) $<
1839 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1840 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1841 $(Echo) "Building $(<F) code emitter with tblgen"
1842 $(Verb) $(LLVMTableGen) -gen-emitter -o $(call SYSPATH, $@) $<
1844 $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
1845 $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1846 $(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
1847 $(Verb) $(LLVMTableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
1849 $(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \
1850 $(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1851 $(Echo) "Building $(<F) disassembly tables with tblgen"
1852 $(Verb) $(LLVMTableGen) -gen-disassembler -o $(call SYSPATH, $@) $<
1854 $(TARGET:%=$(ObjDir)/%GenEDInfo.inc.tmp): \
1855 $(ObjDir)/%GenEDInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1856 $(Echo) "Building $(<F) enhanced disassembly information with tblgen"
1857 $(Verb) $(LLVMTableGen) -gen-enhanced-disassembly-info -o $(call SYSPATH, $@) $<
1859 $(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
1860 $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1861 $(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
1862 $(Verb) $(LLVMTableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
1864 $(TARGET:%=$(ObjDir)/%GenSubtargetInfo.inc.tmp): \
1865 $(ObjDir)/%GenSubtargetInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1866 $(Echo) "Building $(<F) subtarget information with tblgen"
1867 $(Verb) $(LLVMTableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
1869 $(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
1870 $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1871 $(Echo) "Building $(<F) calling convention information with tblgen"
1872 $(Verb) $(LLVMTableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
1874 $(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
1875 $(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1876 $(Echo) "Building $(<F) intrinsics information with tblgen"
1877 $(Verb) $(LLVMTableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
1879 $(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1880 $(Echo) "Building $(<F) decoder tables with tblgen"
1881 $(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $<
1883 $(ObjDir)/%GenDFAPacketizer.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1884 $(Echo) "Building $(<F) DFA packetizer tables with tblgen"
1885 $(Verb) $(LLVMTableGen) -gen-dfa-packetizer -o $(call SYSPATH, $@) $<
1888 -$(Verb) $(RM) -f $(INCFiles)
1892 ###############################################################################
1893 # OTHER RULES: Other rules needed
1894 ###############################################################################
1896 # To create postscript files from dot files...
1897 ifneq ($(DOT),false)
1899 $(DOT) -Tps < $< > $@
1902 $(Echo) "Cannot build $@: The program dot is not installed"
1905 # This rules ensures that header files that are removed still have a rule for
1906 # which they can be "generated." This allows make to ignore them and
1907 # reproduce the dependency lists.
1911 # Define clean-local to clean the current directory. Note that this uses a
1912 # very conservative approach ensuring that empty variables do not cause
1913 # errors or disastrous removal.
1915 ifneq ($(strip $(ObjRootDir)),)
1916 -$(Verb) $(RM) -rf $(ObjRootDir)
1918 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1919 -$(Verb) $(RM) -f *$(SHLIBEXT)
1923 -$(Verb) $(RM) -rf Debug Release Profile
1926 ###############################################################################
1927 # DEPENDENCIES: Include the dependency files if we should
1928 ###############################################################################
1929 ifndef DISABLE_AUTO_DEPENDENCIES
1931 # If its not one of the cleaning targets
1932 ifndef IS_CLEANING_TARGET
1934 # Get the list of dependency files
1935 DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources)))
1936 DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
1938 # Include bitcode dependency files if using bitcode libraries
1939 ifdef BYTECODE_LIBRARY
1940 DependFiles += $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.bc.d)
1943 -include $(DependFiles) ""
1949 ###############################################################################
1950 # CHECK: Running the test suite
1951 ###############################################################################
1954 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1955 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1956 $(EchoCmd) Running test suite ; \
1957 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
1958 TESTSUITE=$(TESTSUITE) ; \
1960 $(EchoCmd) No Makefile in test directory ; \
1963 $(EchoCmd) No test directory ; \
1969 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1970 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1971 $(EchoCmd) Running test suite ; \
1972 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-dg ; \
1974 $(EchoCmd) No Makefile in test directory ; \
1977 $(EchoCmd) No test directory ; \
1981 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1982 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1983 $(EchoCmd) Running test suite ; \
1984 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \
1986 $(EchoCmd) No Makefile in test directory ; \
1989 $(EchoCmd) No test directory ; \
1992 ###############################################################################
1993 # UNITTESTS: Running the unittests test suite
1994 ###############################################################################
1997 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
1998 if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
1999 $(EchoCmd) Running unittests test suite ; \
2000 $(MAKE) -C $(PROJ_OBJ_ROOT)/unittests unitcheck; \
2002 $(EchoCmd) No Makefile in unittests directory ; \
2005 $(EchoCmd) No unittests directory ; \
2008 ###############################################################################
2009 # DISTRIBUTION: Handle construction of a distribution tarball
2010 ###############################################################################
2012 #------------------------------------------------------------------------
2013 # Define distribution related variables
2014 #------------------------------------------------------------------------
2015 DistName := $(PROJECT_NAME)-$(PROJ_VERSION)
2016 DistDir := $(PROJ_OBJ_ROOT)/$(DistName)
2017 TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName)
2018 DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
2019 DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip
2020 DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
2021 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
2022 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
2023 Makefile.config.in configure autoconf
2024 DistOther := $(notdir $(wildcard \
2025 $(PROJ_SRC_DIR)/*.h \
2026 $(PROJ_SRC_DIR)/*.td \
2027 $(PROJ_SRC_DIR)/*.def \
2028 $(PROJ_SRC_DIR)/*.ll \
2029 $(PROJ_SRC_DIR)/*.in))
2030 DistSubDirs := $(SubDirs)
2031 DistSources = $(Sources) $(EXTRA_DIST)
2032 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
2034 #------------------------------------------------------------------------
2035 # We MUST build distribution with OBJ_DIR != SRC_DIR
2036 #------------------------------------------------------------------------
2037 ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
2038 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
2039 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
2043 #------------------------------------------------------------------------
2044 # Prevent attempt to run dist targets from anywhere but the top level
2045 #------------------------------------------------------------------------
2047 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
2048 $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
2051 #------------------------------------------------------------------------
2052 # Provide the top level targets
2053 #------------------------------------------------------------------------
2055 dist-gzip:: $(DistTarGZip)
2057 $(DistTarGZip) : $(TopDistDir)/.makedistdir
2058 $(Echo) Packing gzipped distribution tar file.
2059 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
2060 $(GZIP) -c > "$(DistTarGZip)"
2062 dist-bzip2:: $(DistTarBZ2)
2064 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
2065 $(Echo) Packing bzipped distribution tar file.
2066 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
2067 $(BZIP2) -c >$(DistTarBZ2)
2069 dist-zip:: $(DistZip)
2071 $(DistZip) : $(TopDistDir)/.makedistdir
2072 $(Echo) Packing zipped distribution file.
2073 $(Verb) rm -f $(DistZip)
2074 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
2076 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
2077 $(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL =====
2079 DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
2081 dist-check:: $(DistTarGZip)
2082 $(Echo) Checking distribution tar file.
2083 $(Verb) if test -d $(DistCheckDir) ; then \
2084 $(RM) -rf $(DistCheckDir) ; \
2086 $(Verb) $(MKDIR) $(DistCheckDir)
2087 $(Verb) cd $(DistCheckDir) && \
2088 $(MKDIR) $(DistCheckDir)/build && \
2089 $(MKDIR) $(DistCheckDir)/install && \
2090 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
2092 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
2093 --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
2096 $(MAKE) unittests && \
2097 $(MAKE) install && \
2098 $(MAKE) uninstall && \
2099 $(MAKE) dist-clean && \
2100 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
2103 $(Echo) Cleaning distribution files
2104 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
2109 #------------------------------------------------------------------------
2110 # Provide the recursive distdir target for building the distribution directory
2111 #------------------------------------------------------------------------
2112 distdir: $(DistDir)/.makedistdir
2113 $(DistDir)/.makedistdir: $(DistSources)
2114 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2115 if test -d "$(DistDir)" ; then \
2116 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
2119 $(EchoCmd) Removing old $(DistDir) ; \
2120 $(RM) -rf $(DistDir); \
2121 $(EchoCmd) Making 'all' to verify build ; \
2122 $(MAKE) ENABLE_OPTIMIZED=1 all ; \
2124 $(Echo) Building Distribution Directory $(DistDir)
2125 $(Verb) $(MKDIR) $(DistDir)
2126 $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
2127 srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
2128 for file in $(DistFiles) ; do \
2130 $(PROJ_SRC_DIR)/*) \
2131 file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
2133 $(PROJ_SRC_ROOT)/*) \
2134 file=`echo "$$file" | \
2135 sed "s#^$$srcrootstrip/##"` \
2138 if test -f "$(PROJ_SRC_DIR)/$$file" || \
2139 test -d "$(PROJ_SRC_DIR)/$$file" ; then \
2140 from_dir="$(PROJ_SRC_DIR)" ; \
2141 elif test -f "$$file" || test -d "$$file" ; then \
2144 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
2145 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
2146 to_dir="$(DistDir)/$$dir"; \
2147 $(MKDIR) "$$to_dir" ; \
2149 to_dir="$(DistDir)"; \
2151 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
2152 if test -n "$$mid_dir" ; then \
2153 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
2155 if test -d "$$from_dir/$$file"; then \
2156 if test -d "$(PROJ_SRC_DIR)/$$file" && \
2157 test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
2158 cd $(PROJ_SRC_DIR) ; \
2159 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2160 ( cd $$to_dir ; $(TAR) xf - ) ; \
2161 cd $(PROJ_OBJ_DIR) ; \
2164 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2165 ( cd $$to_dir ; $(TAR) xf - ) ; \
2166 cd $(PROJ_OBJ_DIR) ; \
2168 elif test -f "$$from_dir/$$file" ; then \
2169 $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
2170 elif test -L "$$from_dir/$$file" ; then \
2171 $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
2172 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
2173 $(EchoCmd) "===== WARNING: Distribution Source " \
2174 "$$from_dir/$$file Not Found!" ; \
2175 elif test "$(Verb)" != '@' ; then \
2176 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
2179 $(Verb) for subdir in $(DistSubDirs) ; do \
2180 if test "$$subdir" \!= "." ; then \
2181 new_distdir="$(DistDir)/$$subdir" ; \
2182 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
2183 ( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
2184 DistDir="$$new_distdir" distdir ) || exit 1; \
2187 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2188 $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
2189 $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
2190 -name .svn \) -print` ;\
2191 $(MAKE) dist-hook ; \
2192 $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
2193 -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
2194 -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
2195 -o ! -type d ! -perm -444 -exec \
2196 $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
2197 || chmod -R a+r $(DistDir) ; \
2200 # This is invoked by distdir target, define it as a no-op to avoid errors if not
2206 ###############################################################################
2207 # TOP LEVEL - targets only to apply at the top level directory
2208 ###############################################################################
2212 #------------------------------------------------------------------------
2213 # Install support for the project's include files:
2214 #------------------------------------------------------------------------
2217 $(Echo) Install circumvented with NO_INSTALL
2219 $(Echo) Uninstall circumvented with NO_INSTALL
2222 $(Echo) Installing include files
2223 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
2224 $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
2225 cd $(PROJ_SRC_ROOT)/include && \
2226 for hdr in `find . -type f \
2227 '(' -name LICENSE.TXT \
2232 ')' -print | grep -v CVS | \
2233 grep -v .svn` ; do \
2234 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2235 if test \! -d "$$instdir" ; then \
2236 $(EchoCmd) Making install directory $$instdir ; \
2237 $(MKDIR) $$instdir ;\
2239 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2242 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
2243 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
2244 cd $(PROJ_OBJ_ROOT)/include && \
2245 for hdr in `find . -type f \
2246 '(' -name LICENSE.TXT \
2251 ')' -print | grep -v CVS | \
2252 grep -v .svn` ; do \
2253 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2254 if test \! -d "$$instdir" ; then \
2255 $(EchoCmd) Making install directory $$instdir ; \
2256 $(MKDIR) $$instdir ;\
2258 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2264 $(Echo) Uninstalling include files
2265 $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
2266 cd $(PROJ_SRC_ROOT)/include && \
2267 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
2268 '!' '(' -name '*~' -o -name '.#*' \
2269 -o -name '*.in' ')' -print ')' | \
2270 grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2271 cd $(PROJ_SRC_ROOT)/include && \
2272 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
2273 -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2279 @echo searching for overlength lines in files: $(Sources)
2282 egrep -n '.{81}' $(Sources) /dev/null
2285 @echo searching for tabs in files: $(Sources)
2288 egrep -n ' ' $(Sources) /dev/null
2291 @ls -l $(LibDir) | awk '\
2292 BEGIN { sum = 0; } \
2294 END { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2295 @ls -l $(ToolDir) | awk '\
2296 BEGIN { sum = 0; } \
2298 END { printf("Programs: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2299 #------------------------------------------------------------------------
2300 # Print out the directories used for building
2301 #------------------------------------------------------------------------
2303 $(Echo) "BuildMode : " '$(BuildMode)'
2304 $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
2305 $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
2306 $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
2307 $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
2308 $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
2309 $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
2310 $(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
2311 $(Echo) "PROJ_internal_prefix : " '$(PROJ_internal_prefix)'
2312 $(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
2313 $(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
2314 $(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
2315 $(Echo) "PROJ_includedir : " '$(PROJ_includedir)'
2316 $(Echo) "UserTargets : " '$(UserTargets)'
2317 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
2318 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
2319 $(Echo) "ObjDir : " '$(ObjDir)'
2320 $(Echo) "LibDir : " '$(LibDir)'
2321 $(Echo) "ToolDir : " '$(ToolDir)'
2322 $(Echo) "ExmplDir : " '$(ExmplDir)'
2323 $(Echo) "Sources : " '$(Sources)'
2324 $(Echo) "TDFiles : " '$(TDFiles)'
2325 $(Echo) "INCFiles : " '$(INCFiles)'
2326 $(Echo) "INCTMPFiles : " '$(INCTMPFiles)'
2327 $(Echo) "PreConditions: " '$(PreConditions)'
2328 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
2329 $(Echo) "Compile.C : " '$(Compile.C)'
2330 $(Echo) "Archive : " '$(Archive)'
2331 $(Echo) "YaccFiles : " '$(YaccFiles)'
2332 $(Echo) "LexFiles : " '$(LexFiles)'
2333 $(Echo) "Module : " '$(Module)'
2334 $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
2335 $(Echo) "SubDirs : " '$(SubDirs)'
2336 $(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
2337 $(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
2342 # General debugging rule, use 'make dbg-print-XXX' to print the
2343 # definition, value and origin of XXX.
2345 $(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))