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 --enable-optional-components "$(OPTIONAL_COMPONENTS)" \
104 --write-library-table $(LLVMConfigLibraryDependenciesInc) \
105 --write-make-fragment $(LLVMBuildMakeFrag)
107 # For completeness, let Make know how the extra files are generated.
108 $(LLVMConfigLibraryDependenciesInc): $(LLVMBuildMakeFrag)
110 # Include the generated Makefile fragment.
112 # We currently only include the dependencies for the fragment itself if we are
113 # at the top-level. Otherwise, recursive invocations would ends up doing
114 # substantially more redundant stat'ing.
116 # This means that we won't properly regenerate things for developers used to
117 # building from a subdirectory, but that is always somewhat unreliable.
119 LLVMBUILD_INCLUDE_DEPENDENCIES := 1
121 # Clean the generated makefile fragment at the top-level.
123 -$(Verb) $(RM) -f $(LLVMBuildMakeFrag)
125 -include $(LLVMBuildMakeFrag)
127 ################################################################################
128 # PRECONDITIONS: that which must be built/checked first
129 ################################################################################
131 SrcMakefiles := $(filter %Makefile %Makefile.tests,\
132 $(wildcard $(PROJ_SRC_DIR)/Makefile*))
133 ObjMakefiles := $(subst $(PROJ_SRC_DIR),$(PROJ_OBJ_DIR),$(SrcMakefiles))
134 ConfigureScript := $(PROJ_SRC_ROOT)/configure
135 ConfigStatusScript := $(PROJ_OBJ_ROOT)/config.status
136 MakefileConfigIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.config.in))
137 MakefileCommonIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.common.in))
138 MakefileConfig := $(PROJ_OBJ_ROOT)/Makefile.config
139 MakefileCommon := $(PROJ_OBJ_ROOT)/Makefile.common
140 PreConditions := $(ConfigStatusScript) $(ObjMakefiles)
141 ifneq ($(MakefileCommonIn),)
142 PreConditions += $(MakefileCommon)
145 ifneq ($(MakefileConfigIn),)
146 PreConditions += $(MakefileConfig)
149 preconditions: $(PreConditions)
151 #------------------------------------------------------------------------
152 # Make sure the BUILT_SOURCES are built first
153 #------------------------------------------------------------------------
154 $(filter-out clean clean-local,$(UserTargets)):: $(BUILT_SOURCES)
157 ifneq ($(strip $(BUILT_SOURCES)),)
158 -$(Verb) $(RM) -f $(BUILT_SOURCES)
161 ifneq ($(PROJ_OBJ_ROOT),$(PROJ_SRC_ROOT))
163 $(Verb) if test -x config.status ; then \
164 $(EchoCmd) Wiping out $(PROJ_OBJ_ROOT) ; \
165 $(MKDIR) .spotless.save ; \
166 $(MV) config.status .spotless.save ; \
167 $(MV) mklib .spotless.save ; \
168 $(MV) projects .spotless.save ; \
170 $(MV) .spotless.save/config.status . ; \
171 $(MV) .spotless.save/mklib . ; \
172 $(MV) .spotless.save/projects . ; \
173 $(RM) -rf .spotless.save ; \
174 $(EchoCmd) Rebuilding configuration of $(PROJ_OBJ_ROOT) ; \
175 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
176 $(ConfigStatusScript) ; \
178 $(EchoCmd) "make spotless" can only be run from $(PROJ_OBJ_ROOT); \
182 $(EchoCmd) "spotless target not supported for objdir == srcdir"
185 $(BUILT_SOURCES) : $(ObjMakefiles)
187 #------------------------------------------------------------------------
188 # Make sure we're not using a stale configuration
189 #------------------------------------------------------------------------
191 $(Echo) Reconfiguring $(PROJ_OBJ_ROOT)
192 $(Verb) cd $(PROJ_OBJ_ROOT) && \
193 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
194 $(ConfigStatusScript)
196 .PRECIOUS: $(ConfigStatusScript)
197 $(ConfigStatusScript): $(ConfigureScript)
198 $(Echo) Reconfiguring with $<
199 $(Verb) cd $(PROJ_OBJ_ROOT) && \
200 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
201 $(ConfigStatusScript)
203 #------------------------------------------------------------------------
204 # Make sure the configuration makefile is up to date
205 #------------------------------------------------------------------------
206 ifneq ($(MakefileConfigIn),)
207 $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
208 $(Echo) Regenerating $@
209 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
212 ifneq ($(MakefileCommonIn),)
213 $(MakefileCommon): $(MakefileCommonIn) $(ConfigStatusScript)
214 $(Echo) Regenerating $@
215 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.common
218 #------------------------------------------------------------------------
219 # If the Makefile in the source tree has been updated, copy it over into the
220 # build tree. But, only do this if the source and object makefiles differ
221 #------------------------------------------------------------------------
223 PROJ_MAKEFILE := $(PROJ_SRC_DIR)/Makefile
226 ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
228 Makefile: $(PROJ_MAKEFILE) $(ExtraMakefiles)
229 $(Echo) "Updating Makefile"
230 $(Verb) $(MKDIR) $(@D)
231 $(Verb) $(CP) -f $< $@
233 # Copy the Makefile.* files unless we're in the root directory which avoids
234 # the copying of Makefile.config.in or other things that should be explicitly
236 $(PROJ_OBJ_DIR)/Makefile% : $(PROJ_MAKEFILE)%
238 *Makefile.rules) ;; \
240 *) $(EchoCmd) "Updating $(@F)" ; \
247 #------------------------------------------------------------------------
248 # Set up the basic dependencies
249 #------------------------------------------------------------------------
250 $(UserTargets):: $(PreConditions)
254 clean-all:: clean-local clean-all-local
255 install:: install-local
256 uninstall:: uninstall-local
257 install-local:: all-local
258 install-bytecode:: install-bytecode-local
260 ###############################################################################
261 # VARIABLES: Set up various variables based on configuration data
262 ###############################################################################
264 # Variable for if this make is for a "cleaning" target
265 ifneq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),)
269 #--------------------------------------------------------------------
270 # Variables derived from configuration we are building
271 #--------------------------------------------------------------------
274 ifeq ($(ENABLE_OPTIMIZED),1)
276 # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
277 ifneq ($(HOST_OS),FreeBSD)
278 ifneq ($(HOST_OS),Darwin)
279 OmitFramePointer := -fomit-frame-pointer
283 # Darwin requires -fstrict-aliasing to be explicitly enabled.
284 # Avoid -fstrict-aliasing on Darwin for now, there are unresolved issues
285 # with -fstrict-aliasing and ipa-type-escape radr://6756684
286 #ifeq ($(HOST_OS),Darwin)
287 # EXTRA_OPTIONS += -fstrict-aliasing -Wstrict-aliasing
289 CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
290 C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
291 LD.Flags += $(OPTIMIZE_OPTION)
293 BuildMode := $(BuildMode)+Debug
300 ifdef NO_DEBUG_SYMBOLS
301 BuildMode := Unoptimized
315 ifeq ($(ENABLE_LIBCPP),1)
316 CXX.Flags += -stdlib=libc++
317 LD.Flags += -stdlib=libc++
320 ifeq ($(ENABLE_PROFILING),1)
321 BuildMode := $(BuildMode)+Profile
322 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
323 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) -pg -g
324 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg -g
328 ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
329 CXX.Flags += -fvisibility-inlines-hidden
332 ifdef ENABLE_EXPENSIVE_CHECKS
333 # GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above.
334 # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40160
338 # IF REQUIRES_EH=1 is specified then don't disable exceptions
340 CXX.Flags += -fno-exceptions
342 # If the library requires EH, it also requires RTTI.
346 ifdef REQUIRES_FRAME_POINTER
347 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags))
348 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags))
349 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags))
352 # If REQUIRES_RTTI=1 is specified then don't disable run-time type id.
353 ifneq ($(REQUIRES_RTTI), 1)
354 CXX.Flags += -fno-rtti
357 ifeq ($(ENABLE_COVERAGE),1)
358 BuildMode := $(BuildMode)+Coverage
359 CXX.Flags += -ftest-coverage -fprofile-arcs
360 C.Flags += -ftest-coverage -fprofile-arcs
363 # If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
364 # then disable assertions by defining the appropriate preprocessor symbols.
365 ifeq ($(DISABLE_ASSERTIONS),1)
366 CPP.Defines += -DNDEBUG
368 BuildMode := $(BuildMode)+Asserts
369 CPP.Defines += -D_DEBUG
372 # If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
373 # configured), then enable expensive checks by defining the
374 # appropriate preprocessor symbols.
375 ifeq ($(ENABLE_EXPENSIVE_CHECKS),1)
376 BuildMode := $(BuildMode)+Checks
377 CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
380 # LOADABLE_MODULE implies several other things so we force them to be
382 ifdef LOADABLE_MODULE
384 LINK_LIBS_IN_SHARED := 1
392 ifeq ($(ENABLE_PIC),1)
393 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
394 # Nothing. Win32 defaults to PIC and warns when given -fPIC
396 ifeq ($(HOST_OS),Darwin)
397 # Common symbols not allowed in dylib files
398 CXX.Flags += -fno-common
399 C.Flags += -fno-common
401 # Linux and others; pass -fPIC
407 ifeq ($(HOST_OS),Darwin)
408 CXX.Flags += -mdynamic-no-pic
409 C.Flags += -mdynamic-no-pic
413 # Support makefile variable to disable any kind of timestamp/non-deterministic
414 # info from being used in the build.
415 ifeq ($(ENABLE_TIMESTAMPS),1)
416 DOTDIR_TIMESTAMP_COMMAND := $(DATE)
418 DOTDIR_TIMESTAMP_COMMAND := echo 'Created.'
421 ifeq ($(HOST_OS),MingW)
423 CPP.Defines += -D__NO_CTYPE_INLINE
424 ifeq ($(LLVM_CROSS_COMPILING),1)
425 # Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016
427 LD.Flags += -Wl,--allow-multiple-definition
432 CXX.Flags += -Woverloaded-virtual
433 CPP.BaseFlags += $(CPP.Defines)
436 # Make Floating point IEEE compliant on Alpha.
439 CPP.BaseFlags += -mieee
440 ifeq ($(ENABLE_PIC),0)
442 CPP.BaseFlags += -fPIC
445 LD.Flags += -Wl,--no-relax
448 # GNU ld/PECOFF accepts but ignores them below;
452 # FIXME: autoconf should be aware of them.
453 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
454 HAVE_LINK_VERSION_SCRIPT := 0
456 RDYNAMIC := -Wl,--export-all-symbols
459 #--------------------------------------------------------------------
460 # Directory locations
461 #--------------------------------------------------------------------
463 ifeq ($(LLVM_CROSS_COMPILING),1)
464 BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin
467 ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode)
468 ObjDir := $(ObjRootDir)
469 LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
470 ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
471 ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
472 LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
473 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
474 LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
476 #--------------------------------------------------------------------
477 # Locations of shared libraries
478 #--------------------------------------------------------------------
481 SharedLibDir := $(LibDir)
482 LLVMSharedLibDir := $(LLVMLibDir)
484 # Win32.DLL prefers to be located on the "PATH" of binaries.
485 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
486 SharedLibDir := $(ToolDir)
487 LLVMSharedLibDir := $(LLVMToolDir)
489 ifeq ($(HOST_OS),Cygwin)
496 #--------------------------------------------------------------------
497 # LLVM Capable Compiler
498 #--------------------------------------------------------------------
500 ifneq ($(findstring llvm-gcc,$(LLVMCC_OPTION)),)
502 LLVMCXX := $(LLVMGXX)
504 ifneq ($(findstring clang,$(LLVMCC_OPTION)),)
505 ifneq ($(CLANGPATH),)
506 LLVMCC := $(CLANGPATH)
507 LLVMCXX := $(CLANGXXPATH)
509 ifeq ($(ENABLE_BUILT_CLANG),1)
510 LLVMCC := $(LLVMToolDir)/clang
511 LLVMCXX := $(LLVMToolDir)/clang++
517 #--------------------------------------------------------------------
518 # Full Paths To Compiled Tools and Utilities
519 #--------------------------------------------------------------------
520 EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
521 ifdef BUILD_DIRS_ONLY
522 EchoCmd := $(EchoCmd) "(build tools)":
527 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
530 ifeq ($(LLVM_CROSS_COMPILING),1)
531 LLVM_TBLGEN := $(BuildLLVMToolDir)/llvm-tblgen$(BUILD_EXEEXT)
533 LLVM_TBLGEN := $(LLVMToolDir)/llvm-tblgen$(EXEEXT)
536 ifeq ($(LLVM_CROSS_COMPILING),1)
537 LLVM_CONFIG := $(BuildLLVMToolDir)/llvm-config$(BUILD_EXEEXT)
539 LLVM_CONFIG := $(LLVMToolDir)/llvm-config$(EXEEXT)
542 LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
545 LLI := $(LLVMToolDir)/lli$(EXEEXT)
548 LLC := $(LLVMToolDir)/llc$(EXEEXT)
551 LOPT := $(LLVMToolDir)/opt$(EXEEXT)
554 LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
557 LLVMLINK := $(LLVMToolDir)/llvm-link$(EXEEXT)
560 #--------------------------------------------------------------------
561 # Adjust to user's request
562 #--------------------------------------------------------------------
564 ifeq ($(HOST_OS),Darwin)
565 DARWIN_VERSION := `sw_vers -productVersion`
566 # Strip a number like 10.4.7 to 10.4
567 DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/')
568 # Get "4" out of 10.4 for later pieces in the makefile.
569 DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
571 LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress
572 SharedLinkOptions := -dynamiclib
574 SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
577 SharedLinkOptions=-shared
580 ifeq ($(TARGET_OS),Darwin)
582 TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
587 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
588 ifneq ($(HOST_OS),Darwin)
589 LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
601 # Adjust settings for verbose mode
604 AR.Flags += >/dev/null 2>/dev/null
605 ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
607 ConfigureScriptFLAGS :=
610 # By default, strip symbol information from executable
612 Strip := $(PLATFORMSTRIPOPTS)
613 StripWarnMsg := "(without symbols)"
614 Install.StripFlag += -s
617 ifdef TOOL_NO_EXPORTS
620 DynamicFlag := $(RDYNAMIC)
623 # Adjust linker flags for building an executable
624 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
625 ifneq ($(HOST_OS), Darwin)
627 LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
629 LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
631 LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
635 ifneq ($(DARWIN_MAJVERS),4)
636 LD.Flags += $(RPATH) -Wl,@executable_path/../lib
642 #----------------------------------------------------------
643 # Options To Invoke Tools
644 #----------------------------------------------------------
646 ifdef EXTRA_LD_OPTIONS
647 LD.Flags += $(EXTRA_LD_OPTIONS)
651 CompileCommonOpts += -pedantic -Wno-long-long
653 CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
654 $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT)
655 # Enable cast-qual for C++; the workaround is to use const_cast.
656 CXX.Flags += -Wcast-qual
658 ifeq ($(HOST_OS),HP-UX)
659 CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
662 # If we are building a universal binary on Mac OS/X, pass extra options. This
663 # is useful to people that want to link the LLVM libraries into their universal
666 # The following can be optionally specified:
667 # UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
668 # For Mac OS/X 10.4 Intel machines, the traditional one is:
669 # UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
670 # UNIVERSAL_ARCH can be optionally specified to be a list of architectures
671 # to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64". This defaults to
674 ifndef UNIVERSAL_ARCH
675 UNIVERSAL_ARCH := i386 ppc
677 UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
678 CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
679 ifdef UNIVERSAL_SDK_PATH
680 CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
683 # Building universal cannot compute dependencies automatically.
684 DISABLE_AUTO_DEPENDENCIES=1
686 ifeq ($(TARGET_OS),Darwin)
687 ifeq ($(ARCH),x86_64)
688 TargetCommonOpts = -m64
691 TargetCommonOpts = -m32
697 ifeq ($(HOST_OS),SunOS)
698 CPP.BaseFlags += -include llvm/Support/Solaris.h
701 ifeq ($(HOST_OS),AuroraUX)
702 CPP.BaseFlags += -include llvm/Support/Solaris.h
703 endif # !HOST_OS - AuroraUX.
705 # On Windows, SharedLibDir != LibDir. The order is important.
706 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
707 LD.Flags += -L$(SharedLibDir) -L$(LibDir) -L$(LLVMToolDir) -L$(LLVMLibDir)
709 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
712 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
713 # All -I flags should go here, so that they don't confuse llvm-config.
714 CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
715 $(patsubst %,-I%/include,\
716 $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
717 $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
720 ifeq ($(INCLUDE_BUILD_DIR),1)
721 CPP.Flags += -I$(ObjDir)
724 # SHOW_DIAGNOSTICS support.
725 ifeq ($(SHOW_DIAGNOSTICS),1)
726 Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
727 CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
732 Compile.C = $(Compile.Wrapper) \
733 $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
734 $(TargetCommonOpts) $(CompileCommonOpts) -c
735 Compile.CXX = $(Compile.Wrapper) \
736 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
737 $(TargetCommonOpts) $(CompileCommonOpts) -c
738 Preprocess.CXX= $(Compile.Wrapper) \
739 $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
740 $(CompileCommonOpts) $(CXX.Flags) -E
741 Link = $(Compile.Wrapper) \
742 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
743 $(LDFLAGS) $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
745 BCCompile.C = $(LLVMCC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
746 $(TargetCommonOpts) $(CompileCommonOpts)
747 Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
748 $(TargetCommonOpts) $(CompileCommonOpts) -E
750 BCCompile.CXX = $(LLVMCXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
751 $(TargetCommonOpts) $(CompileCommonOpts)
753 ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
754 ScriptInstall = $(INSTALL) -m 0755
755 DataInstall = $(INSTALL) -m 0644
757 # When compiling under Mingw/Cygwin, the tblgen tool expects Windows
758 # paths. In this case, the SYSPATH function (defined in
759 # Makefile.config) transforms Unix paths into Windows paths.
760 TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
761 -I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
762 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
763 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
764 LLVMTableGen = $(LLVM_TBLGEN) $(TableGen.Flags)
766 Archive = $(AR) $(AR.Flags)
767 LArchive = $(LLVMToolDir)/llvm-ar rcsf
776 #----------------------------------------------------------
777 # Get the list of source files and compute object file
779 #----------------------------------------------------------
782 Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
783 $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
785 Sources := $(SOURCES)
789 Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
792 BaseNameSources := $(sort $(basename $(Sources)))
794 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
795 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
797 #----------------------------------------------------------
798 # For Mingw MSYS bash and Python/w32:
800 # $(ECHOPATH) prints DOSish pathstring.
801 # ex) $(ECHOPATH) /include/sys/types.h
802 # --> C:/mingw/include/sys/types.h
803 # built-in "echo" does not transform path to DOSish path.
805 # FIXME: It would not be needed when MSYS's python
807 #----------------------------------------------------------
809 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
810 ECHOPATH := $(Verb)python -u -c "import sys;print ' '.join(sys.argv[1:])"
812 ECHOPATH := $(Verb)$(ECHO)
815 ###############################################################################
816 # DIRECTORIES: Handle recursive descent of directory structure
817 ###############################################################################
819 #---------------------------------------------------------
820 # Provide rules to make install dirs. This must be early
821 # in the file so they get built before dependencies
822 #---------------------------------------------------------
824 $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
827 # To create other directories, as needed, and timestamp their creation
829 $(Verb) $(MKDIR) $* > /dev/null
830 $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
832 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
833 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
835 #---------------------------------------------------------
836 # Handle the DIRS options for sequential construction
837 #---------------------------------------------------------
843 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
844 $(RecursiveTargets)::
845 $(Verb) for dir in $(DIRS); do \
846 if ([ ! -f $$dir/Makefile ] || \
847 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
849 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
851 ($(MAKE) -C $$dir $@ ) || exit 1; \
854 $(RecursiveTargets)::
855 $(Verb) for dir in $(DIRS); do \
856 ($(MAKE) -C $$dir $@ ) || exit 1; \
862 #---------------------------------------------------------
863 # Handle the EXPERIMENTAL_DIRS options ensuring success
864 # after each directory is built.
865 #---------------------------------------------------------
866 ifdef EXPERIMENTAL_DIRS
867 $(RecursiveTargets)::
868 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
869 if ([ ! -f $$dir/Makefile ] || \
870 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
872 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
874 ($(MAKE) -C $$dir $@ ) || exit 0; \
878 #-----------------------------------------------------------
879 # Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
880 #-----------------------------------------------------------
881 ifdef OPTIONAL_PARALLEL_DIRS
882 PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) -o -f $(T)/Makefile && echo "$(T)"))
885 #-----------------------------------------------------------
886 # Handle the PARALLEL_DIRS options for parallel construction
887 #-----------------------------------------------------------
890 SubDirs += $(PARALLEL_DIRS)
892 # Unfortunately, this list must be maintained if new recursive targets are added
893 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
894 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
895 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
896 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
897 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
898 install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
899 unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS))
901 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
905 SD=$(PROJ_SRC_DIR)/$(@D); \
907 if [ ! -f $$SD/Makefile ]; then \
909 DD=$(notdir $(@D)); \
911 if ([ ! -f $$DD/Makefile ] || \
912 command test $$DD/Makefile -ot \
913 $$SD/Makefile ); then \
915 $(CP) $$SD/Makefile $$DD/Makefile; \
917 $(MAKE) -C $$DD $(subst $(@D)/.make,,$@)
920 #---------------------------------------------------------
921 # Handle the OPTIONAL_DIRS options for directores that may
923 #---------------------------------------------------------
926 SubDirs += $(OPTIONAL_DIRS)
928 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
929 $(RecursiveTargets)::
930 $(Verb) for dir in $(OPTIONAL_DIRS); do \
931 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
932 if ([ ! -f $$dir/Makefile ] || \
933 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
935 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
937 ($(MAKE) -C$$dir $@ ) || exit 1; \
941 $(RecursiveTargets)::
942 $(Verb) for dir in $(OPTIONAL_DIRS); do \
943 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
944 ($(MAKE) -C$$dir $@ ) || exit 1; \
950 #---------------------------------------------------------
951 # Handle the CONFIG_FILES options
952 #---------------------------------------------------------
957 $(Echo) Install circumvented with NO_INSTALL
959 $(Echo) UnInstall circumvented with NO_INSTALL
961 install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
962 $(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir)
963 $(Verb)for file in $(CONFIG_FILES); do \
964 if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
965 $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
966 elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
967 $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
969 $(ECHO) Error: cannot find config file $${file}. ; \
974 $(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
975 $(Verb)for file in $(CONFIG_FILES); do \
976 $(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
982 ###############################################################################
983 # Set up variables for building libraries
984 ###############################################################################
986 #---------------------------------------------------------
987 # Define various command line options pertaining to the
988 # libraries needed when linking. There are "Proj" libs
989 # (defined by the user's project) and "LLVM" libs (defined
990 # by the LLVM project).
991 #---------------------------------------------------------
994 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
995 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
996 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
997 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
1001 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
1002 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
1003 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
1004 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
1007 # Loadable module for Win32 requires all symbols resolved for linking.
1008 # Then all symbols in LLVM.dll will be available.
1009 ifeq ($(ENABLE_SHARED),1)
1010 ifdef LOADABLE_MODULE
1011 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
1012 LINK_COMPONENTS += all
1017 ifndef IS_CLEANING_TARGET
1018 ifdef LINK_COMPONENTS
1020 # If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make
1021 # clean in tools, then do a make in tools (instead of at the top level).
1023 @echo "*** llvm-config doesn't exist - rebuilding it."
1024 @$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config
1026 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
1028 ifeq ($(ENABLE_SHARED), 1)
1029 # We can take the "auto-import" feature to get rid of using dllimport.
1030 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1031 LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
1034 LLVMLibsOptions += -lLLVM-$(LLVMVersion)
1035 LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT)
1038 ifndef NO_LLVM_CONFIG
1039 LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)
1040 ifeq ($(LLVMConfigLibs),Error)
1041 $(error llvm-config --libs failed)
1043 LLVMLibsOptions += $(LLVMConfigLibs)
1044 LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error)
1045 ifeq ($(LLVMConfigLibfiles),Error)
1046 $(error llvm-config --libfiles failed)
1048 LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles)
1055 # Set up the library exports file.
1056 ifdef EXPORTED_SYMBOL_FILE
1058 # First, set up the native export file, which may differ from the source
1061 ifeq ($(HOST_OS),Darwin)
1062 # Darwin convention prefixes symbols with underscores.
1063 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed
1064 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1065 $(Verb) sed -e 's/^/_/' < $< > $@
1067 -$(Verb) $(RM) -f $(NativeExportsFile)
1069 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1070 # Gold and BFD ld require a version script rather than a plain list.
1071 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
1072 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1073 $(Verb) echo "{" > $@
1074 $(Verb) grep -q '[[:alnum:]_]' $< && echo " global:" >> $@ || :
1075 $(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@
1076 ifneq ($(HOST_OS),OpenBSD)
1077 $(Verb) echo " local: *;" >> $@
1079 $(Verb) echo "};" >> $@
1081 -$(Verb) $(RM) -f $(NativeExportsFile)
1083 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1084 # GNU ld Win32 accepts .DEF files that contain "DATA" entries.
1085 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def))
1086 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1087 $(Echo) Generating $(notdir $@)
1088 $(Verb) $(ECHO) "EXPORTS" > $@
1089 $(Verb) $(CAT) $< >> $@
1091 -$(Verb) $(RM) -f $(NativeExportsFile)
1093 # Default behavior: just use the exports file verbatim.
1094 NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
1099 # Now add the linker command-line options to use the native export file.
1102 ifeq ($(HOST_OS),Darwin)
1103 LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
1106 # gold, bfd ld, etc.
1107 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1108 LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
1112 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1113 # LLVMLibsOptions is invalidated at processing tools/llvm-shlib.
1114 SharedLinkOptions += $(NativeExportsFile)
1119 ###############################################################################
1120 # Library Build Rules: Four ways to build a library
1121 ###############################################################################
1123 #---------------------------------------------------------
1124 # Bytecode Module Targets:
1125 # If the user set MODULE_NAME then they want to build a
1126 # bytecode module from the sources. We compile all the
1127 # sources and link it together into a single bytecode
1129 #---------------------------------------------------------
1132 ifeq ($(strip $(LLVMCC)),)
1133 $(warning Modules require LLVM capable compiler but none is available ****)
1136 Module := $(LibDir)/$(MODULE_NAME).bc
1137 LinkModule := $(LLVMLINK)
1140 ifdef EXPORTED_SYMBOL_FILE
1141 LinkModule += -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1144 $(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(LLVMLINK)
1145 $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
1146 $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
1148 all-local:: $(Module)
1151 ifneq ($(strip $(Module)),)
1152 -$(Verb) $(RM) -f $(Module)
1155 ifdef BYTECODE_DESTINATION
1156 ModuleDestDir := $(BYTECODE_DESTINATION)
1158 ModuleDestDir := $(DESTDIR)$(PROJ_libdir)
1163 $(Echo) Install circumvented with NO_INSTALL
1165 $(Echo) Uninstall circumvented with NO_INSTALL
1167 DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
1169 install-module:: $(DestModule)
1170 install-local:: $(DestModule)
1172 $(DestModule): $(ModuleDestDir) $(Module)
1173 $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
1174 $(Verb) $(DataInstall) $(Module) $(DestModule)
1177 $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
1178 -$(Verb) $(RM) -f $(DestModule)
1184 # if we're building a library ...
1187 # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option
1188 LIBRARYNAME := $(strip $(LIBRARYNAME))
1189 ifdef LOADABLE_MODULE
1190 BaseLibName.A := $(LIBRARYNAME).a
1191 BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT)
1193 BaseLibName.A := lib$(LIBRARYNAME).a
1194 BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
1196 LibName.A := $(LibDir)/$(BaseLibName.A)
1197 LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
1198 LibName.O := $(LibDir)/$(LIBRARYNAME).o
1199 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
1201 #---------------------------------------------------------
1202 # Shared Library Targets:
1203 # If the user asked for a shared library to be built
1204 # with the SHARED_LIBRARY variable, then we provide
1205 # targets for building them.
1206 #---------------------------------------------------------
1207 ifdef SHARED_LIBRARY
1209 all-local:: $(LibName.SO)
1211 ifdef EXPORTED_SYMBOL_FILE
1212 $(LibName.SO): $(NativeExportsFile)
1215 ifdef LINK_LIBS_IN_SHARED
1216 ifdef LOADABLE_MODULE
1217 SharedLibKindMessage := "Loadable Module"
1218 SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions)
1220 SharedLibKindMessage := "Shared Library"
1222 $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
1223 $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
1225 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
1226 $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
1228 $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
1229 $(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
1230 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
1234 ifneq ($(strip $(LibName.SO)),)
1235 -$(Verb) $(RM) -f $(LibName.SO)
1240 $(Echo) Install circumvented with NO_INSTALL
1242 $(Echo) Uninstall circumvented with NO_INSTALL
1245 # Win32.DLL prefers to be located on the "PATH" of binaries.
1246 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1247 DestSharedLibDir := $(DESTDIR)$(PROJ_bindir)
1249 DestSharedLibDir := $(DESTDIR)$(PROJ_libdir)
1251 DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
1253 install-local:: $(DestSharedLib)
1255 $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir)
1256 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
1257 $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
1260 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
1261 -$(Verb) $(RM) -f $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME).*
1265 #---------------------------------------------------------
1266 # Bytecode Library Targets:
1267 # If the user asked for a bytecode library to be built
1268 # with the BYTECODE_LIBRARY variable, then we provide
1269 # targets for building them.
1270 #---------------------------------------------------------
1271 ifdef BYTECODE_LIBRARY
1272 ifeq ($(strip $(LLVMCC)),)
1273 $(warning Bytecode libraries require LLVM capable compiler but none is available ****)
1276 all-local:: $(LibName.BCA)
1278 ifdef EXPORTED_SYMBOL_FILE
1279 BCLinkLib = $(LLVMLINK) -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1281 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLINK) \
1282 $(LLVMToolDir)/llvm-ar
1283 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
1285 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).internalize $(ObjectsBC)
1287 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).internalize.bc
1289 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
1290 $(LLVMToolDir)/llvm-ar
1291 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
1293 $(Verb) $(LArchive) $@ $(ObjectsBC)
1298 ifneq ($(strip $(LibName.BCA)),)
1299 -$(Verb) $(RM) -f $(LibName.BCA)
1302 ifdef BYTECODE_DESTINATION
1303 BytecodeDestDir := $(BYTECODE_DESTINATION)
1305 BytecodeDestDir := $(DESTDIR)$(PROJ_libdir)
1308 DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).bca
1310 install-bytecode-local:: $(DestBytecodeLib)
1314 $(Echo) Install circumvented with NO_INSTALL
1316 $(Echo) Uninstall circumvented with NO_INSTALL
1318 install-local:: $(DestBytecodeLib)
1320 $(DestBytecodeLib): $(LibName.BCA) $(BytecodeDestDir)
1321 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1322 $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
1325 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1326 -$(Verb) $(RM) -f $(DestBytecodeLib)
1331 #---------------------------------------------------------
1333 # If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
1334 # building an archive.
1335 #---------------------------------------------------------
1336 ifndef NO_BUILD_ARCHIVE
1337 ifndef BUILD_ARCHIVE
1338 ifndef LOADABLE_MODULE
1344 #---------------------------------------------------------
1345 # Archive Library Targets:
1346 # If the user wanted a regular archive library built,
1347 # then we provide targets for building them.
1348 #---------------------------------------------------------
1351 all-local:: $(LibName.A)
1353 $(LibName.A): $(ObjectsO) $(LibDir)/.dir
1354 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
1355 -$(Verb) $(RM) -f $@
1356 $(Verb) $(Archive) $@ $(ObjectsO)
1357 $(Verb) $(Ranlib) $@
1360 ifneq ($(strip $(LibName.A)),)
1361 -$(Verb) $(RM) -f $(LibName.A)
1366 $(Echo) Install circumvented with NO_INSTALL
1368 $(Echo) Uninstall circumvented with NO_INSTALL
1370 ifdef NO_INSTALL_ARCHIVES
1372 $(Echo) Install circumvented with NO_INSTALL
1374 $(Echo) Uninstall circumvented with NO_INSTALL
1376 DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a
1378 install-local:: $(DestArchiveLib)
1380 $(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
1381 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
1382 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
1383 $(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
1386 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
1387 -$(Verb) $(RM) -f $(DestArchiveLib)
1395 ###############################################################################
1396 # Tool Build Rules: Build executable tool based on TOOLNAME option
1397 ###############################################################################
1401 #---------------------------------------------------------
1402 # Set up variables for building a tool.
1403 #---------------------------------------------------------
1404 TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
1406 ToolBuildPath := $(ExmplDir)/$(TOOLEXENAME)
1408 ToolBuildPath := $(ToolDir)/$(TOOLEXENAME)
1411 # TOOLALIAS is a name to symlink (or copy) the tool to.
1414 ToolAliasBuildPath := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1416 ToolAliasBuildPath := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1420 #---------------------------------------------------------
1422 #---------------------------------------------------------
1424 # If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
1425 # not exporting all of the weak symbols from the binary. This reduces dyld
1426 # startup time by 4x on darwin in some cases.
1427 ifdef TOOL_NO_EXPORTS
1428 ifeq ($(HOST_OS),Darwin)
1430 # Tiger tools don't support this.
1431 ifneq ($(DARWIN_MAJVERS),4)
1432 LD.Flags += -Wl,-exported_symbol,_main
1436 ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU))
1437 ifneq ($(ARCH), Mips)
1438 LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
1443 #---------------------------------------------------------
1444 # Tool Order File Support
1445 #---------------------------------------------------------
1447 ifeq ($(HOST_OS),Darwin)
1448 ifdef TOOL_ORDER_FILE
1450 LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
1455 #---------------------------------------------------------
1456 # Tool Version Info Support
1457 #---------------------------------------------------------
1459 ifeq ($(HOST_OS),Darwin)
1460 ifdef TOOL_INFO_PLIST
1462 LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST)
1464 $(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST)
1466 $(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir
1467 $(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..."
1468 $(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \
1469 -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \
1470 -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \
1471 -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \
1477 #---------------------------------------------------------
1478 # Provide targets for building the tools
1479 #---------------------------------------------------------
1480 all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
1483 ifneq ($(strip $(ToolBuildPath)),)
1484 -$(Verb) $(RM) -f $(ToolBuildPath)
1486 ifneq ($(strip $(ToolAliasBuildPath)),)
1487 -$(Verb) $(RM) -f $(ToolAliasBuildPath)
1491 $(ToolBuildPath): $(ExmplDir)/.dir
1493 $(ToolBuildPath): $(ToolDir)/.dir
1496 ifdef CODESIGN_TOOLS
1497 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1498 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1499 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1500 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1501 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1503 $(Echo) ======= Code-Signing $(BuildMode) Executable $(TOOLNAME)
1504 $(Verb) codesign -s - $@
1506 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1507 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1508 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1509 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1510 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1514 ifneq ($(strip $(ToolAliasBuildPath)),)
1515 $(ToolAliasBuildPath): $(ToolBuildPath)
1516 $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
1517 $(Verb) $(RM) -f $(ToolAliasBuildPath)
1518 $(Verb) $(AliasTool) $(TOOLEXENAME) $(ToolAliasBuildPath)
1519 $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
1525 $(Echo) Install circumvented with NO_INSTALL
1527 $(Echo) Uninstall circumvented with NO_INSTALL
1531 ToolBinDir = $(DESTDIR)$(PROJ_internal_prefix)/bin
1533 ToolBinDir = $(DESTDIR)$(PROJ_bindir)
1535 DestTool = $(ToolBinDir)/$(TOOLEXENAME)
1537 install-local:: $(DestTool)
1539 $(DestTool): $(ToolBuildPath)
1540 $(Echo) Installing $(BuildMode) $(DestTool)
1541 $(Verb) $(MKDIR) $(ToolBinDir)
1542 $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
1545 $(Echo) Uninstalling $(BuildMode) $(DestTool)
1546 -$(Verb) $(RM) -f $(DestTool)
1548 # TOOLALIAS install.
1550 DestToolAlias = $(ToolBinDir)/$(TOOLALIAS)$(EXEEXT)
1552 install-local:: $(DestToolAlias)
1554 $(DestToolAlias): $(DestTool)
1555 $(Echo) Installing $(BuildMode) $(DestToolAlias)
1556 $(Verb) $(RM) -f $(DestToolAlias)
1557 $(Verb) $(AliasTool) $(TOOLEXENAME) $(DestToolAlias)
1560 $(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
1561 -$(Verb) $(RM) -f $(DestToolAlias)
1567 ###############################################################################
1568 # Object Build Rules: Build object files based on sources
1569 ###############################################################################
1571 # FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
1572 ifeq ($(HOST_OS),HP-UX)
1573 DISABLE_AUTO_DEPENDENCIES=1
1576 # Provide rule sets for when dependency generation is enabled
1577 ifndef DISABLE_AUTO_DEPENDENCIES
1579 #---------------------------------------------------------
1580 # Create .o files in the ObjDir directory from the .cpp and .c files...
1581 #---------------------------------------------------------
1583 DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
1584 -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
1586 # If the build succeeded, move the dependency file over, otherwise
1588 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
1589 else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
1591 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1592 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1593 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1596 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1597 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1598 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1601 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1602 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1603 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1606 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1607 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1608 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1611 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1612 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1613 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1616 #---------------------------------------------------------
1617 # Create .bc files in the ObjDir directory from .cpp .cc and .c files...
1618 #---------------------------------------------------------
1620 BC_DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.bc.d.tmp" \
1621 -MT "$(ObjDir)/$*.ll" -MT "$(ObjDir)/$*.bc.d"
1623 # If the build succeeded, move the dependency file over, otherwise
1625 BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d"; \
1626 else $(RM) "$(ObjDir)/$*.bc.d.tmp"; exit 1; fi
1628 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1629 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1630 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1631 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1632 $(BC_DEPEND_MOVEFILE)
1634 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1635 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1636 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1637 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1638 $(BC_DEPEND_MOVEFILE)
1640 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1641 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1642 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1643 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1644 $(BC_DEPEND_MOVEFILE)
1646 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1647 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1648 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1649 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1650 $(BC_DEPEND_MOVEFILE)
1652 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1653 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1654 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1655 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1656 $(BC_DEPEND_MOVEFILE)
1658 # Provide alternate rule sets if dependencies are disabled
1661 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1662 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1663 $(Compile.CXX) $< -o $@
1665 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1666 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1667 $(Compile.CXX) $< -o $@
1669 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1670 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1671 $(Compile.CXX) $< -o $@
1673 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1674 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1675 $(Compile.C) $< -o $@
1677 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1678 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1679 $(Compile.C) $< -o $@
1681 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1682 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1683 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1685 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1686 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1687 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1689 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1690 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1691 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1693 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1694 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1695 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1697 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1698 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1699 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1704 ## Rules for building preprocessed (.i/.ii) outputs.
1705 $(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1706 $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
1707 $(Verb) $(Preprocess.CXX) $< -o $@
1709 $(BuildMode)/%.ii: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1710 $(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file"
1711 $(Verb) $(Preprocess.CXX) $< -o $@
1713 $(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1714 $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
1715 $(Verb) $(Preprocess.CXX) $< -o $@
1717 $(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1718 $(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
1719 $(Verb) $(Preprocess.C) $< -o $@
1721 $(BuildMode)/%.i: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1722 $(Echo) "Compiling $*.m for $(BuildMode) build to .i file"
1723 $(Verb) $(Preprocess.C) $< -o $@
1726 $(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1727 $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
1728 $(Compile.CXX) $< -o $@ -S
1730 $(ObjDir)/%.s: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1731 $(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG)
1732 $(Compile.CXX) $< -o $@ -S
1734 $(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1735 $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
1736 $(Compile.CXX) $< -o $@ -S
1738 $(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1739 $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
1740 $(Compile.C) $< -o $@ -S
1742 $(ObjDir)/%.s: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1743 $(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG)
1744 $(Compile.C) $< -o $@ -S
1747 # make the C and C++ compilers strip debug info out of bytecode libraries.
1749 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1750 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1751 $(Verb) $(LOPT) $< -std-compile-opts -o $@
1753 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1754 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1755 $(Verb) $(LOPT) $< -std-compile-opts -strip-debug -o $@
1759 #---------------------------------------------------------
1760 # Provide rule to build .bc files from .ll sources,
1761 # regardless of dependencies
1762 #---------------------------------------------------------
1763 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
1764 $(Echo) "Compiling $*.ll for $(BuildMode) build"
1765 $(Verb) $(LLVMAS) $< -f -o $@
1767 ###############################################################################
1768 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
1769 ###############################################################################
1772 TABLEGEN_INC_FILES_COMMON = 1
1775 ifdef TABLEGEN_INC_FILES_COMMON
1777 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
1778 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1779 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
1781 # INCFiles rule: All of the tblgen generated files are emitted to
1782 # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
1783 # us to only "touch" the real file if the contents of it change. IOW, if
1784 # tblgen is modified, all of the .inc.tmp files are regenerated, but no
1785 # dependencies of the .inc files are, unless the contents of the .inc file
1787 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
1788 $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
1790 endif # TABLEGEN_INC_FILES_COMMON
1794 TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
1795 $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \
1796 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \
1797 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \
1798 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \
1799 $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
1800 $(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td)
1802 # All .inc.tmp files depend on the .td files.
1803 $(INCTMPFiles) : $(TDFiles)
1805 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1806 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1807 $(Echo) "Building $(<F) register info implementation with tblgen"
1808 $(Verb) $(LLVMTableGen) -gen-register-info -o $(call SYSPATH, $@) $<
1810 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1811 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1812 $(Echo) "Building $(<F) instruction information with tblgen"
1813 $(Verb) $(LLVMTableGen) -gen-instr-info -o $(call SYSPATH, $@) $<
1815 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1816 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1817 $(Echo) "Building $(<F) assembly writer with tblgen"
1818 $(Verb) $(LLVMTableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
1820 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1821 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1822 $(Echo) "Building $(<F) assembly writer #1 with tblgen"
1823 $(Verb) $(LLVMTableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
1825 $(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
1826 $(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1827 $(Echo) "Building $(<F) assembly matcher with tblgen"
1828 $(Verb) $(LLVMTableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
1830 $(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \
1831 $(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1832 $(Echo) "Building $(<F) MC code emitter with tblgen"
1833 $(Verb) $(LLVMTableGen) -gen-emitter -mc-emitter -o $(call SYSPATH, $@) $<
1835 $(TARGET:%=$(ObjDir)/%GenMCPseudoLowering.inc.tmp): \
1836 $(ObjDir)/%GenMCPseudoLowering.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1837 $(Echo) "Building $(<F) MC Pseudo instruction expander with tblgen"
1838 $(Verb) $(LLVMTableGen) -gen-pseudo-lowering -o $(call SYSPATH, $@) $<
1840 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1841 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1842 $(Echo) "Building $(<F) code emitter with tblgen"
1843 $(Verb) $(LLVMTableGen) -gen-emitter -o $(call SYSPATH, $@) $<
1845 $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
1846 $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1847 $(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
1848 $(Verb) $(LLVMTableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
1850 $(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \
1851 $(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1852 $(Echo) "Building $(<F) disassembly tables with tblgen"
1853 $(Verb) $(LLVMTableGen) -gen-disassembler -o $(call SYSPATH, $@) $<
1855 $(TARGET:%=$(ObjDir)/%GenEDInfo.inc.tmp): \
1856 $(ObjDir)/%GenEDInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1857 $(Echo) "Building $(<F) enhanced disassembly information with tblgen"
1858 $(Verb) $(LLVMTableGen) -gen-enhanced-disassembly-info -o $(call SYSPATH, $@) $<
1860 $(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
1861 $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1862 $(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
1863 $(Verb) $(LLVMTableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
1865 $(TARGET:%=$(ObjDir)/%GenSubtargetInfo.inc.tmp): \
1866 $(ObjDir)/%GenSubtargetInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1867 $(Echo) "Building $(<F) subtarget information with tblgen"
1868 $(Verb) $(LLVMTableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
1870 $(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
1871 $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1872 $(Echo) "Building $(<F) calling convention information with tblgen"
1873 $(Verb) $(LLVMTableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
1875 $(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
1876 $(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1877 $(Echo) "Building $(<F) intrinsics information with tblgen"
1878 $(Verb) $(LLVMTableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
1880 $(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1881 $(Echo) "Building $(<F) decoder tables with tblgen"
1882 $(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $<
1884 $(ObjDir)/%GenDFAPacketizer.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1885 $(Echo) "Building $(<F) DFA packetizer tables with tblgen"
1886 $(Verb) $(LLVMTableGen) -gen-dfa-packetizer -o $(call SYSPATH, $@) $<
1889 -$(Verb) $(RM) -f $(INCFiles)
1893 ###############################################################################
1894 # OTHER RULES: Other rules needed
1895 ###############################################################################
1897 # To create postscript files from dot files...
1898 ifneq ($(DOT),false)
1900 $(DOT) -Tps < $< > $@
1903 $(Echo) "Cannot build $@: The program dot is not installed"
1906 # This rules ensures that header files that are removed still have a rule for
1907 # which they can be "generated." This allows make to ignore them and
1908 # reproduce the dependency lists.
1912 # Define clean-local to clean the current directory. Note that this uses a
1913 # very conservative approach ensuring that empty variables do not cause
1914 # errors or disastrous removal.
1916 ifneq ($(strip $(ObjRootDir)),)
1917 -$(Verb) $(RM) -rf $(ObjRootDir)
1919 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1920 -$(Verb) $(RM) -f *$(SHLIBEXT)
1924 -$(Verb) $(RM) -rf Debug Release Profile
1927 ###############################################################################
1928 # DEPENDENCIES: Include the dependency files if we should
1929 ###############################################################################
1930 ifndef DISABLE_AUTO_DEPENDENCIES
1932 # If its not one of the cleaning targets
1933 ifndef IS_CLEANING_TARGET
1935 # Get the list of dependency files
1936 DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources)))
1937 DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
1939 # Include bitcode dependency files if using bitcode libraries
1940 ifdef BYTECODE_LIBRARY
1941 DependFiles += $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.bc.d)
1944 -include $(DependFiles) ""
1950 ###############################################################################
1951 # CHECK: Running the test suite
1952 ###############################################################################
1955 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1956 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1957 $(EchoCmd) Running test suite ; \
1958 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
1959 TESTSUITE=$(TESTSUITE) ; \
1961 $(EchoCmd) No Makefile in test directory ; \
1964 $(EchoCmd) No test directory ; \
1967 # An alias dating from when both lit and DejaGNU test runners were used.
1971 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1972 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1973 $(EchoCmd) Running test suite ; \
1974 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \
1976 $(EchoCmd) No Makefile in test directory ; \
1979 $(EchoCmd) No test directory ; \
1982 ###############################################################################
1983 # UNITTESTS: Running the unittests test suite
1984 ###############################################################################
1987 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
1988 if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
1989 $(EchoCmd) Running unittests test suite ; \
1990 $(MAKE) -C $(PROJ_OBJ_ROOT)/unittests unitcheck; \
1992 $(EchoCmd) No Makefile in unittests directory ; \
1995 $(EchoCmd) No unittests directory ; \
1998 ###############################################################################
1999 # DISTRIBUTION: Handle construction of a distribution tarball
2000 ###############################################################################
2002 #------------------------------------------------------------------------
2003 # Define distribution related variables
2004 #------------------------------------------------------------------------
2005 DistName := $(PROJECT_NAME)-$(PROJ_VERSION)
2006 DistDir := $(PROJ_OBJ_ROOT)/$(DistName)
2007 TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName)
2008 DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
2009 DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip
2010 DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
2011 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
2012 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
2013 Makefile.config.in configure autoconf
2014 DistOther := $(notdir $(wildcard \
2015 $(PROJ_SRC_DIR)/*.h \
2016 $(PROJ_SRC_DIR)/*.td \
2017 $(PROJ_SRC_DIR)/*.def \
2018 $(PROJ_SRC_DIR)/*.ll \
2019 $(PROJ_SRC_DIR)/*.in))
2020 DistSubDirs := $(SubDirs)
2021 DistSources = $(Sources) $(EXTRA_DIST)
2022 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
2024 #------------------------------------------------------------------------
2025 # We MUST build distribution with OBJ_DIR != SRC_DIR
2026 #------------------------------------------------------------------------
2027 ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
2028 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
2029 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
2033 #------------------------------------------------------------------------
2034 # Prevent attempt to run dist targets from anywhere but the top level
2035 #------------------------------------------------------------------------
2037 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
2038 $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
2041 #------------------------------------------------------------------------
2042 # Provide the top level targets
2043 #------------------------------------------------------------------------
2045 dist-gzip:: $(DistTarGZip)
2047 $(DistTarGZip) : $(TopDistDir)/.makedistdir
2048 $(Echo) Packing gzipped distribution tar file.
2049 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
2050 $(GZIP) -c > "$(DistTarGZip)"
2052 dist-bzip2:: $(DistTarBZ2)
2054 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
2055 $(Echo) Packing bzipped distribution tar file.
2056 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
2057 $(BZIP2) -c >$(DistTarBZ2)
2059 dist-zip:: $(DistZip)
2061 $(DistZip) : $(TopDistDir)/.makedistdir
2062 $(Echo) Packing zipped distribution file.
2063 $(Verb) rm -f $(DistZip)
2064 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
2066 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
2067 $(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL =====
2069 DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
2071 dist-check:: $(DistTarGZip)
2072 $(Echo) Checking distribution tar file.
2073 $(Verb) if test -d $(DistCheckDir) ; then \
2074 $(RM) -rf $(DistCheckDir) ; \
2076 $(Verb) $(MKDIR) $(DistCheckDir)
2077 $(Verb) cd $(DistCheckDir) && \
2078 $(MKDIR) $(DistCheckDir)/build && \
2079 $(MKDIR) $(DistCheckDir)/install && \
2080 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
2082 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
2083 --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
2086 $(MAKE) unittests && \
2087 $(MAKE) install && \
2088 $(MAKE) uninstall && \
2089 $(MAKE) dist-clean && \
2090 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
2093 $(Echo) Cleaning distribution files
2094 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
2099 #------------------------------------------------------------------------
2100 # Provide the recursive distdir target for building the distribution directory
2101 #------------------------------------------------------------------------
2102 distdir: $(DistDir)/.makedistdir
2103 $(DistDir)/.makedistdir: $(DistSources)
2104 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2105 if test -d "$(DistDir)" ; then \
2106 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
2109 $(EchoCmd) Removing old $(DistDir) ; \
2110 $(RM) -rf $(DistDir); \
2111 $(EchoCmd) Making 'all' to verify build ; \
2112 $(MAKE) ENABLE_OPTIMIZED=1 all ; \
2114 $(Echo) Building Distribution Directory $(DistDir)
2115 $(Verb) $(MKDIR) $(DistDir)
2116 $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
2117 srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
2118 for file in $(DistFiles) ; do \
2120 $(PROJ_SRC_DIR)/*) \
2121 file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
2123 $(PROJ_SRC_ROOT)/*) \
2124 file=`echo "$$file" | \
2125 sed "s#^$$srcrootstrip/##"` \
2128 if test -f "$(PROJ_SRC_DIR)/$$file" || \
2129 test -d "$(PROJ_SRC_DIR)/$$file" ; then \
2130 from_dir="$(PROJ_SRC_DIR)" ; \
2131 elif test -f "$$file" || test -d "$$file" ; then \
2134 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
2135 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
2136 to_dir="$(DistDir)/$$dir"; \
2137 $(MKDIR) "$$to_dir" ; \
2139 to_dir="$(DistDir)"; \
2141 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
2142 if test -n "$$mid_dir" ; then \
2143 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
2145 if test -d "$$from_dir/$$file"; then \
2146 if test -d "$(PROJ_SRC_DIR)/$$file" && \
2147 test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
2148 cd $(PROJ_SRC_DIR) ; \
2149 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2150 ( cd $$to_dir ; $(TAR) xf - ) ; \
2151 cd $(PROJ_OBJ_DIR) ; \
2154 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2155 ( cd $$to_dir ; $(TAR) xf - ) ; \
2156 cd $(PROJ_OBJ_DIR) ; \
2158 elif test -f "$$from_dir/$$file" ; then \
2159 $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
2160 elif test -L "$$from_dir/$$file" ; then \
2161 $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
2162 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
2163 $(EchoCmd) "===== WARNING: Distribution Source " \
2164 "$$from_dir/$$file Not Found!" ; \
2165 elif test "$(Verb)" != '@' ; then \
2166 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
2169 $(Verb) for subdir in $(DistSubDirs) ; do \
2170 if test "$$subdir" \!= "." ; then \
2171 new_distdir="$(DistDir)/$$subdir" ; \
2172 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
2173 ( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
2174 DistDir="$$new_distdir" distdir ) || exit 1; \
2177 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2178 $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
2179 $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
2180 -name .svn \) -print` ;\
2181 $(MAKE) dist-hook ; \
2182 $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
2183 -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
2184 -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
2185 -o ! -type d ! -perm -444 -exec \
2186 $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
2187 || chmod -R a+r $(DistDir) ; \
2190 # This is invoked by distdir target, define it as a no-op to avoid errors if not
2196 ###############################################################################
2197 # TOP LEVEL - targets only to apply at the top level directory
2198 ###############################################################################
2202 #------------------------------------------------------------------------
2203 # Install support for the project's include files:
2204 #------------------------------------------------------------------------
2207 $(Echo) Install circumvented with NO_INSTALL
2209 $(Echo) Uninstall circumvented with NO_INSTALL
2212 $(Echo) Installing include files
2213 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
2214 $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
2215 cd $(PROJ_SRC_ROOT)/include && \
2216 for hdr in `find . -type f \
2217 '(' -name LICENSE.TXT \
2222 ')' -print | grep -v CVS | \
2223 grep -v .svn` ; do \
2224 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2225 if test \! -d "$$instdir" ; then \
2226 $(EchoCmd) Making install directory $$instdir ; \
2227 $(MKDIR) $$instdir ;\
2229 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2232 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
2233 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
2234 cd $(PROJ_OBJ_ROOT)/include && \
2235 for hdr in `find . -type f \
2236 '(' -name LICENSE.TXT \
2241 ')' -print | grep -v CVS | \
2242 grep -v .svn` ; do \
2243 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2244 if test \! -d "$$instdir" ; then \
2245 $(EchoCmd) Making install directory $$instdir ; \
2246 $(MKDIR) $$instdir ;\
2248 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2254 $(Echo) Uninstalling include files
2255 $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
2256 cd $(PROJ_SRC_ROOT)/include && \
2257 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
2258 '!' '(' -name '*~' -o -name '.#*' \
2259 -o -name '*.in' ')' -print ')' | \
2260 grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2261 cd $(PROJ_SRC_ROOT)/include && \
2262 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
2263 -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2269 @echo searching for overlength lines in files: $(Sources)
2272 egrep -n '.{81}' $(Sources) /dev/null
2275 @echo searching for tabs in files: $(Sources)
2278 egrep -n ' ' $(Sources) /dev/null
2281 @ls -l $(LibDir) | awk '\
2282 BEGIN { sum = 0; } \
2284 END { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2285 @ls -l $(ToolDir) | awk '\
2286 BEGIN { sum = 0; } \
2288 END { printf("Programs: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2289 #------------------------------------------------------------------------
2290 # Print out the directories used for building
2291 #------------------------------------------------------------------------
2293 $(Echo) "BuildMode : " '$(BuildMode)'
2294 $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
2295 $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
2296 $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
2297 $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
2298 $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
2299 $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
2300 $(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
2301 $(Echo) "PROJ_internal_prefix : " '$(PROJ_internal_prefix)'
2302 $(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
2303 $(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
2304 $(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
2305 $(Echo) "PROJ_includedir : " '$(PROJ_includedir)'
2306 $(Echo) "UserTargets : " '$(UserTargets)'
2307 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
2308 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
2309 $(Echo) "ObjDir : " '$(ObjDir)'
2310 $(Echo) "LibDir : " '$(LibDir)'
2311 $(Echo) "ToolDir : " '$(ToolDir)'
2312 $(Echo) "ExmplDir : " '$(ExmplDir)'
2313 $(Echo) "Sources : " '$(Sources)'
2314 $(Echo) "TDFiles : " '$(TDFiles)'
2315 $(Echo) "INCFiles : " '$(INCFiles)'
2316 $(Echo) "INCTMPFiles : " '$(INCTMPFiles)'
2317 $(Echo) "PreConditions: " '$(PreConditions)'
2318 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
2319 $(Echo) "Compile.C : " '$(Compile.C)'
2320 $(Echo) "Archive : " '$(Archive)'
2321 $(Echo) "YaccFiles : " '$(YaccFiles)'
2322 $(Echo) "LexFiles : " '$(LexFiles)'
2323 $(Echo) "Module : " '$(Module)'
2324 $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
2325 $(Echo) "SubDirs : " '$(SubDirs)'
2326 $(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
2327 $(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
2332 # General debugging rule, use 'make dbg-print-XXX' to print the
2333 # definition, value and origin of XXX.
2335 $(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))