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 # PRECONDITIONS: that which must be built/checked first
62 ################################################################################
64 SrcMakefiles := $(filter %Makefile %Makefile.tests,\
65 $(wildcard $(PROJ_SRC_DIR)/Makefile*))
66 ObjMakefiles := $(subst $(PROJ_SRC_DIR),$(PROJ_OBJ_DIR),$(SrcMakefiles))
67 ConfigureScript := $(PROJ_SRC_ROOT)/configure
68 ConfigStatusScript := $(PROJ_OBJ_ROOT)/config.status
69 MakefileConfigIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.config.in))
70 MakefileCommonIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.common.in))
71 MakefileConfig := $(PROJ_OBJ_ROOT)/Makefile.config
72 MakefileCommon := $(PROJ_OBJ_ROOT)/Makefile.common
73 PreConditions := $(ConfigStatusScript) $(ObjMakefiles)
74 ifneq ($(MakefileCommonIn),)
75 PreConditions += $(MakefileCommon)
78 ifneq ($(MakefileConfigIn),)
79 PreConditions += $(MakefileConfig)
82 preconditions: $(PreConditions)
84 #------------------------------------------------------------------------
85 # Make sure the BUILT_SOURCES are built first
86 #------------------------------------------------------------------------
87 $(filter-out clean clean-local,$(UserTargets)):: $(BUILT_SOURCES)
90 ifneq ($(strip $(BUILT_SOURCES)),)
91 -$(Verb) $(RM) -f $(BUILT_SOURCES)
94 ifneq ($(PROJ_OBJ_ROOT),$(PROJ_SRC_ROOT))
96 $(Verb) if test -x config.status ; then \
97 $(EchoCmd) Wiping out $(PROJ_OBJ_ROOT) ; \
98 $(MKDIR) .spotless.save ; \
99 $(MV) config.status .spotless.save ; \
100 $(MV) mklib .spotless.save ; \
101 $(MV) projects .spotless.save ; \
103 $(MV) .spotless.save/config.status . ; \
104 $(MV) .spotless.save/mklib . ; \
105 $(MV) .spotless.save/projects . ; \
106 $(RM) -rf .spotless.save ; \
107 $(EchoCmd) Rebuilding configuration of $(PROJ_OBJ_ROOT) ; \
108 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
109 $(ConfigStatusScript) ; \
111 $(EchoCmd) "make spotless" can only be run from $(PROJ_OBJ_ROOT); \
115 $(EchoCmd) "spotless target not supported for objdir == srcdir"
118 $(BUILT_SOURCES) : $(ObjMakefiles)
120 #------------------------------------------------------------------------
121 # Make sure we're not using a stale configuration
122 #------------------------------------------------------------------------
124 $(Echo) Reconfiguring $(PROJ_OBJ_ROOT)
125 $(Verb) cd $(PROJ_OBJ_ROOT) && \
126 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
127 $(ConfigStatusScript)
129 .PRECIOUS: $(ConfigStatusScript)
130 $(ConfigStatusScript): $(ConfigureScript)
131 $(Echo) Reconfiguring with $<
132 $(Verb) cd $(PROJ_OBJ_ROOT) && \
133 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
134 $(ConfigStatusScript)
136 #------------------------------------------------------------------------
137 # Make sure the configuration makefile is up to date
138 #------------------------------------------------------------------------
139 ifneq ($(MakefileConfigIn),)
140 $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
141 $(Echo) Regenerating $@
142 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
145 ifneq ($(MakefileCommonIn),)
146 $(MakefileCommon): $(MakefileCommonIn) $(ConfigStatusScript)
147 $(Echo) Regenerating $@
148 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.common
151 #------------------------------------------------------------------------
152 # If the Makefile in the source tree has been updated, copy it over into the
153 # build tree. But, only do this if the source and object makefiles differ
154 #------------------------------------------------------------------------
156 PROJ_MAKEFILE := $(PROJ_SRC_DIR)/Makefile
159 ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
161 Makefile: $(PROJ_MAKEFILE) $(ExtraMakefiles)
162 $(Echo) "Updating Makefile"
163 $(Verb) $(MKDIR) $(@D)
164 $(Verb) $(CP) -f $< $@
166 # Copy the Makefile.* files unless we're in the root directory which avoids
167 # the copying of Makefile.config.in or other things that should be explicitly
169 $(PROJ_OBJ_DIR)/Makefile% : $(PROJ_MAKEFILE)%
171 *Makefile.rules) ;; \
173 *) $(EchoCmd) "Updating $(@F)" ; \
180 #------------------------------------------------------------------------
181 # Set up the basic dependencies
182 #------------------------------------------------------------------------
183 $(UserTargets):: $(PreConditions)
187 clean-all:: clean-local clean-all-local
188 install:: install-local
189 uninstall:: uninstall-local
190 install-local:: all-local
191 install-bytecode:: install-bytecode-local
193 ###############################################################################
194 # VARIABLES: Set up various variables based on configuration data
195 ###############################################################################
197 # Variable for if this make is for a "cleaning" target
198 ifneq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),)
202 #--------------------------------------------------------------------
203 # Variables derived from configuration we are building
204 #--------------------------------------------------------------------
207 ifeq ($(ENABLE_OPTIMIZED),1)
209 # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
210 ifneq ($(HOST_OS),FreeBSD)
211 ifneq ($(HOST_OS),Darwin)
212 OmitFramePointer := -fomit-frame-pointer
216 # Darwin requires -fstrict-aliasing to be explicitly enabled.
217 # Avoid -fstrict-aliasing on Darwin for now, there are unresolved issues
218 # with -fstrict-aliasing and ipa-type-escape radr://6756684
219 #ifeq ($(HOST_OS),Darwin)
220 # EXTRA_OPTIONS += -fstrict-aliasing -Wstrict-aliasing
222 CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
223 C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
224 LD.Flags += $(OPTIMIZE_OPTION)
226 BuildMode := $(BuildMode)+Debug
233 ifdef NO_DEBUG_SYMBOLS
234 BuildMode := Unoptimized
248 ifeq ($(ENABLE_LIBCPP),1)
249 CXX.Flags += -stdlib=libc++
250 LD.Flags += -stdlib=libc++
253 ifeq ($(ENABLE_CXX11),1)
254 CXX.Flags += -std=c++11
257 ifeq ($(ENABLE_WERROR),1)
262 ifeq ($(ENABLE_PROFILING),1)
263 BuildMode := $(BuildMode)+Profile
264 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
265 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) -pg -g
266 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg -g
270 #ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
271 # CXX.Flags += -fvisibility-inlines-hidden
274 ifdef ENABLE_EXPENSIVE_CHECKS
275 # GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above.
276 # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40160
280 # IF REQUIRES_EH=1 is specified then don't disable exceptions
282 CXX.Flags += -fno-exceptions
284 # If the library requires EH, it also requires RTTI.
288 ifdef REQUIRES_FRAME_POINTER
289 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags))
290 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags))
291 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags))
294 # If REQUIRES_RTTI=1 is specified then don't disable run-time type id.
295 ifneq ($(REQUIRES_RTTI), 1)
296 CXX.Flags += -fno-rtti
299 ifeq ($(ENABLE_COVERAGE),1)
300 BuildMode := $(BuildMode)+Coverage
301 CXX.Flags += -ftest-coverage -fprofile-arcs
302 C.Flags += -ftest-coverage -fprofile-arcs
305 # If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
306 # then disable assertions by defining the appropriate preprocessor symbols.
307 ifeq ($(DISABLE_ASSERTIONS),1)
308 CPP.Defines += -DNDEBUG
310 BuildMode := $(BuildMode)+Asserts
311 CPP.Defines += -D_DEBUG
314 # If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
315 # configured), then enable expensive checks by defining the
316 # appropriate preprocessor symbols.
317 ifeq ($(ENABLE_EXPENSIVE_CHECKS),1)
318 BuildMode := $(BuildMode)+Checks
319 CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
322 # LOADABLE_MODULE implies several other things so we force them to be
324 ifdef LOADABLE_MODULE
326 LINK_LIBS_IN_SHARED := 1
334 ifeq ($(ENABLE_PIC),1)
335 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
336 # Nothing. Win32 defaults to PIC and warns when given -fPIC
338 ifeq ($(HOST_OS),Darwin)
339 # Common symbols not allowed in dylib files
340 CXX.Flags += -fno-common
341 C.Flags += -fno-common
343 # Linux and others; pass -fPIC
349 ifeq ($(HOST_OS),Darwin)
350 CXX.Flags += -mdynamic-no-pic
351 C.Flags += -mdynamic-no-pic
355 # Support makefile variable to disable any kind of timestamp/non-deterministic
356 # info from being used in the build.
357 ifeq ($(ENABLE_TIMESTAMPS),1)
358 DOTDIR_TIMESTAMP_COMMAND := $(DATE)
360 DOTDIR_TIMESTAMP_COMMAND := echo 'Created.'
363 ifeq ($(HOST_OS),MingW)
365 CPP.Defines += -D__NO_CTYPE_INLINE
366 ifeq ($(LLVM_CROSS_COMPILING),1)
367 # Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016
369 LD.Flags += -Wl,--allow-multiple-definition
374 CXX.Flags += -Woverloaded-virtual
375 CPP.BaseFlags += $(CPP.Defines)
378 # Make Floating point IEEE compliant on Alpha.
381 CPP.BaseFlags += -mieee
382 ifeq ($(ENABLE_PIC),0)
384 CPP.BaseFlags += -fPIC
387 LD.Flags += -Wl,--no-relax
390 # GNU ld/PECOFF accepts but ignores them below;
394 # FIXME: autoconf should be aware of them.
395 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
396 HAVE_LINK_VERSION_SCRIPT := 0
398 RDYNAMIC := -Wl,--export-all-symbols
401 #--------------------------------------------------------------------
402 # Directory locations
403 #--------------------------------------------------------------------
405 ifeq ($(LLVM_CROSS_COMPILING),1)
406 BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin
409 ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode)
410 ObjDir := $(ObjRootDir)
411 LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
412 ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
413 ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
414 LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
415 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
416 LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
418 #--------------------------------------------------------------------
419 # Locations of shared libraries
420 #--------------------------------------------------------------------
423 SharedLibDir := $(LibDir)
424 LLVMSharedLibDir := $(LLVMLibDir)
426 # Win32.DLL prefers to be located on the "PATH" of binaries.
427 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
428 SharedLibDir := $(ToolDir)
429 LLVMSharedLibDir := $(LLVMToolDir)
431 ifeq ($(HOST_OS),Cygwin)
438 #--------------------------------------------------------------------
439 # LLVM Capable Compiler
440 #--------------------------------------------------------------------
442 ifneq ($(findstring llvm-gcc,$(LLVMCC_OPTION)),)
444 LLVMCXX := $(LLVMGXX)
446 ifneq ($(findstring clang,$(LLVMCC_OPTION)),)
447 ifneq ($(CLANGPATH),)
448 LLVMCC := $(CLANGPATH)
449 LLVMCXX := $(CLANGXXPATH)
451 ifeq ($(ENABLE_BUILT_CLANG),1)
452 LLVMCC := $(LLVMToolDir)/clang
453 LLVMCXX := $(LLVMToolDir)/clang++
459 #--------------------------------------------------------------------
460 # Full Paths To Compiled Tools and Utilities
461 #--------------------------------------------------------------------
462 EchoCmd = $(ECHO) llvm[$(MAKELEVEL)]:
465 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
468 ifeq ($(LLVM_CROSS_COMPILING),1)
469 LLVM_TBLGEN := $(BuildLLVMToolDir)/llvm-tblgen$(BUILD_EXEEXT)
471 LLVM_TBLGEN := $(LLVMToolDir)/llvm-tblgen$(EXEEXT)
474 LLVM_CONFIG := $(LLVMToolDir)/llvm-config
476 LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
479 LLI := $(LLVMToolDir)/lli$(EXEEXT)
482 LLC := $(LLVMToolDir)/llc$(EXEEXT)
485 LOPT := $(LLVMToolDir)/opt$(EXEEXT)
488 LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
491 #--------------------------------------------------------------------
492 # Adjust to user's request
493 #--------------------------------------------------------------------
495 ifeq ($(HOST_OS),Darwin)
496 DARWIN_VERSION := `sw_vers -productVersion`
497 # Strip a number like 10.4.7 to 10.4
498 DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/')
499 # Get "4" out of 10.4 for later pieces in the makefile.
500 DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
502 LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress
503 SharedLinkOptions := -dynamiclib
504 ifdef DEPLOYMENT_TARGET
505 SharedLinkOptions += $(DEPLOYMENT_TARGET)
508 SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
512 SharedLinkOptions=-shared
515 ifeq ($(TARGET_OS),Darwin)
516 ifdef DEPLOYMENT_TARGET
517 TargetCommonOpts += $(DEPLOYMENT_TARGET)
520 TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
526 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
527 ifneq ($(HOST_OS),Darwin)
528 LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
540 # Adjust settings for verbose mode
543 AR.Flags += >/dev/null 2>/dev/null
544 ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
546 ConfigureScriptFLAGS :=
549 # By default, strip symbol information from executable
551 Strip := $(PLATFORMSTRIPOPTS)
552 StripWarnMsg := "(without symbols)"
553 Install.StripFlag += -s
556 ifdef TOOL_NO_EXPORTS
559 DynamicFlag := $(RDYNAMIC)
562 # Adjust linker flags for building an executable
563 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
564 ifneq ($(HOST_OS), Darwin)
566 LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
568 LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
570 LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
574 ifneq ($(DARWIN_MAJVERS),4)
575 LD.Flags += $(RPATH) -Wl,@executable_path/../lib
581 #----------------------------------------------------------
582 # Options To Invoke Tools
583 #----------------------------------------------------------
585 ifdef EXTRA_LD_OPTIONS
586 LD.Flags += $(EXTRA_LD_OPTIONS)
590 CompileCommonOpts += -pedantic -Wno-long-long
592 CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
593 $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT)
594 # Enable cast-qual for C++; the workaround is to use const_cast.
595 CXX.Flags += -Wcast-qual
597 ifeq ($(HOST_OS),HP-UX)
598 CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
601 # If we are building a universal binary on Mac OS/X, pass extra options. This
602 # is useful to people that want to link the LLVM libraries into their universal
605 # The following can be optionally specified:
606 # UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
607 # For Mac OS/X 10.4 Intel machines, the traditional one is:
608 # UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
609 # UNIVERSAL_ARCH can be optionally specified to be a list of architectures
610 # to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64". This defaults to
613 ifndef UNIVERSAL_ARCH
614 UNIVERSAL_ARCH := i386 ppc
616 UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
617 CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
618 ifdef UNIVERSAL_SDK_PATH
619 CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
622 # Building universal cannot compute dependencies automatically.
623 DISABLE_AUTO_DEPENDENCIES=1
625 ifeq ($(TARGET_OS),Darwin)
626 ifeq ($(ARCH),x86_64)
627 TargetCommonOpts = -m64
630 TargetCommonOpts = -m32
636 ifeq ($(HOST_OS),SunOS)
637 CPP.BaseFlags += -include llvm/Support/Solaris.h
640 ifeq ($(HOST_OS),AuroraUX)
641 CPP.BaseFlags += -include llvm/Support/Solaris.h
642 endif # !HOST_OS - AuroraUX.
644 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
645 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
646 # All -I flags should go here, so that they don't confuse llvm-config.
647 CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
648 $(patsubst %,-I%/include,\
649 $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
650 $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
653 # SHOW_DIAGNOSTICS support.
654 ifeq ($(SHOW_DIAGNOSTICS),1)
655 Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
656 CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
661 ifeq ($(BUILD_COMPONENT), 1)
662 Compile.C = $(Compile.Wrapper) \
663 $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
664 $(TargetCommonOpts) $(CompileCommonOpts) -c
665 Compile.CXX = $(Compile.Wrapper) \
666 $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
668 $(TargetCommonOpts) $(CompileCommonOpts) -c
669 Preprocess.CXX= $(Compile.Wrapper) \
670 $(BUILD_CXX) $(CPP.Flags) $(CPPFLAGS) $(TargetCommonOpts) \
671 $(CompileCommonOpts) $(CXX.Flags) -E
672 Link = $(Compile.Wrapper) \
673 $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
674 $(LD.Flags) $(LDFLAGS) \
675 $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
677 Compile.C = $(Compile.Wrapper) \
678 $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
679 $(TargetCommonOpts) $(CompileCommonOpts) -c
680 Compile.CXX = $(Compile.Wrapper) \
681 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
682 $(TargetCommonOpts) $(CompileCommonOpts) -c
683 Preprocess.CXX= $(Compile.Wrapper) \
684 $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
685 $(CompileCommonOpts) $(CXX.Flags) -E
686 Link = $(Compile.Wrapper) \
687 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
688 $(LDFLAGS) $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
691 BCCompile.C = $(LLVMCC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
692 $(TargetCommonOpts) $(CompileCommonOpts)
693 Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
694 $(TargetCommonOpts) $(CompileCommonOpts) -E
696 BCCompile.CXX = $(LLVMCXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
697 $(TargetCommonOpts) $(CompileCommonOpts)
699 ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
700 ScriptInstall = $(INSTALL) -m 0755
701 DataInstall = $(INSTALL) -m 0644
703 # When compiling under Mingw/Cygwin, the tblgen tool expects Windows
704 # paths. In this case, the SYSPATH function (defined in
705 # Makefile.config) transforms Unix paths into Windows paths.
706 TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
707 -I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
708 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
709 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
710 LLVMTableGen = $(LLVM_TBLGEN) $(TableGen.Flags)
712 Archive = $(AR) $(AR.Flags)
713 LArchive = $(LLVMToolDir)/llvm-ar rcsf
722 #----------------------------------------------------------
723 # Get the list of source files and compute object file
725 #----------------------------------------------------------
728 Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
729 $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
731 Sources := $(SOURCES)
735 Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
738 BaseNameSources := $(sort $(basename $(Sources)))
740 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
741 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
743 #----------------------------------------------------------
744 # For Mingw MSYS bash and Python/w32:
746 # $(ECHOPATH) prints DOSish pathstring.
747 # ex) $(ECHOPATH) /include/sys/types.h
748 # --> C:/mingw/include/sys/types.h
749 # built-in "echo" does not transform path to DOSish path.
751 # FIXME: It would not be needed when MSYS's python
753 #----------------------------------------------------------
755 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
756 ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])"
758 ECHOPATH := $(Verb)$(ECHO)
761 ###############################################################################
762 # DIRECTORIES: Handle recursive descent of directory structure
763 ###############################################################################
765 #---------------------------------------------------------
766 # Provide rules to make install dirs. This must be early
767 # in the file so they get built before dependencies
768 #---------------------------------------------------------
770 $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
773 # To create other directories, as needed, and timestamp their creation
775 $(Verb) $(MKDIR) $* > /dev/null
776 $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
778 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
779 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
781 #---------------------------------------------------------
782 # Handle the DIRS options for sequential construction
783 #---------------------------------------------------------
789 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
790 $(RecursiveTargets)::
791 $(Verb) for dir in $(DIRS); do \
792 if ([ ! -f $$dir/Makefile ] || \
793 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
795 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
797 ($(MAKE) -C $$dir $@ ) || exit 1; \
800 $(RecursiveTargets)::
801 $(Verb) for dir in $(DIRS); do \
802 ($(MAKE) -C $$dir $@ ) || exit 1; \
808 #---------------------------------------------------------
809 # Handle the EXPERIMENTAL_DIRS options ensuring success
810 # after each directory is built.
811 #---------------------------------------------------------
812 ifdef EXPERIMENTAL_DIRS
813 $(RecursiveTargets)::
814 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
815 if ([ ! -f $$dir/Makefile ] || \
816 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
818 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
820 ($(MAKE) -C $$dir $@ ) || exit 0; \
824 #-----------------------------------------------------------
825 # Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
826 #-----------------------------------------------------------
827 ifdef OPTIONAL_PARALLEL_DIRS
828 PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) && echo "$(T)"))
831 #-----------------------------------------------------------
832 # Handle the PARALLEL_DIRS options for parallel construction
833 #-----------------------------------------------------------
836 SubDirs += $(PARALLEL_DIRS)
838 # Unfortunately, this list must be maintained if new recursive targets are added
839 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
840 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
841 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
842 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
843 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
844 install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
845 unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS))
847 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
850 $(Verb) if ([ ! -f $(@D)/Makefile ] || \
851 command test $(@D)/Makefile -ot \
852 $(PROJ_SRC_DIR)/$(@D)/Makefile ); then \
854 $(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
856 $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
859 #---------------------------------------------------------
860 # Handle the OPTIONAL_DIRS options for directores that may
862 #---------------------------------------------------------
865 SubDirs += $(OPTIONAL_DIRS)
867 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
868 $(RecursiveTargets)::
869 $(Verb) for dir in $(OPTIONAL_DIRS); do \
870 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
871 if ([ ! -f $$dir/Makefile ] || \
872 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
874 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
876 ($(MAKE) -C$$dir $@ ) || exit 1; \
880 $(RecursiveTargets)::
881 $(Verb) for dir in $(OPTIONAL_DIRS); do \
882 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
883 ($(MAKE) -C$$dir $@ ) || exit 1; \
889 #---------------------------------------------------------
890 # Handle the CONFIG_FILES options
891 #---------------------------------------------------------
896 $(Echo) Install circumvented with NO_INSTALL
898 $(Echo) UnInstall circumvented with NO_INSTALL
900 install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
901 $(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir)
902 $(Verb)for file in $(CONFIG_FILES); do \
903 if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
904 $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
905 elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
906 $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
908 $(ECHO) Error: cannot find config file $${file}. ; \
913 $(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
914 $(Verb)for file in $(CONFIG_FILES); do \
915 $(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
921 ###############################################################################
922 # Set up variables for building libraries
923 ###############################################################################
925 #---------------------------------------------------------
926 # Define various command line options pertaining to the
927 # libraries needed when linking. There are "Proj" libs
928 # (defined by the user's project) and "LLVM" libs (defined
929 # by the LLVM project).
930 #---------------------------------------------------------
933 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
934 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
935 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
936 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
940 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
941 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
942 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
943 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
946 # Loadable module for Win32 requires all symbols resolved for linking.
947 # Then all symbols in LLVM.dll will be available.
948 ifeq ($(ENABLE_SHARED),1)
949 ifdef LOADABLE_MODULE
950 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
951 LINK_COMPONENTS += all
956 ifndef IS_CLEANING_TARGET
957 ifdef LINK_COMPONENTS
959 # If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make
960 # clean in tools, then do a make in tools (instead of at the top level).
962 @echo "*** llvm-config doesn't exist - rebuilding it."
963 @$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config
965 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
967 ifeq ($(ENABLE_SHARED), 1)
968 # We can take the "auto-import" feature to get rid of using dllimport.
969 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
970 LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
973 LLVMLibsOptions += -lLLVM-$(LLVMVersion)
974 LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT)
977 ifndef NO_LLVM_CONFIG
978 LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)
979 ifeq ($(LLVMConfigLibs),Error)
980 $(error llvm-config --libs failed)
982 LLVMLibsOptions += $(LLVMConfigLibs)
983 LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error)
984 ifeq ($(LLVMConfigLibfiles),Error)
985 $(error llvm-config --libfiles failed)
987 LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles)
994 # Set up the library exports file.
995 ifdef EXPORTED_SYMBOL_FILE
997 # First, set up the native export file, which may differ from the source
1000 ifeq ($(HOST_OS),Darwin)
1001 # Darwin convention prefixes symbols with underscores.
1002 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed
1003 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1004 $(Verb) sed -e 's/^/_/' < $< > $@
1006 -$(Verb) $(RM) -f $(NativeExportsFile)
1008 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1009 # Gold and BFD ld require a version script rather than a plain list.
1010 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
1011 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1012 $(Verb) echo "{" > $@
1013 $(Verb) grep -q "\<" $< && echo " global:" >> $@ || :
1014 $(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@
1015 ifneq ($(HOST_OS),OpenBSD)
1016 $(Verb) echo " local: *;" >> $@
1018 $(Verb) echo "};" >> $@
1020 -$(Verb) $(RM) -f $(NativeExportsFile)
1022 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1023 # GNU ld Win32 accepts .DEF files that contain "DATA" entries.
1024 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def))
1025 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1026 $(Echo) Generating $(notdir $@)
1027 $(Verb) $(ECHO) "EXPORTS" > $@
1028 $(Verb) $(CAT) $< >> $@
1030 -$(Verb) $(RM) -f $(NativeExportsFile)
1032 # Default behavior: just use the exports file verbatim.
1033 NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
1038 # Now add the linker command-line options to use the native export file.
1041 ifeq ($(HOST_OS),Darwin)
1042 LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
1045 # gold, bfd ld, etc.
1046 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1047 LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
1051 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1052 # LLVMLibsOptions is invalidated at processing tools/llvm-shlib.
1053 SharedLinkOptions += $(NativeExportsFile)
1058 ###############################################################################
1059 # Library Build Rules: Four ways to build a library
1060 ###############################################################################
1062 #---------------------------------------------------------
1063 # Bytecode Module Targets:
1064 # If the user set MODULE_NAME then they want to build a
1065 # bytecode module from the sources. We compile all the
1066 # sources and link it together into a single bytecode
1068 #---------------------------------------------------------
1071 ifeq ($(strip $(LLVMCC)),)
1072 $(warning Modules require LLVM capable compiler but none is available ****)
1075 Module := $(LibDir)/$(MODULE_NAME).bc
1076 LinkModule := $(LLVMLD) -r
1079 ifdef EXPORTED_SYMBOL_FILE
1080 LinkModule += -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1083 $(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(LLVMLD)
1084 $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
1085 $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
1087 all-local:: $(Module)
1090 ifneq ($(strip $(Module)),)
1091 -$(Verb) $(RM) -f $(Module)
1094 ifdef BYTECODE_DESTINATION
1095 ModuleDestDir := $(BYTECODE_DESTINATION)
1097 ModuleDestDir := $(DESTDIR)$(PROJ_libdir)
1102 $(Echo) Install circumvented with NO_INSTALL
1104 $(Echo) Uninstall circumvented with NO_INSTALL
1106 DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
1108 install-module:: $(DestModule)
1109 install-local:: $(DestModule)
1111 $(DestModule): $(ModuleDestDir) $(Module)
1112 $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
1113 $(Verb) $(DataInstall) $(Module) $(DestModule)
1116 $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
1117 -$(Verb) $(RM) -f $(DestModule)
1123 # if we're building a library ...
1126 # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option
1127 LIBRARYNAME := $(strip $(LIBRARYNAME))
1128 ifdef LOADABLE_MODULE
1129 BaseLibName.A := $(LIBRARYNAME).a
1130 BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT)
1132 BaseLibName.A := lib$(LIBRARYNAME).a
1133 BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
1135 LibName.A := $(LibDir)/$(BaseLibName.A)
1136 LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
1137 LibName.O := $(LibDir)/$(LIBRARYNAME).o
1138 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
1140 #---------------------------------------------------------
1141 # Shared Library Targets:
1142 # If the user asked for a shared library to be built
1143 # with the SHARED_LIBRARY variable, then we provide
1144 # targets for building them.
1145 #---------------------------------------------------------
1146 ifdef SHARED_LIBRARY
1148 all-local:: $(LibName.SO)
1150 ifdef EXPORTED_SYMBOL_FILE
1151 $(LibName.SO): $(NativeExportsFile)
1154 ifdef LINK_LIBS_IN_SHARED
1155 ifdef LOADABLE_MODULE
1156 SharedLibKindMessage := "Loadable Module"
1157 SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions)
1159 SharedLibKindMessage := "Shared Library"
1161 $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
1162 $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
1164 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
1165 $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
1167 $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
1168 $(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
1169 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
1173 ifneq ($(strip $(LibName.SO)),)
1174 -$(Verb) $(RM) -f $(LibName.SO)
1179 $(Echo) Install circumvented with NO_INSTALL
1181 $(Echo) Uninstall circumvented with NO_INSTALL
1184 # Win32.DLL prefers to be located on the "PATH" of binaries.
1185 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1186 DestSharedLibDir := $(DESTDIR)$(PROJ_bindir)
1188 DestSharedLibDir := $(DESTDIR)$(PROJ_libdir)
1190 DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
1192 install-local:: $(DestSharedLib)
1194 $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir)
1195 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
1196 $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
1199 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
1200 -$(Verb) $(RM) -f $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME).*
1204 #---------------------------------------------------------
1205 # Bytecode Library Targets:
1206 # If the user asked for a bytecode library to be built
1207 # with the BYTECODE_LIBRARY variable, then we provide
1208 # targets for building them.
1209 #---------------------------------------------------------
1210 ifdef BYTECODE_LIBRARY
1211 ifeq ($(strip $(LLVMCC)),)
1212 $(warning Bytecode libraries require LLVM capable compiler but none is available ****)
1215 all-local:: $(LibName.BCA)
1217 ifdef EXPORTED_SYMBOL_FILE
1218 BCLinkLib = $(LLVMLD) -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1220 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLD) \
1221 $(LLVMToolDir)/llvm-ar
1222 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
1224 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).internalize $(ObjectsBC)
1226 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).internalize.bc
1228 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
1229 $(LLVMToolDir)/llvm-ar
1230 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
1232 $(Verb) $(LArchive) $@ $(ObjectsBC)
1237 ifneq ($(strip $(LibName.BCA)),)
1238 -$(Verb) $(RM) -f $(LibName.BCA)
1241 ifdef BYTECODE_DESTINATION
1242 BytecodeDestDir := $(BYTECODE_DESTINATION)
1244 BytecodeDestDir := $(DESTDIR)$(PROJ_libdir)
1247 DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).bca
1249 install-bytecode-local:: $(DestBytecodeLib)
1253 $(Echo) Install circumvented with NO_INSTALL
1255 $(Echo) Uninstall circumvented with NO_INSTALL
1257 install-local:: $(DestBytecodeLib)
1259 $(DestBytecodeLib): $(LibName.BCA) $(BytecodeDestDir)
1260 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1261 $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
1264 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1265 -$(Verb) $(RM) -f $(DestBytecodeLib)
1270 #---------------------------------------------------------
1272 # If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
1273 # building an archive.
1274 #---------------------------------------------------------
1275 ifndef NO_BUILD_ARCHIVE
1276 ifndef BUILD_ARCHIVE
1277 ifndef LOADABLE_MODULE
1283 #---------------------------------------------------------
1284 # Archive Library Targets:
1285 # If the user wanted a regular archive library built,
1286 # then we provide targets for building them.
1287 #---------------------------------------------------------
1290 all-local:: $(LibName.A)
1292 $(LibName.A): $(ObjectsO) $(LibDir)/.dir
1293 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
1294 -$(Verb) $(RM) -f $@
1295 $(Verb) $(Archive) $@ $(ObjectsO)
1296 $(Verb) $(Ranlib) $@
1299 ifneq ($(strip $(LibName.A)),)
1300 -$(Verb) $(RM) -f $(LibName.A)
1305 $(Echo) Install circumvented with NO_INSTALL
1307 $(Echo) Uninstall circumvented with NO_INSTALL
1309 ifdef NO_INSTALL_ARCHIVES
1311 $(Echo) Install circumvented with NO_INSTALL
1313 $(Echo) Uninstall circumvented with NO_INSTALL
1315 DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a
1317 install-local:: $(DestArchiveLib)
1319 $(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
1320 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
1321 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
1322 $(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
1325 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
1326 -$(Verb) $(RM) -f $(DestArchiveLib)
1334 ###############################################################################
1335 # Tool Build Rules: Build executable tool based on TOOLNAME option
1336 ###############################################################################
1340 #---------------------------------------------------------
1341 # Set up variables for building a tool.
1342 #---------------------------------------------------------
1343 TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
1345 ToolBuildPath := $(ExmplDir)/$(TOOLEXENAME)
1347 ToolBuildPath := $(ToolDir)/$(TOOLEXENAME)
1350 # TOOLALIAS is a name to symlink (or copy) the tool to.
1353 ToolAliasBuildPath := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1355 ToolAliasBuildPath := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1359 #---------------------------------------------------------
1361 #---------------------------------------------------------
1363 # If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
1364 # not exporting all of the weak symbols from the binary. This reduces dyld
1365 # startup time by 4x on darwin in some cases.
1366 ifdef TOOL_NO_EXPORTS
1367 ifeq ($(HOST_OS),Darwin)
1369 # Tiger tools don't support this.
1370 ifneq ($(DARWIN_MAJVERS),4)
1371 LD.Flags += -Wl,-exported_symbol,_main
1375 ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD))
1376 ifneq ($(ARCH), Mips)
1377 LD.Flags += -Wl,--version-script=$(PROJ_SRC_ROOT)/autoconf/ExportMap.map
1382 #---------------------------------------------------------
1383 # Tool Order File Support
1384 #---------------------------------------------------------
1386 ifeq ($(HOST_OS),Darwin)
1387 ifdef TOOL_ORDER_FILE
1389 LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
1394 #---------------------------------------------------------
1395 # Tool Version Info Support
1396 #---------------------------------------------------------
1398 ifeq ($(HOST_OS),Darwin)
1399 ifdef TOOL_INFO_PLIST
1401 LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST)
1403 $(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST)
1405 $(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir
1406 $(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..."
1407 $(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \
1408 -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \
1409 -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \
1410 -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \
1416 #---------------------------------------------------------
1417 # Provide targets for building the tools
1418 #---------------------------------------------------------
1419 all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
1422 ifneq ($(strip $(ToolBuildPath)),)
1423 -$(Verb) $(RM) -f $(ToolBuildPath)
1425 ifneq ($(strip $(ToolAliasBuildPath)),)
1426 -$(Verb) $(RM) -f $(ToolAliasBuildPath)
1430 $(ToolBuildPath): $(ExmplDir)/.dir
1432 $(ToolBuildPath): $(ToolDir)/.dir
1435 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1436 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1437 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1438 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1439 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1442 ifneq ($(strip $(ToolAliasBuildPath)),)
1443 $(ToolAliasBuildPath): $(ToolBuildPath)
1444 $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
1445 $(Verb) $(RM) -f $(ToolAliasBuildPath)
1446 $(Verb) $(AliasTool) $(TOOLEXENAME) $(ToolAliasBuildPath)
1447 $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
1453 $(Echo) Install circumvented with NO_INSTALL
1455 $(Echo) Uninstall circumvented with NO_INSTALL
1457 DestTool = $(DESTDIR)$(PROJ_bindir)/$(program_prefix)$(TOOLEXENAME)
1459 install-local:: $(DestTool)
1461 $(DestTool): $(ToolBuildPath) $(DESTDIR)$(PROJ_bindir)
1462 $(Echo) Installing $(BuildMode) $(DestTool)
1463 $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
1466 $(Echo) Uninstalling $(BuildMode) $(DestTool)
1467 -$(Verb) $(RM) -f $(DestTool)
1469 # TOOLALIAS install.
1471 DestToolAlias = $(DESTDIR)$(PROJ_bindir)/$(program_prefix)$(TOOLALIAS)$(EXEEXT)
1473 install-local:: $(DestToolAlias)
1475 $(DestToolAlias): $(DestTool)
1476 $(Echo) Installing $(BuildMode) $(DestToolAlias)
1477 $(Verb) $(RM) -f $(DestToolAlias)
1478 $(Verb) $(AliasTool) $(TOOLEXENAME) $(DestToolAlias)
1481 $(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
1482 -$(Verb) $(RM) -f $(DestToolAlias)
1488 ###############################################################################
1489 # Object Build Rules: Build object files based on sources
1490 ###############################################################################
1492 # FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
1493 ifeq ($(HOST_OS),HP-UX)
1494 DISABLE_AUTO_DEPENDENCIES=1
1497 # Provide rule sets for when dependency generation is enabled
1498 ifndef DISABLE_AUTO_DEPENDENCIES
1500 #---------------------------------------------------------
1501 # Create .o files in the ObjDir directory from the .cpp and .c files...
1502 #---------------------------------------------------------
1504 DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
1505 -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
1507 # If the build succeeded, move the dependency file over, otherwise
1509 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
1510 else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
1512 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1513 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1514 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1517 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1518 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1519 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1522 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1523 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1524 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1527 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1528 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1529 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1532 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1533 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1534 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1537 #---------------------------------------------------------
1538 # Create .bc files in the ObjDir directory from .cpp .cc and .c files...
1539 #---------------------------------------------------------
1541 BC_DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.bc.d.tmp" \
1542 -MT "$(ObjDir)/$*.ll" -MT "$(ObjDir)/$*.bc.d"
1544 # If the build succeeded, move the dependency file over, otherwise
1546 BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d"; \
1547 else $(RM) "$(ObjDir)/$*.bc.d.tmp"; exit 1; fi
1549 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1550 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1551 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1552 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1553 $(BC_DEPEND_MOVEFILE)
1555 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1556 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1557 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1558 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1559 $(BC_DEPEND_MOVEFILE)
1561 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1562 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1563 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1564 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1565 $(BC_DEPEND_MOVEFILE)
1567 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1568 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1569 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1570 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1571 $(BC_DEPEND_MOVEFILE)
1573 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1574 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1575 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1576 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1577 $(BC_DEPEND_MOVEFILE)
1579 # Provide alternate rule sets if dependencies are disabled
1582 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1583 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1584 $(Compile.CXX) $< -o $@
1586 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1587 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1588 $(Compile.CXX) $< -o $@
1590 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1591 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1592 $(Compile.CXX) $< -o $@
1594 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1595 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1596 $(Compile.C) $< -o $@
1598 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1599 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1600 $(Compile.C) $< -o $@
1602 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1603 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1604 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1606 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1607 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1608 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1610 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1611 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1612 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1614 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1615 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1616 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1618 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1619 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1620 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1625 ## Rules for building preprocessed (.i/.ii) outputs.
1626 $(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1627 $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
1628 $(Verb) $(Preprocess.CXX) $< -o $@
1630 $(BuildMode)/%.ii: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1631 $(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file"
1632 $(Verb) $(Preprocess.CXX) $< -o $@
1634 $(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1635 $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
1636 $(Verb) $(Preprocess.CXX) $< -o $@
1638 $(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1639 $(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
1640 $(Verb) $(Preprocess.C) $< -o $@
1642 $(BuildMode)/%.i: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1643 $(Echo) "Compiling $*.m for $(BuildMode) build to .i file"
1644 $(Verb) $(Preprocess.C) $< -o $@
1647 $(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1648 $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
1649 $(Compile.CXX) $< -o $@ -S
1651 $(ObjDir)/%.s: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1652 $(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG)
1653 $(Compile.CXX) $< -o $@ -S
1655 $(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1656 $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
1657 $(Compile.CXX) $< -o $@ -S
1659 $(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1660 $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
1661 $(Compile.C) $< -o $@ -S
1663 $(ObjDir)/%.s: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1664 $(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG)
1665 $(Compile.C) $< -o $@ -S
1668 # make the C and C++ compilers strip debug info out of bytecode libraries.
1670 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1671 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1672 $(Verb) $(LOPT) $< -std-compile-opts -o $@
1674 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1675 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1676 $(Verb) $(LOPT) $< -std-compile-opts -strip-debug -o $@
1680 #---------------------------------------------------------
1681 # Provide rule to build .bc files from .ll sources,
1682 # regardless of dependencies
1683 #---------------------------------------------------------
1684 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
1685 $(Echo) "Compiling $*.ll for $(BuildMode) build"
1686 $(Verb) $(LLVMAS) $< -f -o $@
1688 ###############################################################################
1689 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
1690 ###############################################################################
1693 TABLEGEN_INC_FILES_COMMON = 1
1696 ifdef TABLEGEN_INC_FILES_COMMON
1698 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
1699 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1700 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
1702 # INCFiles rule: All of the tblgen generated files are emitted to
1703 # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
1704 # us to only "touch" the real file if the contents of it change. IOW, if
1705 # tblgen is modified, all of the .inc.tmp files are regenerated, but no
1706 # dependencies of the .inc files are, unless the contents of the .inc file
1708 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
1709 $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
1711 endif # TABLEGEN_INC_FILES_COMMON
1715 TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
1716 $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \
1717 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \
1718 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \
1719 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \
1720 $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
1721 $(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td)
1723 # All .inc.tmp files depend on the .td files.
1724 $(INCTMPFiles) : $(TDFiles)
1726 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1727 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1728 $(Echo) "Building $(<F) register info implementation with tblgen"
1729 $(Verb) $(LLVMTableGen) -gen-register-info -o $(call SYSPATH, $@) $<
1731 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1732 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1733 $(Echo) "Building $(<F) instruction information with tblgen"
1734 $(Verb) $(LLVMTableGen) -gen-instr-info -o $(call SYSPATH, $@) $<
1736 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1737 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1738 $(Echo) "Building $(<F) assembly writer with tblgen"
1739 $(Verb) $(LLVMTableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
1741 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1742 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1743 $(Echo) "Building $(<F) assembly writer #1 with tblgen"
1744 $(Verb) $(LLVMTableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
1746 $(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
1747 $(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1748 $(Echo) "Building $(<F) assembly matcher with tblgen"
1749 $(Verb) $(LLVMTableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
1751 $(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \
1752 $(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1753 $(Echo) "Building $(<F) MC code emitter with tblgen"
1754 $(Verb) $(LLVMTableGen) -gen-emitter -mc-emitter -o $(call SYSPATH, $@) $<
1756 $(TARGET:%=$(ObjDir)/%GenMCPseudoLowering.inc.tmp): \
1757 $(ObjDir)/%GenMCPseudoLowering.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1758 $(Echo) "Building $(<F) MC Pseudo instruction expander with tblgen"
1759 $(Verb) $(LLVMTableGen) -gen-pseudo-lowering -o $(call SYSPATH, $@) $<
1761 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1762 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1763 $(Echo) "Building $(<F) code emitter with tblgen"
1764 $(Verb) $(LLVMTableGen) -gen-emitter -o $(call SYSPATH, $@) $<
1766 $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
1767 $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1768 $(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
1769 $(Verb) $(LLVMTableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
1771 $(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \
1772 $(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1773 $(Echo) "Building $(<F) disassembly tables with tblgen"
1774 $(Verb) $(LLVMTableGen) -gen-disassembler -o $(call SYSPATH, $@) $<
1776 $(TARGET:%=$(ObjDir)/%GenEDInfo.inc.tmp): \
1777 $(ObjDir)/%GenEDInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1778 $(Echo) "Building $(<F) enhanced disassembly information with tblgen"
1779 $(Verb) $(LLVMTableGen) -gen-enhanced-disassembly-info -o $(call SYSPATH, $@) $<
1781 $(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
1782 $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1783 $(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
1784 $(Verb) $(LLVMTableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
1786 $(TARGET:%=$(ObjDir)/%GenSubtargetInfo.inc.tmp): \
1787 $(ObjDir)/%GenSubtargetInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1788 $(Echo) "Building $(<F) subtarget information with tblgen"
1789 $(Verb) $(LLVMTableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
1791 $(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
1792 $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1793 $(Echo) "Building $(<F) calling convention information with tblgen"
1794 $(Verb) $(LLVMTableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
1796 $(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
1797 $(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1798 $(Echo) "Building $(<F) intrinsics information with tblgen"
1799 $(Verb) $(LLVMTableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
1801 $(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1802 $(Echo) "Building $(<F) decoder tables with tblgen"
1803 $(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $<
1807 -$(Verb) $(RM) -f $(INCFiles)
1811 ###############################################################################
1812 # OTHER RULES: Other rules needed
1813 ###############################################################################
1815 # To create postscript files from dot files...
1816 ifneq ($(DOT),false)
1818 $(DOT) -Tps < $< > $@
1821 $(Echo) "Cannot build $@: The program dot is not installed"
1824 # This rules ensures that header files that are removed still have a rule for
1825 # which they can be "generated." This allows make to ignore them and
1826 # reproduce the dependency lists.
1830 # Define clean-local to clean the current directory. Note that this uses a
1831 # very conservative approach ensuring that empty variables do not cause
1832 # errors or disastrous removal.
1834 ifneq ($(strip $(ObjRootDir)),)
1835 -$(Verb) $(RM) -rf $(ObjRootDir)
1837 -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
1838 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1839 -$(Verb) $(RM) -f *$(SHLIBEXT)
1843 -$(Verb) $(RM) -rf Debug Release Profile
1846 ###############################################################################
1847 # DEPENDENCIES: Include the dependency files if we should
1848 ###############################################################################
1849 ifndef DISABLE_AUTO_DEPENDENCIES
1851 # If its not one of the cleaning targets
1852 ifndef IS_CLEANING_TARGET
1854 # Get the list of dependency files
1855 DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources)))
1856 DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
1858 # Include bitcode dependency files if using bitcode libraries
1859 ifdef BYTECODE_LIBRARY
1860 DependFiles += $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.bc.d)
1863 -include $(DependFiles) ""
1869 ###############################################################################
1870 # CHECK: Running the test suite
1871 ###############################################################################
1874 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1875 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1876 $(EchoCmd) Running test suite ; \
1877 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
1878 TESTSUITE=$(TESTSUITE) ; \
1880 $(EchoCmd) No Makefile in test directory ; \
1883 $(EchoCmd) No test directory ; \
1886 # An alias dating from when both lit and DejaGNU test runners were used.
1890 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1891 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1892 $(EchoCmd) Running test suite ; \
1893 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \
1895 $(EchoCmd) No Makefile in test directory ; \
1898 $(EchoCmd) No test directory ; \
1901 ###############################################################################
1902 # UNITTESTS: Running the unittests test suite
1903 ###############################################################################
1906 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
1907 if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
1908 $(EchoCmd) Running unittests test suite ; \
1909 $(MAKE) -C $(PROJ_OBJ_ROOT)/unittests unitcheck; \
1911 $(EchoCmd) No Makefile in unittests directory ; \
1914 $(EchoCmd) No unittests directory ; \
1917 ###############################################################################
1918 # DISTRIBUTION: Handle construction of a distribution tarball
1919 ###############################################################################
1921 #------------------------------------------------------------------------
1922 # Define distribution related variables
1923 #------------------------------------------------------------------------
1924 DistName := $(PROJECT_NAME)-$(PROJ_VERSION)
1925 DistDir := $(PROJ_OBJ_ROOT)/$(DistName)
1926 TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName)
1927 DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
1928 DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip
1929 DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
1930 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1931 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1932 Makefile.config.in configure autoconf
1933 DistOther := $(notdir $(wildcard \
1934 $(PROJ_SRC_DIR)/*.h \
1935 $(PROJ_SRC_DIR)/*.td \
1936 $(PROJ_SRC_DIR)/*.def \
1937 $(PROJ_SRC_DIR)/*.ll \
1938 $(PROJ_SRC_DIR)/*.in))
1939 DistSubDirs := $(SubDirs)
1940 DistSources = $(Sources) $(EXTRA_DIST)
1941 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
1943 #------------------------------------------------------------------------
1944 # We MUST build distribution with OBJ_DIR != SRC_DIR
1945 #------------------------------------------------------------------------
1946 ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
1947 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1948 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1952 #------------------------------------------------------------------------
1953 # Prevent attempt to run dist targets from anywhere but the top level
1954 #------------------------------------------------------------------------
1956 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1957 $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
1960 #------------------------------------------------------------------------
1961 # Provide the top level targets
1962 #------------------------------------------------------------------------
1964 dist-gzip:: $(DistTarGZip)
1966 $(DistTarGZip) : $(TopDistDir)/.makedistdir
1967 $(Echo) Packing gzipped distribution tar file.
1968 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1969 $(GZIP) -c > "$(DistTarGZip)"
1971 dist-bzip2:: $(DistTarBZ2)
1973 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
1974 $(Echo) Packing bzipped distribution tar file.
1975 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1976 $(BZIP2) -c >$(DistTarBZ2)
1978 dist-zip:: $(DistZip)
1980 $(DistZip) : $(TopDistDir)/.makedistdir
1981 $(Echo) Packing zipped distribution file.
1982 $(Verb) rm -f $(DistZip)
1983 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1985 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
1986 $(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL =====
1988 DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
1990 dist-check:: $(DistTarGZip)
1991 $(Echo) Checking distribution tar file.
1992 $(Verb) if test -d $(DistCheckDir) ; then \
1993 $(RM) -rf $(DistCheckDir) ; \
1995 $(Verb) $(MKDIR) $(DistCheckDir)
1996 $(Verb) cd $(DistCheckDir) && \
1997 $(MKDIR) $(DistCheckDir)/build && \
1998 $(MKDIR) $(DistCheckDir)/install && \
1999 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
2001 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
2002 --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
2005 $(MAKE) unittests && \
2006 $(MAKE) install && \
2007 $(MAKE) uninstall && \
2008 $(MAKE) dist-clean && \
2009 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
2012 $(Echo) Cleaning distribution files
2013 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
2018 #------------------------------------------------------------------------
2019 # Provide the recursive distdir target for building the distribution directory
2020 #------------------------------------------------------------------------
2021 distdir: $(DistDir)/.makedistdir
2022 $(DistDir)/.makedistdir: $(DistSources)
2023 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2024 if test -d "$(DistDir)" ; then \
2025 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
2028 $(EchoCmd) Removing old $(DistDir) ; \
2029 $(RM) -rf $(DistDir); \
2030 $(EchoCmd) Making 'all' to verify build ; \
2031 $(MAKE) ENABLE_OPTIMIZED=1 all ; \
2033 $(Echo) Building Distribution Directory $(DistDir)
2034 $(Verb) $(MKDIR) $(DistDir)
2035 $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
2036 srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
2037 for file in $(DistFiles) ; do \
2039 $(PROJ_SRC_DIR)/*) \
2040 file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
2042 $(PROJ_SRC_ROOT)/*) \
2043 file=`echo "$$file" | \
2044 sed "s#^$$srcrootstrip/##"` \
2047 if test -f "$(PROJ_SRC_DIR)/$$file" || \
2048 test -d "$(PROJ_SRC_DIR)/$$file" ; then \
2049 from_dir="$(PROJ_SRC_DIR)" ; \
2050 elif test -f "$$file" || test -d "$$file" ; then \
2053 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
2054 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
2055 to_dir="$(DistDir)/$$dir"; \
2056 $(MKDIR) "$$to_dir" ; \
2058 to_dir="$(DistDir)"; \
2060 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
2061 if test -n "$$mid_dir" ; then \
2062 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
2064 if test -d "$$from_dir/$$file"; then \
2065 if test -d "$(PROJ_SRC_DIR)/$$file" && \
2066 test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
2067 cd $(PROJ_SRC_DIR) ; \
2068 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2069 ( cd $$to_dir ; $(TAR) xf - ) ; \
2070 cd $(PROJ_OBJ_DIR) ; \
2073 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2074 ( cd $$to_dir ; $(TAR) xf - ) ; \
2075 cd $(PROJ_OBJ_DIR) ; \
2077 elif test -f "$$from_dir/$$file" ; then \
2078 $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
2079 elif test -L "$$from_dir/$$file" ; then \
2080 $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
2081 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
2082 $(EchoCmd) "===== WARNING: Distribution Source " \
2083 "$$from_dir/$$file Not Found!" ; \
2084 elif test "$(Verb)" != '@' ; then \
2085 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
2088 $(Verb) for subdir in $(DistSubDirs) ; do \
2089 if test "$$subdir" \!= "." ; then \
2090 new_distdir="$(DistDir)/$$subdir" ; \
2091 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
2092 ( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
2093 DistDir="$$new_distdir" distdir ) || exit 1; \
2096 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2097 $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
2098 $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
2099 -name .svn \) -print` ;\
2100 $(MAKE) dist-hook ; \
2101 $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
2102 -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
2103 -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
2104 -o ! -type d ! -perm -444 -exec \
2105 $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
2106 || chmod -R a+r $(DistDir) ; \
2109 # This is invoked by distdir target, define it as a no-op to avoid errors if not
2115 ###############################################################################
2116 # TOP LEVEL - targets only to apply at the top level directory
2117 ###############################################################################
2121 #------------------------------------------------------------------------
2122 # Install support for the project's include files:
2123 #------------------------------------------------------------------------
2126 $(Echo) Install circumvented with NO_INSTALL
2128 $(Echo) Uninstall circumvented with NO_INSTALL
2131 $(Echo) Installing include files
2132 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
2133 $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
2134 cd $(PROJ_SRC_ROOT)/include && \
2135 for hdr in `find . -type f \
2136 '(' -name LICENSE.TXT \
2141 ')' -print | grep -v CVS | \
2142 grep -v .svn` ; do \
2143 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2144 if test \! -d "$$instdir" ; then \
2145 $(EchoCmd) Making install directory $$instdir ; \
2146 $(MKDIR) $$instdir ;\
2148 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2151 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
2152 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
2153 cd $(PROJ_OBJ_ROOT)/include && \
2154 for hdr in `find . -type f \
2155 '(' -name LICENSE.TXT \
2160 ')' -print | grep -v CVS | \
2161 grep -v .svn` ; do \
2162 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2163 if test \! -d "$$instdir" ; then \
2164 $(EchoCmd) Making install directory $$instdir ; \
2165 $(MKDIR) $$instdir ;\
2167 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2173 $(Echo) Uninstalling include files
2174 $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
2175 cd $(PROJ_SRC_ROOT)/include && \
2176 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
2177 '!' '(' -name '*~' -o -name '.#*' \
2178 -o -name '*.in' ')' -print ')' | \
2179 grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2180 cd $(PROJ_SRC_ROOT)/include && \
2181 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
2182 -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2188 @echo searching for overlength lines in files: $(Sources)
2191 egrep -n '.{81}' $(Sources) /dev/null
2194 @echo searching for tabs in files: $(Sources)
2197 egrep -n ' ' $(Sources) /dev/null
2200 @ls -l $(LibDir) | awk '\
2201 BEGIN { sum = 0; } \
2203 END { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2204 @ls -l $(ToolDir) | awk '\
2205 BEGIN { sum = 0; } \
2207 END { printf("Programs: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2208 #------------------------------------------------------------------------
2209 # Print out the directories used for building
2210 #------------------------------------------------------------------------
2212 $(Echo) "BuildMode : " '$(BuildMode)'
2213 $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
2214 $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
2215 $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
2216 $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
2217 $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
2218 $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
2219 $(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
2220 $(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
2221 $(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
2222 $(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
2223 $(Echo) "PROJ_includedir : " '$(PROJ_includedir)'
2224 $(Echo) "UserTargets : " '$(UserTargets)'
2225 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
2226 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
2227 $(Echo) "ObjDir : " '$(ObjDir)'
2228 $(Echo) "LibDir : " '$(LibDir)'
2229 $(Echo) "ToolDir : " '$(ToolDir)'
2230 $(Echo) "ExmplDir : " '$(ExmplDir)'
2231 $(Echo) "Sources : " '$(Sources)'
2232 $(Echo) "TDFiles : " '$(TDFiles)'
2233 $(Echo) "INCFiles : " '$(INCFiles)'
2234 $(Echo) "INCTMPFiles : " '$(INCTMPFiles)'
2235 $(Echo) "PreConditions: " '$(PreConditions)'
2236 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
2237 $(Echo) "Compile.C : " '$(Compile.C)'
2238 $(Echo) "Archive : " '$(Archive)'
2239 $(Echo) "YaccFiles : " '$(YaccFiles)'
2240 $(Echo) "LexFiles : " '$(LexFiles)'
2241 $(Echo) "Module : " '$(Module)'
2242 $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
2243 $(Echo) "SubDirs : " '$(SubDirs)'
2244 $(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
2245 $(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
2250 # General debugging rule, use 'make dbg-print-XXX' to print the
2251 # definition, value and origin of XXX.
2253 $(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))