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_CXX11),1)
321 CXX.Flags += -std=c++11
324 ifeq ($(ENABLE_WERROR),1)
329 ifeq ($(ENABLE_PROFILING),1)
330 BuildMode := $(BuildMode)+Profile
331 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
332 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) -pg -g
333 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg -g
337 ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
338 CXX.Flags += -fvisibility-inlines-hidden
341 ifdef ENABLE_EXPENSIVE_CHECKS
342 # GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above.
343 # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40160
347 # IF REQUIRES_EH=1 is specified then don't disable exceptions
349 CXX.Flags += -fno-exceptions
351 # If the library requires EH, it also requires RTTI.
355 ifdef REQUIRES_FRAME_POINTER
356 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags))
357 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags))
358 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags))
361 # If REQUIRES_RTTI=1 is specified then don't disable run-time type id.
362 ifneq ($(REQUIRES_RTTI), 1)
363 CXX.Flags += -fno-rtti
366 ifeq ($(ENABLE_COVERAGE),1)
367 BuildMode := $(BuildMode)+Coverage
368 CXX.Flags += -ftest-coverage -fprofile-arcs
369 C.Flags += -ftest-coverage -fprofile-arcs
372 # If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
373 # then disable assertions by defining the appropriate preprocessor symbols.
374 ifeq ($(DISABLE_ASSERTIONS),1)
375 CPP.Defines += -DNDEBUG
377 BuildMode := $(BuildMode)+Asserts
378 CPP.Defines += -D_DEBUG
381 # If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
382 # configured), then enable expensive checks by defining the
383 # appropriate preprocessor symbols.
384 ifeq ($(ENABLE_EXPENSIVE_CHECKS),1)
385 BuildMode := $(BuildMode)+Checks
386 CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
389 # LOADABLE_MODULE implies several other things so we force them to be
391 ifdef LOADABLE_MODULE
393 LINK_LIBS_IN_SHARED := 1
401 ifeq ($(ENABLE_PIC),1)
402 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
403 # Nothing. Win32 defaults to PIC and warns when given -fPIC
405 ifeq ($(HOST_OS),Darwin)
406 # Common symbols not allowed in dylib files
407 CXX.Flags += -fno-common
408 C.Flags += -fno-common
410 # Linux and others; pass -fPIC
416 ifeq ($(HOST_OS),Darwin)
417 CXX.Flags += -mdynamic-no-pic
418 C.Flags += -mdynamic-no-pic
422 # Support makefile variable to disable any kind of timestamp/non-deterministic
423 # info from being used in the build.
424 ifeq ($(ENABLE_TIMESTAMPS),1)
425 DOTDIR_TIMESTAMP_COMMAND := $(DATE)
427 DOTDIR_TIMESTAMP_COMMAND := echo 'Created.'
430 ifeq ($(HOST_OS),MingW)
432 CPP.Defines += -D__NO_CTYPE_INLINE
433 ifeq ($(LLVM_CROSS_COMPILING),1)
434 # Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016
436 LD.Flags += -Wl,--allow-multiple-definition
441 CXX.Flags += -Woverloaded-virtual
442 CPP.BaseFlags += $(CPP.Defines)
445 # Make Floating point IEEE compliant on Alpha.
448 CPP.BaseFlags += -mieee
449 ifeq ($(ENABLE_PIC),0)
451 CPP.BaseFlags += -fPIC
454 LD.Flags += -Wl,--no-relax
457 # GNU ld/PECOFF accepts but ignores them below;
461 # FIXME: autoconf should be aware of them.
462 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
463 HAVE_LINK_VERSION_SCRIPT := 0
465 RDYNAMIC := -Wl,--export-all-symbols
468 #--------------------------------------------------------------------
469 # Directory locations
470 #--------------------------------------------------------------------
472 ifeq ($(LLVM_CROSS_COMPILING),1)
473 BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin
476 ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode)
477 ObjDir := $(ObjRootDir)
478 LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
479 ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
480 ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
481 LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
482 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
483 LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
485 #--------------------------------------------------------------------
486 # Locations of shared libraries
487 #--------------------------------------------------------------------
490 SharedLibDir := $(LibDir)
491 LLVMSharedLibDir := $(LLVMLibDir)
493 # Win32.DLL prefers to be located on the "PATH" of binaries.
494 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
495 SharedLibDir := $(ToolDir)
496 LLVMSharedLibDir := $(LLVMToolDir)
498 ifeq ($(HOST_OS),Cygwin)
505 #--------------------------------------------------------------------
506 # LLVM Capable Compiler
507 #--------------------------------------------------------------------
509 ifneq ($(findstring llvm-gcc,$(LLVMCC_OPTION)),)
511 LLVMCXX := $(LLVMGXX)
513 ifneq ($(findstring clang,$(LLVMCC_OPTION)),)
514 ifneq ($(CLANGPATH),)
515 LLVMCC := $(CLANGPATH)
516 LLVMCXX := $(CLANGXXPATH)
518 ifeq ($(ENABLE_BUILT_CLANG),1)
519 LLVMCC := $(LLVMToolDir)/clang
520 LLVMCXX := $(LLVMToolDir)/clang++
526 #--------------------------------------------------------------------
527 # Full Paths To Compiled Tools and Utilities
528 #--------------------------------------------------------------------
529 EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
530 ifdef BUILD_DIRS_ONLY
531 EchoCmd := $(EchoCmd) "(build tools)":
536 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
539 ifeq ($(LLVM_CROSS_COMPILING),1)
540 LLVM_TBLGEN := $(BuildLLVMToolDir)/llvm-tblgen$(BUILD_EXEEXT)
542 LLVM_TBLGEN := $(LLVMToolDir)/llvm-tblgen$(EXEEXT)
545 ifeq ($(LLVM_CROSS_COMPILING),1)
546 LLVM_CONFIG := $(BuildLLVMToolDir)/llvm-config$(BUILD_EXEEXT)
548 LLVM_CONFIG := $(LLVMToolDir)/llvm-config$(EXEEXT)
551 LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
554 LLI := $(LLVMToolDir)/lli$(EXEEXT)
557 LLC := $(LLVMToolDir)/llc$(EXEEXT)
560 LOPT := $(LLVMToolDir)/opt$(EXEEXT)
563 LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
566 LLVMLINK := $(LLVMToolDir)/llvm-link$(EXEEXT)
569 #--------------------------------------------------------------------
570 # Adjust to user's request
571 #--------------------------------------------------------------------
573 ifeq ($(HOST_OS),Darwin)
574 ifdef MACOSX_DEPLOYMENT_TARGET
575 DARWIN_VERSION := $(MACOSX_DEPLOYMENT_TARGET)
577 DARWIN_VERSION := `sw_vers -productVersion`
579 # Strip a number like 10.4.7 to 10.4
580 DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/')
581 # Get "4" out of 10.4 for later pieces in the makefile.
582 DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
584 LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress
585 SharedLinkOptions := -dynamiclib
587 SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
590 SharedLinkOptions=-shared
593 ifeq ($(TARGET_OS),Darwin)
595 TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
600 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
601 ifneq ($(HOST_OS),Darwin)
602 LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
614 # Adjust settings for verbose mode
617 AR.Flags += >/dev/null 2>/dev/null
618 ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
620 ConfigureScriptFLAGS :=
623 # By default, strip symbol information from executable
625 Strip := $(PLATFORMSTRIPOPTS)
626 StripWarnMsg := "(without symbols)"
627 Install.StripFlag += -s
630 ifdef TOOL_NO_EXPORTS
633 DynamicFlag := $(RDYNAMIC)
636 # Adjust linker flags for building an executable
637 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
638 ifneq ($(HOST_OS), Darwin)
640 LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
642 LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
644 LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
648 ifneq ($(DARWIN_MAJVERS),4)
649 LD.Flags += $(RPATH) -Wl,@executable_path/../lib
651 ifeq ($(RC_BUILDIT),YES)
652 TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX)
653 LD.Flags += -Wl,-object_path_lto -Wl,$(TempFile)
659 #----------------------------------------------------------
660 # Options To Invoke Tools
661 #----------------------------------------------------------
663 ifdef EXTRA_LD_OPTIONS
664 LD.Flags += $(EXTRA_LD_OPTIONS)
668 CompileCommonOpts += -pedantic -Wno-long-long
670 CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
671 $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT) \
672 $(NO_UNINITIALIZED) $(NO_MAYBE_UNINITIALIZED) \
673 $(NO_MISSING_FIELD_INITIALIZERS)
674 # Enable cast-qual for C++; the workaround is to use const_cast.
675 CXX.Flags += -Wcast-qual
677 ifeq ($(HOST_OS),HP-UX)
678 CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
681 # If we are building a universal binary on Mac OS/X, pass extra options. This
682 # is useful to people that want to link the LLVM libraries into their universal
685 # The following can be optionally specified:
686 # UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
687 # For Mac OS/X 10.4 Intel machines, the traditional one is:
688 # UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
689 # UNIVERSAL_ARCH can be optionally specified to be a list of architectures
690 # to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64". This defaults to
693 ifndef UNIVERSAL_ARCH
694 UNIVERSAL_ARCH := i386 ppc
696 UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
697 CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
698 ifdef UNIVERSAL_SDK_PATH
699 CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
702 # Building universal cannot compute dependencies automatically.
703 DISABLE_AUTO_DEPENDENCIES=1
705 ifeq ($(TARGET_OS),Darwin)
706 ifeq ($(ARCH),x86_64)
707 TargetCommonOpts = -m64
710 TargetCommonOpts = -m32
716 ifeq ($(HOST_OS),SunOS)
717 CPP.BaseFlags += -include llvm/Support/Solaris.h
720 ifeq ($(HOST_OS),AuroraUX)
721 CPP.BaseFlags += -include llvm/Support/Solaris.h
722 endif # !HOST_OS - AuroraUX.
724 # On Windows, SharedLibDir != LibDir. The order is important.
725 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
726 LD.Flags += -L$(SharedLibDir) -L$(LibDir) -L$(LLVMToolDir) -L$(LLVMLibDir)
728 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
731 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
732 # All -I flags should go here, so that they don't confuse llvm-config.
733 CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
734 $(patsubst %,-I%/include,\
735 $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
736 $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
739 ifeq ($(INCLUDE_BUILD_DIR),1)
740 CPP.Flags += -I$(ObjDir)
743 # SHOW_DIAGNOSTICS support.
744 ifeq ($(SHOW_DIAGNOSTICS),1)
745 Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
746 CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
751 Compile.C = $(Compile.Wrapper) \
752 $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
753 $(TargetCommonOpts) $(CompileCommonOpts) -c
754 Compile.CXX = $(Compile.Wrapper) \
755 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
756 $(TargetCommonOpts) $(CompileCommonOpts) -c
757 Preprocess.CXX= $(Compile.Wrapper) \
758 $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
759 $(CompileCommonOpts) $(CXX.Flags) -E
760 Link = $(Compile.Wrapper) \
761 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
762 $(LDFLAGS) $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
764 BCCompile.C = $(LLVMCC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
765 $(TargetCommonOpts) $(CompileCommonOpts)
766 Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
767 $(TargetCommonOpts) $(CompileCommonOpts) -E
769 BCCompile.CXX = $(LLVMCXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
770 $(TargetCommonOpts) $(CompileCommonOpts)
772 ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
773 ScriptInstall = $(INSTALL) -m 0755
774 DataInstall = $(INSTALL) -m 0644
776 # When compiling under Mingw/Cygwin, the tblgen tool expects Windows
777 # paths. In this case, the SYSPATH function (defined in
778 # Makefile.config) transforms Unix paths into Windows paths.
779 TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
780 -I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
781 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
782 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
783 LLVMTableGen = $(LLVM_TBLGEN) $(TableGen.Flags)
785 Archive = $(AR) $(AR.Flags)
786 LArchive = $(LLVMToolDir)/llvm-ar rcsf
795 #----------------------------------------------------------
796 # Get the list of source files and compute object file
798 #----------------------------------------------------------
801 Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
802 $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
804 Sources := $(SOURCES)
808 Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
811 BaseNameSources := $(sort $(basename $(Sources)))
813 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
814 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
816 #----------------------------------------------------------
817 # For Mingw MSYS bash and Python/w32:
819 # $(ECHOPATH) prints DOSish pathstring.
820 # ex) $(ECHOPATH) /include/sys/types.h
821 # --> C:/mingw/include/sys/types.h
822 # built-in "echo" does not transform path to DOSish path.
824 # FIXME: It would not be needed when MSYS's python
826 #----------------------------------------------------------
828 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
829 ECHOPATH := $(Verb)python -u -c "import sys;print ' '.join(sys.argv[1:])"
831 ECHOPATH := $(Verb)$(ECHO)
834 ###############################################################################
835 # DIRECTORIES: Handle recursive descent of directory structure
836 ###############################################################################
838 #---------------------------------------------------------
839 # Provide rules to make install dirs. This must be early
840 # in the file so they get built before dependencies
841 #---------------------------------------------------------
843 $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
846 # To create other directories, as needed, and timestamp their creation
848 $(Verb) $(MKDIR) $* > /dev/null
849 $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
851 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
852 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
854 #---------------------------------------------------------
855 # Handle the DIRS options for sequential construction
856 #---------------------------------------------------------
862 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
863 $(RecursiveTargets)::
864 $(Verb) for dir in $(DIRS); do \
865 if ([ ! -f $$dir/Makefile ] || \
866 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
868 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
870 ($(MAKE) -C $$dir $@ ) || exit 1; \
873 $(RecursiveTargets)::
874 $(Verb) for dir in $(DIRS); do \
875 ($(MAKE) -C $$dir $@ ) || exit 1; \
881 #---------------------------------------------------------
882 # Handle the EXPERIMENTAL_DIRS options ensuring success
883 # after each directory is built.
884 #---------------------------------------------------------
885 ifdef EXPERIMENTAL_DIRS
886 $(RecursiveTargets)::
887 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
888 if ([ ! -f $$dir/Makefile ] || \
889 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
891 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
893 ($(MAKE) -C $$dir $@ ) || exit 0; \
897 #-----------------------------------------------------------
898 # Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
899 #-----------------------------------------------------------
900 ifdef OPTIONAL_PARALLEL_DIRS
901 PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) -o -f $(T)/Makefile && echo "$(T)"))
904 #-----------------------------------------------------------
905 # Handle the PARALLEL_DIRS options for parallel construction
906 #-----------------------------------------------------------
909 SubDirs += $(PARALLEL_DIRS)
911 # Unfortunately, this list must be maintained if new recursive targets are added
912 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
913 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
914 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
915 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
916 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
917 install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
918 unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS))
920 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
924 SD=$(PROJ_SRC_DIR)/$(@D); \
926 if [ ! -f $$SD/Makefile ]; then \
928 DD=$(notdir $(@D)); \
930 if ([ ! -f $$DD/Makefile ] || \
931 command test $$DD/Makefile -ot \
932 $$SD/Makefile ); then \
934 $(CP) $$SD/Makefile $$DD/Makefile; \
936 $(MAKE) -C $$DD $(subst $(@D)/.make,,$@)
939 #---------------------------------------------------------
940 # Handle the OPTIONAL_DIRS options for directores that may
942 #---------------------------------------------------------
945 SubDirs += $(OPTIONAL_DIRS)
947 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
948 $(RecursiveTargets)::
949 $(Verb) for dir in $(OPTIONAL_DIRS); do \
950 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
951 if ([ ! -f $$dir/Makefile ] || \
952 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
954 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
956 ($(MAKE) -C$$dir $@ ) || exit 1; \
960 $(RecursiveTargets)::
961 $(Verb) for dir in $(OPTIONAL_DIRS); do \
962 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
963 ($(MAKE) -C$$dir $@ ) || exit 1; \
969 #---------------------------------------------------------
970 # Handle the CONFIG_FILES options
971 #---------------------------------------------------------
976 $(Echo) Install circumvented with NO_INSTALL
978 $(Echo) UnInstall circumvented with NO_INSTALL
980 install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
981 $(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir)
982 $(Verb)for file in $(CONFIG_FILES); do \
983 if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
984 $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
985 elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
986 $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
988 $(ECHO) Error: cannot find config file $${file}. ; \
993 $(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
994 $(Verb)for file in $(CONFIG_FILES); do \
995 $(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
1001 ###############################################################################
1002 # Set up variables for building libraries
1003 ###############################################################################
1005 #---------------------------------------------------------
1006 # Define various command line options pertaining to the
1007 # libraries needed when linking. There are "Proj" libs
1008 # (defined by the user's project) and "LLVM" libs (defined
1009 # by the LLVM project).
1010 #---------------------------------------------------------
1013 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
1014 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
1015 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
1016 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
1020 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
1021 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
1022 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
1023 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
1026 # Loadable module for Win32 requires all symbols resolved for linking.
1027 # Then all symbols in LLVM.dll will be available.
1028 ifeq ($(ENABLE_SHARED),1)
1029 ifdef LOADABLE_MODULE
1030 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
1031 LINK_COMPONENTS += all
1036 ifndef IS_CLEANING_TARGET
1037 ifdef LINK_COMPONENTS
1039 # If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make
1040 # clean in tools, then do a make in tools (instead of at the top level).
1042 @echo "*** llvm-config doesn't exist - rebuilding it."
1043 @$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config
1045 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
1047 ifeq ($(ENABLE_SHARED), 1)
1048 # We can take the "auto-import" feature to get rid of using dllimport.
1049 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1050 LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
1053 LLVMLibsOptions += -lLLVM-$(LLVMVersion)
1054 LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT)
1057 ifndef NO_LLVM_CONFIG
1058 LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)
1059 ifeq ($(LLVMConfigLibs),Error)
1060 $(error llvm-config --libs failed)
1062 LLVMLibsOptions += $(LLVMConfigLibs)
1063 LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error)
1064 ifeq ($(LLVMConfigLibfiles),Error)
1065 $(error llvm-config --libfiles failed)
1067 LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles)
1074 # Set up the library exports file.
1075 ifdef EXPORTED_SYMBOL_FILE
1077 # First, set up the native export file, which may differ from the source
1080 ifeq ($(HOST_OS),Darwin)
1081 # Darwin convention prefixes symbols with underscores.
1082 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed
1083 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1084 $(Verb) sed -e 's/^/_/' < $< > $@
1086 -$(Verb) $(RM) -f $(NativeExportsFile)
1088 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1089 # Gold and BFD ld require a version script rather than a plain list.
1090 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
1091 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1092 $(Verb) echo "{" > $@
1093 $(Verb) grep -q '[[:alnum:]_]' $< && echo " global:" >> $@ || :
1094 $(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@
1095 ifneq ($(HOST_OS),OpenBSD)
1096 $(Verb) echo " local: *;" >> $@
1098 $(Verb) echo "};" >> $@
1100 -$(Verb) $(RM) -f $(NativeExportsFile)
1102 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1103 # GNU ld Win32 accepts .DEF files that contain "DATA" entries.
1104 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def))
1105 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1106 $(Echo) Generating $(notdir $@)
1107 $(Verb) $(ECHO) "EXPORTS" > $@
1108 $(Verb) $(CAT) $< >> $@
1110 -$(Verb) $(RM) -f $(NativeExportsFile)
1112 # Default behavior: just use the exports file verbatim.
1113 NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
1118 # Now add the linker command-line options to use the native export file.
1121 ifeq ($(HOST_OS),Darwin)
1122 LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
1125 # gold, bfd ld, etc.
1126 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1127 LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
1131 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1132 # LLVMLibsOptions is invalidated at processing tools/llvm-shlib.
1133 SharedLinkOptions += $(NativeExportsFile)
1138 ###############################################################################
1139 # Library Build Rules: Four ways to build a library
1140 ###############################################################################
1142 #---------------------------------------------------------
1143 # Bytecode Module Targets:
1144 # If the user set MODULE_NAME then they want to build a
1145 # bytecode module from the sources. We compile all the
1146 # sources and link it together into a single bytecode
1148 #---------------------------------------------------------
1151 ifeq ($(strip $(LLVMCC)),)
1152 $(warning Modules require LLVM capable compiler but none is available ****)
1155 Module := $(LibDir)/$(MODULE_NAME).bc
1156 LinkModule := $(LLVMLINK)
1159 ifdef EXPORTED_SYMBOL_FILE
1160 LinkModule += -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1163 $(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(LLVMLINK)
1164 $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
1165 $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
1167 all-local:: $(Module)
1170 ifneq ($(strip $(Module)),)
1171 -$(Verb) $(RM) -f $(Module)
1174 ifdef BYTECODE_DESTINATION
1175 ModuleDestDir := $(BYTECODE_DESTINATION)
1177 ModuleDestDir := $(DESTDIR)$(PROJ_libdir)
1182 $(Echo) Install circumvented with NO_INSTALL
1184 $(Echo) Uninstall circumvented with NO_INSTALL
1186 DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
1188 install-module:: $(DestModule)
1189 install-local:: $(DestModule)
1191 $(DestModule): $(ModuleDestDir) $(Module)
1192 $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
1193 $(Verb) $(DataInstall) $(Module) $(DestModule)
1196 $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
1197 -$(Verb) $(RM) -f $(DestModule)
1203 # if we're building a library ...
1206 # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option
1207 LIBRARYNAME := $(strip $(LIBRARYNAME))
1208 ifdef LOADABLE_MODULE
1209 BaseLibName.A := $(LIBRARYNAME).a
1210 BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT)
1212 BaseLibName.A := lib$(LIBRARYNAME).a
1213 BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
1215 LibName.A := $(LibDir)/$(BaseLibName.A)
1216 LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
1217 LibName.O := $(LibDir)/$(LIBRARYNAME).o
1218 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
1220 #---------------------------------------------------------
1221 # Shared Library Targets:
1222 # If the user asked for a shared library to be built
1223 # with the SHARED_LIBRARY variable, then we provide
1224 # targets for building them.
1225 #---------------------------------------------------------
1226 ifdef SHARED_LIBRARY
1228 all-local:: $(LibName.SO)
1230 ifdef EXPORTED_SYMBOL_FILE
1231 $(LibName.SO): $(NativeExportsFile)
1234 ifdef LINK_LIBS_IN_SHARED
1235 ifdef LOADABLE_MODULE
1236 SharedLibKindMessage := "Loadable Module"
1237 SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions)
1239 SharedLibKindMessage := "Shared Library"
1241 $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
1242 $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
1244 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
1245 $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
1247 $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
1248 $(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
1249 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
1253 ifneq ($(strip $(LibName.SO)),)
1254 -$(Verb) $(RM) -f $(LibName.SO)
1259 $(Echo) Install circumvented with NO_INSTALL
1261 $(Echo) Uninstall circumvented with NO_INSTALL
1264 # Win32.DLL prefers to be located on the "PATH" of binaries.
1265 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1266 DestSharedLibDir := $(DESTDIR)$(PROJ_bindir)
1268 DestSharedLibDir := $(DESTDIR)$(PROJ_libdir)
1270 DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
1272 install-local:: $(DestSharedLib)
1274 $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir)
1275 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
1276 $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
1279 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
1280 -$(Verb) $(RM) -f $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME).*
1284 #---------------------------------------------------------
1285 # Bytecode Library Targets:
1286 # If the user asked for a bytecode library to be built
1287 # with the BYTECODE_LIBRARY variable, then we provide
1288 # targets for building them.
1289 #---------------------------------------------------------
1290 ifdef BYTECODE_LIBRARY
1291 ifeq ($(strip $(LLVMCC)),)
1292 $(warning Bytecode libraries require LLVM capable compiler but none is available ****)
1295 all-local:: $(LibName.BCA)
1297 ifdef EXPORTED_SYMBOL_FILE
1298 BCLinkLib = $(LLVMLINK) -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1300 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLINK) \
1301 $(LLVMToolDir)/llvm-ar
1302 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
1304 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).internalize $(ObjectsBC)
1306 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).internalize.bc
1308 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
1309 $(LLVMToolDir)/llvm-ar
1310 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
1312 $(Verb) $(LArchive) $@ $(ObjectsBC)
1317 ifneq ($(strip $(LibName.BCA)),)
1318 -$(Verb) $(RM) -f $(LibName.BCA)
1321 ifdef BYTECODE_DESTINATION
1322 BytecodeDestDir := $(BYTECODE_DESTINATION)
1324 BytecodeDestDir := $(DESTDIR)$(PROJ_libdir)
1327 DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).bca
1329 install-bytecode-local:: $(DestBytecodeLib)
1333 $(Echo) Install circumvented with NO_INSTALL
1335 $(Echo) Uninstall circumvented with NO_INSTALL
1337 install-local:: $(DestBytecodeLib)
1339 $(DestBytecodeLib): $(LibName.BCA) $(BytecodeDestDir)
1340 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1341 $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
1344 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1345 -$(Verb) $(RM) -f $(DestBytecodeLib)
1350 #---------------------------------------------------------
1352 # If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
1353 # building an archive.
1354 #---------------------------------------------------------
1355 ifndef NO_BUILD_ARCHIVE
1356 ifndef BUILD_ARCHIVE
1357 ifndef LOADABLE_MODULE
1363 #---------------------------------------------------------
1364 # Archive Library Targets:
1365 # If the user wanted a regular archive library built,
1366 # then we provide targets for building them.
1367 #---------------------------------------------------------
1370 all-local:: $(LibName.A)
1372 $(LibName.A): $(ObjectsO) $(LibDir)/.dir
1373 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
1374 -$(Verb) $(RM) -f $@
1375 $(Verb) $(Archive) $@ $(ObjectsO)
1376 $(Verb) $(Ranlib) $@
1379 ifneq ($(strip $(LibName.A)),)
1380 -$(Verb) $(RM) -f $(LibName.A)
1385 $(Echo) Install circumvented with NO_INSTALL
1387 $(Echo) Uninstall circumvented with NO_INSTALL
1389 ifdef NO_INSTALL_ARCHIVES
1391 $(Echo) Install circumvented with NO_INSTALL
1393 $(Echo) Uninstall circumvented with NO_INSTALL
1395 DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a
1397 install-local:: $(DestArchiveLib)
1399 $(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
1400 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
1401 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
1402 $(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
1405 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
1406 -$(Verb) $(RM) -f $(DestArchiveLib)
1414 ###############################################################################
1415 # Tool Build Rules: Build executable tool based on TOOLNAME option
1416 ###############################################################################
1420 #---------------------------------------------------------
1421 # Set up variables for building a tool.
1422 #---------------------------------------------------------
1423 TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
1425 ToolBuildPath := $(ExmplDir)/$(TOOLEXENAME)
1427 ToolBuildPath := $(ToolDir)/$(TOOLEXENAME)
1430 # TOOLALIAS is a name to symlink (or copy) the tool to.
1433 ToolAliasBuildPath := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1435 ToolAliasBuildPath := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1439 #---------------------------------------------------------
1441 #---------------------------------------------------------
1443 # If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
1444 # not exporting all of the weak symbols from the binary. This reduces dyld
1445 # startup time by 4x on darwin in some cases.
1446 ifdef TOOL_NO_EXPORTS
1447 ifeq ($(HOST_OS),Darwin)
1449 # Tiger tools don't support this.
1450 ifneq ($(DARWIN_MAJVERS),4)
1451 LD.Flags += -Wl,-exported_symbol,_main
1455 ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU))
1456 ifneq ($(ARCH), Mips)
1457 LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
1462 #---------------------------------------------------------
1463 # Tool Order File Support
1464 #---------------------------------------------------------
1466 ifeq ($(HOST_OS),Darwin)
1467 ifdef TOOL_ORDER_FILE
1469 LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
1474 #---------------------------------------------------------
1475 # Tool Version Info Support
1476 #---------------------------------------------------------
1478 ifeq ($(HOST_OS),Darwin)
1479 ifdef TOOL_INFO_PLIST
1481 LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST)
1483 $(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST)
1485 $(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir
1486 $(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..."
1487 $(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \
1488 -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \
1489 -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \
1490 -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \
1496 #---------------------------------------------------------
1497 # Provide targets for building the tools
1498 #---------------------------------------------------------
1499 all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
1502 ifneq ($(strip $(ToolBuildPath)),)
1503 -$(Verb) $(RM) -f $(ToolBuildPath)
1505 ifneq ($(strip $(ToolAliasBuildPath)),)
1506 -$(Verb) $(RM) -f $(ToolAliasBuildPath)
1510 $(ToolBuildPath): $(ExmplDir)/.dir
1512 $(ToolBuildPath): $(ToolDir)/.dir
1515 ifdef CODESIGN_TOOLS
1516 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1517 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1518 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1519 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1520 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1522 $(Echo) ======= Code-Signing $(BuildMode) Executable $(TOOLNAME)
1523 $(Verb) codesign -s - $@
1525 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1526 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1527 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1528 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1529 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1533 ifneq ($(strip $(ToolAliasBuildPath)),)
1534 $(ToolAliasBuildPath): $(ToolBuildPath)
1535 $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
1536 $(Verb) $(RM) -f $(ToolAliasBuildPath)
1537 $(Verb) $(AliasTool) $(notdir $(ToolBuildPath)) $(ToolAliasBuildPath)
1538 $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
1544 $(Echo) Install circumvented with NO_INSTALL
1546 $(Echo) Uninstall circumvented with NO_INSTALL
1550 ToolBinDir = $(DESTDIR)$(PROJ_internal_prefix)/bin
1552 ToolBinDir = $(DESTDIR)$(PROJ_bindir)
1554 DestTool = $(ToolBinDir)/$(program_prefix)$(TOOLEXENAME)
1556 install-local:: $(DestTool)
1558 $(DestTool): $(ToolBuildPath)
1559 $(Echo) Installing $(BuildMode) $(DestTool)
1560 $(Verb) $(MKDIR) $(ToolBinDir)
1561 $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
1564 $(Echo) Uninstalling $(BuildMode) $(DestTool)
1565 -$(Verb) $(RM) -f $(DestTool)
1567 # TOOLALIAS install.
1569 DestToolAlias = $(ToolBinDir)/$(program_prefix)$(TOOLALIAS)$(EXEEXT)
1571 install-local:: $(DestToolAlias)
1573 $(DestToolAlias): $(DestTool)
1574 $(Echo) Installing $(BuildMode) $(DestToolAlias)
1575 $(Verb) $(RM) -f $(DestToolAlias)
1576 $(Verb) $(AliasTool) $(notdir $(DestTool)) $(DestToolAlias)
1579 $(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
1580 -$(Verb) $(RM) -f $(DestToolAlias)
1586 ###############################################################################
1587 # Object Build Rules: Build object files based on sources
1588 ###############################################################################
1590 # FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
1591 ifeq ($(HOST_OS),HP-UX)
1592 DISABLE_AUTO_DEPENDENCIES=1
1595 # Provide rule sets for when dependency generation is enabled
1596 ifndef DISABLE_AUTO_DEPENDENCIES
1598 #---------------------------------------------------------
1599 # Create .o files in the ObjDir directory from the .cpp and .c files...
1600 #---------------------------------------------------------
1602 DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
1603 -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
1605 # If the build succeeded, move the dependency file over, otherwise
1607 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
1608 else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
1610 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1611 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1612 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1615 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1616 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1617 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1620 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1621 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1622 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1625 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1626 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1627 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1630 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1631 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1632 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1635 #---------------------------------------------------------
1636 # Create .bc files in the ObjDir directory from .cpp .cc and .c files...
1637 #---------------------------------------------------------
1639 BC_DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.bc.d.tmp" \
1640 -MT "$(ObjDir)/$*.ll" -MT "$(ObjDir)/$*.bc.d"
1642 # If the build succeeded, move the dependency file over, otherwise
1644 BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d"; \
1645 else $(RM) "$(ObjDir)/$*.bc.d.tmp"; exit 1; fi
1647 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1648 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1649 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1650 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1651 $(BC_DEPEND_MOVEFILE)
1653 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1654 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1655 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1656 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1657 $(BC_DEPEND_MOVEFILE)
1659 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1660 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1661 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1662 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1663 $(BC_DEPEND_MOVEFILE)
1665 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1666 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1667 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1668 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1669 $(BC_DEPEND_MOVEFILE)
1671 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1672 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1673 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1674 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1675 $(BC_DEPEND_MOVEFILE)
1677 # Provide alternate rule sets if dependencies are disabled
1680 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1681 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1682 $(Compile.CXX) $< -o $@
1684 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1685 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1686 $(Compile.CXX) $< -o $@
1688 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1689 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1690 $(Compile.CXX) $< -o $@
1692 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1693 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1694 $(Compile.C) $< -o $@
1696 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1697 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1698 $(Compile.C) $< -o $@
1700 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1701 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1702 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1704 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1705 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1706 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1708 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1709 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1710 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1712 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1713 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1714 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1716 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1717 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1718 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1723 ## Rules for building preprocessed (.i/.ii) outputs.
1724 $(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1725 $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
1726 $(Verb) $(Preprocess.CXX) $< -o $@
1728 $(BuildMode)/%.ii: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1729 $(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file"
1730 $(Verb) $(Preprocess.CXX) $< -o $@
1732 $(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1733 $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
1734 $(Verb) $(Preprocess.CXX) $< -o $@
1736 $(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1737 $(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
1738 $(Verb) $(Preprocess.C) $< -o $@
1740 $(BuildMode)/%.i: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1741 $(Echo) "Compiling $*.m for $(BuildMode) build to .i file"
1742 $(Verb) $(Preprocess.C) $< -o $@
1745 $(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1746 $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
1747 $(Compile.CXX) $< -o $@ -S
1749 $(ObjDir)/%.s: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1750 $(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG)
1751 $(Compile.CXX) $< -o $@ -S
1753 $(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1754 $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
1755 $(Compile.CXX) $< -o $@ -S
1757 $(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1758 $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
1759 $(Compile.C) $< -o $@ -S
1761 $(ObjDir)/%.s: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1762 $(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG)
1763 $(Compile.C) $< -o $@ -S
1766 # make the C and C++ compilers strip debug info out of bytecode libraries.
1768 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1769 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1770 $(Verb) $(LOPT) $< -std-compile-opts -o $@
1772 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1773 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1774 $(Verb) $(LOPT) $< -std-compile-opts -strip-debug -o $@
1778 #---------------------------------------------------------
1779 # Provide rule to build .bc files from .ll sources,
1780 # regardless of dependencies
1781 #---------------------------------------------------------
1782 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
1783 $(Echo) "Compiling $*.ll for $(BuildMode) build"
1784 $(Verb) $(LLVMAS) $< -f -o $@
1786 ###############################################################################
1787 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
1788 ###############################################################################
1791 TABLEGEN_INC_FILES_COMMON = 1
1794 ifdef TABLEGEN_INC_FILES_COMMON
1796 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
1797 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1798 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
1800 # INCFiles rule: All of the tblgen generated files are emitted to
1801 # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
1802 # us to only "touch" the real file if the contents of it change. IOW, if
1803 # tblgen is modified, all of the .inc.tmp files are regenerated, but no
1804 # dependencies of the .inc files are, unless the contents of the .inc file
1806 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
1807 $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
1809 endif # TABLEGEN_INC_FILES_COMMON
1813 TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
1814 $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \
1815 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \
1816 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \
1817 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \
1818 $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
1819 $(wildcard $(LLVM_SRC_ROOT)/include/llvm/IR/Intrinsics*.td)
1821 # All .inc.tmp files depend on the .td files.
1822 $(INCTMPFiles) : $(TDFiles)
1824 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1825 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1826 $(Echo) "Building $(<F) register info implementation with tblgen"
1827 $(Verb) $(LLVMTableGen) -gen-register-info -o $(call SYSPATH, $@) $<
1829 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1830 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1831 $(Echo) "Building $(<F) instruction information with tblgen"
1832 $(Verb) $(LLVMTableGen) -gen-instr-info -o $(call SYSPATH, $@) $<
1834 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1835 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1836 $(Echo) "Building $(<F) assembly writer with tblgen"
1837 $(Verb) $(LLVMTableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
1839 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1840 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1841 $(Echo) "Building $(<F) assembly writer #1 with tblgen"
1842 $(Verb) $(LLVMTableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
1844 $(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
1845 $(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1846 $(Echo) "Building $(<F) assembly matcher with tblgen"
1847 $(Verb) $(LLVMTableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
1849 $(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \
1850 $(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1851 $(Echo) "Building $(<F) MC code emitter with tblgen"
1852 $(Verb) $(LLVMTableGen) -gen-emitter -mc-emitter -o $(call SYSPATH, $@) $<
1854 $(TARGET:%=$(ObjDir)/%GenMCPseudoLowering.inc.tmp): \
1855 $(ObjDir)/%GenMCPseudoLowering.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1856 $(Echo) "Building $(<F) MC Pseudo instruction expander with tblgen"
1857 $(Verb) $(LLVMTableGen) -gen-pseudo-lowering -o $(call SYSPATH, $@) $<
1859 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1860 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1861 $(Echo) "Building $(<F) code emitter with tblgen"
1862 $(Verb) $(LLVMTableGen) -gen-emitter -o $(call SYSPATH, $@) $<
1864 $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
1865 $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1866 $(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
1867 $(Verb) $(LLVMTableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
1869 $(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \
1870 $(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1871 $(Echo) "Building $(<F) disassembly tables with tblgen"
1872 $(Verb) $(LLVMTableGen) -gen-disassembler -o $(call SYSPATH, $@) $<
1874 $(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
1875 $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1876 $(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
1877 $(Verb) $(LLVMTableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
1879 $(TARGET:%=$(ObjDir)/%GenSubtargetInfo.inc.tmp): \
1880 $(ObjDir)/%GenSubtargetInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1881 $(Echo) "Building $(<F) subtarget information with tblgen"
1882 $(Verb) $(LLVMTableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
1884 $(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
1885 $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1886 $(Echo) "Building $(<F) calling convention information with tblgen"
1887 $(Verb) $(LLVMTableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
1889 $(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
1890 $(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1891 $(Echo) "Building $(<F) intrinsics information with tblgen"
1892 $(Verb) $(LLVMTableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
1894 $(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1895 $(Echo) "Building $(<F) decoder tables with tblgen"
1896 $(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $<
1898 $(ObjDir)/%GenDFAPacketizer.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1899 $(Echo) "Building $(<F) DFA packetizer tables with tblgen"
1900 $(Verb) $(LLVMTableGen) -gen-dfa-packetizer -o $(call SYSPATH, $@) $<
1903 -$(Verb) $(RM) -f $(INCFiles)
1907 ###############################################################################
1908 # OTHER RULES: Other rules needed
1909 ###############################################################################
1911 # To create postscript files from dot files...
1912 ifneq ($(DOT),false)
1914 $(DOT) -Tps < $< > $@
1917 $(Echo) "Cannot build $@: The program dot is not installed"
1920 # This rules ensures that header files that are removed still have a rule for
1921 # which they can be "generated." This allows make to ignore them and
1922 # reproduce the dependency lists.
1926 # Define clean-local to clean the current directory. Note that this uses a
1927 # very conservative approach ensuring that empty variables do not cause
1928 # errors or disastrous removal.
1930 ifneq ($(strip $(ObjRootDir)),)
1931 -$(Verb) $(RM) -rf $(ObjRootDir)
1933 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1934 -$(Verb) $(RM) -f *$(SHLIBEXT)
1938 -$(Verb) $(RM) -rf Debug Release Profile
1941 ###############################################################################
1942 # DEPENDENCIES: Include the dependency files if we should
1943 ###############################################################################
1944 ifndef DISABLE_AUTO_DEPENDENCIES
1946 # If its not one of the cleaning targets
1947 ifndef IS_CLEANING_TARGET
1949 # Get the list of dependency files
1950 DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources)))
1951 DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
1953 # Include bitcode dependency files if using bitcode libraries
1954 ifdef BYTECODE_LIBRARY
1955 DependFiles += $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.bc.d)
1958 -include $(DependFiles) ""
1964 ###############################################################################
1965 # CHECK: Running the test suite
1966 ###############################################################################
1969 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1970 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1971 $(EchoCmd) Running test suite ; \
1972 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
1973 TESTSUITE=$(TESTSUITE) ; \
1975 $(EchoCmd) No Makefile in test directory ; \
1978 $(EchoCmd) No test directory ; \
1981 # An alias dating from when both lit and DejaGNU test runners were used.
1985 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1986 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1987 $(EchoCmd) Running test suite ; \
1988 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \
1990 $(EchoCmd) No Makefile in test directory ; \
1993 $(EchoCmd) No test directory ; \
1996 ###############################################################################
1997 # UNITTESTS: Running the unittests test suite
1998 ###############################################################################
2001 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
2002 if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
2003 $(EchoCmd) Running unittests test suite ; \
2004 $(MAKE) -C $(PROJ_OBJ_ROOT)/unittests unitcheck; \
2006 $(EchoCmd) No Makefile in unittests directory ; \
2009 $(EchoCmd) No unittests directory ; \
2012 ###############################################################################
2013 # DISTRIBUTION: Handle construction of a distribution tarball
2014 ###############################################################################
2016 #------------------------------------------------------------------------
2017 # Define distribution related variables
2018 #------------------------------------------------------------------------
2019 DistName := $(PROJECT_NAME)-$(PROJ_VERSION)
2020 DistDir := $(PROJ_OBJ_ROOT)/$(DistName)
2021 TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName)
2022 DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
2023 DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip
2024 DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
2025 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
2026 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
2027 Makefile.config.in configure autoconf
2028 DistOther := $(notdir $(wildcard \
2029 $(PROJ_SRC_DIR)/*.h \
2030 $(PROJ_SRC_DIR)/*.td \
2031 $(PROJ_SRC_DIR)/*.def \
2032 $(PROJ_SRC_DIR)/*.ll \
2033 $(PROJ_SRC_DIR)/*.in))
2034 DistSubDirs := $(SubDirs)
2035 DistSources = $(Sources) $(EXTRA_DIST)
2036 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
2038 #------------------------------------------------------------------------
2039 # We MUST build distribution with OBJ_DIR != SRC_DIR
2040 #------------------------------------------------------------------------
2041 ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
2042 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
2043 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
2047 #------------------------------------------------------------------------
2048 # Prevent attempt to run dist targets from anywhere but the top level
2049 #------------------------------------------------------------------------
2051 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
2052 $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
2055 #------------------------------------------------------------------------
2056 # Provide the top level targets
2057 #------------------------------------------------------------------------
2059 dist-gzip:: $(DistTarGZip)
2061 $(DistTarGZip) : $(TopDistDir)/.makedistdir
2062 $(Echo) Packing gzipped distribution tar file.
2063 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
2064 $(GZIP) -c > "$(DistTarGZip)"
2066 dist-bzip2:: $(DistTarBZ2)
2068 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
2069 $(Echo) Packing bzipped distribution tar file.
2070 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
2071 $(BZIP2) -c >$(DistTarBZ2)
2073 dist-zip:: $(DistZip)
2075 $(DistZip) : $(TopDistDir)/.makedistdir
2076 $(Echo) Packing zipped distribution file.
2077 $(Verb) rm -f $(DistZip)
2078 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
2080 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
2081 $(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL =====
2083 DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
2085 dist-check:: $(DistTarGZip)
2086 $(Echo) Checking distribution tar file.
2087 $(Verb) if test -d $(DistCheckDir) ; then \
2088 $(RM) -rf $(DistCheckDir) ; \
2090 $(Verb) $(MKDIR) $(DistCheckDir)
2091 $(Verb) cd $(DistCheckDir) && \
2092 $(MKDIR) $(DistCheckDir)/build && \
2093 $(MKDIR) $(DistCheckDir)/install && \
2094 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
2096 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
2097 --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
2100 $(MAKE) unittests && \
2101 $(MAKE) install && \
2102 $(MAKE) uninstall && \
2103 $(MAKE) dist-clean && \
2104 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
2107 $(Echo) Cleaning distribution files
2108 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
2113 #------------------------------------------------------------------------
2114 # Provide the recursive distdir target for building the distribution directory
2115 #------------------------------------------------------------------------
2116 distdir: $(DistDir)/.makedistdir
2117 $(DistDir)/.makedistdir: $(DistSources)
2118 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2119 if test -d "$(DistDir)" ; then \
2120 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
2123 $(EchoCmd) Removing old $(DistDir) ; \
2124 $(RM) -rf $(DistDir); \
2125 $(EchoCmd) Making 'all' to verify build ; \
2126 $(MAKE) ENABLE_OPTIMIZED=1 all ; \
2128 $(Echo) Building Distribution Directory $(DistDir)
2129 $(Verb) $(MKDIR) $(DistDir)
2130 $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
2131 srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
2132 for file in $(DistFiles) ; do \
2134 $(PROJ_SRC_DIR)/*) \
2135 file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
2137 $(PROJ_SRC_ROOT)/*) \
2138 file=`echo "$$file" | \
2139 sed "s#^$$srcrootstrip/##"` \
2142 if test -f "$(PROJ_SRC_DIR)/$$file" || \
2143 test -d "$(PROJ_SRC_DIR)/$$file" ; then \
2144 from_dir="$(PROJ_SRC_DIR)" ; \
2145 elif test -f "$$file" || test -d "$$file" ; then \
2148 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
2149 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
2150 to_dir="$(DistDir)/$$dir"; \
2151 $(MKDIR) "$$to_dir" ; \
2153 to_dir="$(DistDir)"; \
2155 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
2156 if test -n "$$mid_dir" ; then \
2157 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
2159 if test -d "$$from_dir/$$file"; then \
2160 if test -d "$(PROJ_SRC_DIR)/$$file" && \
2161 test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
2162 cd $(PROJ_SRC_DIR) ; \
2163 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2164 ( cd $$to_dir ; $(TAR) xf - ) ; \
2165 cd $(PROJ_OBJ_DIR) ; \
2168 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2169 ( cd $$to_dir ; $(TAR) xf - ) ; \
2170 cd $(PROJ_OBJ_DIR) ; \
2172 elif test -f "$$from_dir/$$file" ; then \
2173 $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
2174 elif test -L "$$from_dir/$$file" ; then \
2175 $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
2176 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
2177 $(EchoCmd) "===== WARNING: Distribution Source " \
2178 "$$from_dir/$$file Not Found!" ; \
2179 elif test "$(Verb)" != '@' ; then \
2180 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
2183 $(Verb) for subdir in $(DistSubDirs) ; do \
2184 if test "$$subdir" \!= "." ; then \
2185 new_distdir="$(DistDir)/$$subdir" ; \
2186 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
2187 ( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
2188 DistDir="$$new_distdir" distdir ) || exit 1; \
2191 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2192 $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
2193 $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
2194 -name .svn \) -print` ;\
2195 $(MAKE) dist-hook ; \
2196 $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
2197 -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
2198 -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
2199 -o ! -type d ! -perm -444 -exec \
2200 $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
2201 || chmod -R a+r $(DistDir) ; \
2204 # This is invoked by distdir target, define it as a no-op to avoid errors if not
2210 ###############################################################################
2211 # TOP LEVEL - targets only to apply at the top level directory
2212 ###############################################################################
2216 #------------------------------------------------------------------------
2217 # Install support for the project's include files:
2218 #------------------------------------------------------------------------
2221 $(Echo) Install circumvented with NO_INSTALL
2223 $(Echo) Uninstall circumvented with NO_INSTALL
2226 $(Echo) Installing include files
2227 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
2228 $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
2229 cd $(PROJ_SRC_ROOT)/include && \
2230 for hdr in `find . -type f \
2231 '(' -name LICENSE.TXT \
2236 ')' -print | grep -v CVS | \
2237 grep -v .svn` ; do \
2238 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2239 if test \! -d "$$instdir" ; then \
2240 $(EchoCmd) Making install directory $$instdir ; \
2241 $(MKDIR) $$instdir ;\
2243 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2246 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
2247 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
2248 cd $(PROJ_OBJ_ROOT)/include && \
2249 for hdr in `find . -type f \
2250 '(' -name LICENSE.TXT \
2255 ')' -print | grep -v CVS | \
2256 grep -v .svn` ; do \
2257 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2258 if test \! -d "$$instdir" ; then \
2259 $(EchoCmd) Making install directory $$instdir ; \
2260 $(MKDIR) $$instdir ;\
2262 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2268 $(Echo) Uninstalling include files
2269 $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
2270 cd $(PROJ_SRC_ROOT)/include && \
2271 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
2272 '!' '(' -name '*~' -o -name '.#*' \
2273 -o -name '*.in' ')' -print ')' | \
2274 grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2275 cd $(PROJ_SRC_ROOT)/include && \
2276 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
2277 -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2283 @echo searching for overlength lines in files: $(Sources)
2286 egrep -n '.{81}' $(Sources) /dev/null
2289 @echo searching for tabs in files: $(Sources)
2292 egrep -n ' ' $(Sources) /dev/null
2295 @ls -l $(LibDir) | awk '\
2296 BEGIN { sum = 0; } \
2298 END { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2299 @ls -l $(ToolDir) | awk '\
2300 BEGIN { sum = 0; } \
2302 END { printf("Programs: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2303 #------------------------------------------------------------------------
2304 # Print out the directories used for building
2305 #------------------------------------------------------------------------
2307 $(Echo) "BuildMode : " '$(BuildMode)'
2308 $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
2309 $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
2310 $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
2311 $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
2312 $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
2313 $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
2314 $(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
2315 $(Echo) "PROJ_internal_prefix : " '$(PROJ_internal_prefix)'
2316 $(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
2317 $(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
2318 $(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
2319 $(Echo) "PROJ_includedir : " '$(PROJ_includedir)'
2320 $(Echo) "UserTargets : " '$(UserTargets)'
2321 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
2322 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
2323 $(Echo) "ObjDir : " '$(ObjDir)'
2324 $(Echo) "LibDir : " '$(LibDir)'
2325 $(Echo) "ToolDir : " '$(ToolDir)'
2326 $(Echo) "ExmplDir : " '$(ExmplDir)'
2327 $(Echo) "Sources : " '$(Sources)'
2328 $(Echo) "TDFiles : " '$(TDFiles)'
2329 $(Echo) "INCFiles : " '$(INCFiles)'
2330 $(Echo) "INCTMPFiles : " '$(INCTMPFiles)'
2331 $(Echo) "PreConditions: " '$(PreConditions)'
2332 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
2333 $(Echo) "Compile.C : " '$(Compile.C)'
2334 $(Echo) "Archive : " '$(Archive)'
2335 $(Echo) "YaccFiles : " '$(YaccFiles)'
2336 $(Echo) "LexFiles : " '$(LexFiles)'
2337 $(Echo) "Module : " '$(Module)'
2338 $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
2339 $(Echo) "SubDirs : " '$(SubDirs)'
2340 $(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
2341 $(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
2346 # General debugging rule, use 'make dbg-print-XXX' to print the
2347 # definition, value and origin of XXX.
2349 $(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))