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_PROFILING),1)
325 BuildMode := $(BuildMode)+Profile
326 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
327 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) -pg -g
328 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg -g
332 ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
333 CXX.Flags += -fvisibility-inlines-hidden
336 ifdef ENABLE_EXPENSIVE_CHECKS
337 # GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above.
338 # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40160
342 # IF REQUIRES_EH=1 is specified then don't disable exceptions
344 CXX.Flags += -fno-exceptions
346 # If the library requires EH, it also requires RTTI.
350 ifdef REQUIRES_FRAME_POINTER
351 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags))
352 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags))
353 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags))
356 # If REQUIRES_RTTI=1 is specified then don't disable run-time type id.
357 ifneq ($(REQUIRES_RTTI), 1)
358 CXX.Flags += -fno-rtti
361 ifeq ($(ENABLE_COVERAGE),1)
362 BuildMode := $(BuildMode)+Coverage
363 CXX.Flags += -ftest-coverage -fprofile-arcs
364 C.Flags += -ftest-coverage -fprofile-arcs
367 # If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
368 # then disable assertions by defining the appropriate preprocessor symbols.
369 ifeq ($(DISABLE_ASSERTIONS),1)
370 CPP.Defines += -DNDEBUG
372 BuildMode := $(BuildMode)+Asserts
373 CPP.Defines += -D_DEBUG
376 # If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
377 # configured), then enable expensive checks by defining the
378 # appropriate preprocessor symbols.
379 ifeq ($(ENABLE_EXPENSIVE_CHECKS),1)
380 BuildMode := $(BuildMode)+Checks
381 CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
384 # LOADABLE_MODULE implies several other things so we force them to be
386 ifdef LOADABLE_MODULE
388 LINK_LIBS_IN_SHARED := 1
396 ifeq ($(ENABLE_PIC),1)
397 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
398 # Nothing. Win32 defaults to PIC and warns when given -fPIC
400 ifeq ($(HOST_OS),Darwin)
401 # Common symbols not allowed in dylib files
402 CXX.Flags += -fno-common
403 C.Flags += -fno-common
405 # Linux and others; pass -fPIC
411 ifeq ($(HOST_OS),Darwin)
412 CXX.Flags += -mdynamic-no-pic
413 C.Flags += -mdynamic-no-pic
417 # Support makefile variable to disable any kind of timestamp/non-deterministic
418 # info from being used in the build.
419 ifeq ($(ENABLE_TIMESTAMPS),1)
420 DOTDIR_TIMESTAMP_COMMAND := $(DATE)
422 DOTDIR_TIMESTAMP_COMMAND := echo 'Created.'
425 ifeq ($(HOST_OS),MingW)
427 CPP.Defines += -D__NO_CTYPE_INLINE
428 ifeq ($(LLVM_CROSS_COMPILING),1)
429 # Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016
431 LD.Flags += -Wl,--allow-multiple-definition
436 CXX.Flags += -Woverloaded-virtual
437 CPP.BaseFlags += $(CPP.Defines)
440 # Make Floating point IEEE compliant on Alpha.
443 CPP.BaseFlags += -mieee
444 ifeq ($(ENABLE_PIC),0)
446 CPP.BaseFlags += -fPIC
449 LD.Flags += -Wl,--no-relax
452 # GNU ld/PECOFF accepts but ignores them below;
456 # FIXME: autoconf should be aware of them.
457 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
458 HAVE_LINK_VERSION_SCRIPT := 0
460 RDYNAMIC := -Wl,--export-all-symbols
463 #--------------------------------------------------------------------
464 # Directory locations
465 #--------------------------------------------------------------------
467 ifeq ($(LLVM_CROSS_COMPILING),1)
468 BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin
471 ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode)
472 ObjDir := $(ObjRootDir)
473 LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
474 ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
475 ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
476 LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
477 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
478 LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
480 #--------------------------------------------------------------------
481 # Locations of shared libraries
482 #--------------------------------------------------------------------
485 SharedLibDir := $(LibDir)
486 LLVMSharedLibDir := $(LLVMLibDir)
488 # Win32.DLL prefers to be located on the "PATH" of binaries.
489 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
490 SharedLibDir := $(ToolDir)
491 LLVMSharedLibDir := $(LLVMToolDir)
493 ifeq ($(HOST_OS),Cygwin)
500 #--------------------------------------------------------------------
501 # LLVM Capable Compiler
502 #--------------------------------------------------------------------
504 ifneq ($(findstring llvm-gcc,$(LLVMCC_OPTION)),)
506 LLVMCXX := $(LLVMGXX)
508 ifneq ($(findstring clang,$(LLVMCC_OPTION)),)
509 ifneq ($(CLANGPATH),)
510 LLVMCC := $(CLANGPATH)
511 LLVMCXX := $(CLANGXXPATH)
513 ifeq ($(ENABLE_BUILT_CLANG),1)
514 LLVMCC := $(LLVMToolDir)/clang
515 LLVMCXX := $(LLVMToolDir)/clang++
521 #--------------------------------------------------------------------
522 # Full Paths To Compiled Tools and Utilities
523 #--------------------------------------------------------------------
524 EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
525 ifdef BUILD_DIRS_ONLY
526 EchoCmd := $(EchoCmd) "(build tools)":
531 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
534 ifeq ($(LLVM_CROSS_COMPILING),1)
535 LLVM_TBLGEN := $(BuildLLVMToolDir)/llvm-tblgen$(BUILD_EXEEXT)
537 LLVM_TBLGEN := $(LLVMToolDir)/llvm-tblgen$(EXEEXT)
540 ifeq ($(LLVM_CROSS_COMPILING),1)
541 LLVM_CONFIG := $(BuildLLVMToolDir)/llvm-config$(BUILD_EXEEXT)
543 LLVM_CONFIG := $(LLVMToolDir)/llvm-config$(EXEEXT)
546 LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
549 LLI := $(LLVMToolDir)/lli$(EXEEXT)
552 LLC := $(LLVMToolDir)/llc$(EXEEXT)
555 LOPT := $(LLVMToolDir)/opt$(EXEEXT)
558 LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
561 LLVMLINK := $(LLVMToolDir)/llvm-link$(EXEEXT)
564 #--------------------------------------------------------------------
565 # Adjust to user's request
566 #--------------------------------------------------------------------
568 ifeq ($(HOST_OS),Darwin)
569 DARWIN_VERSION := `sw_vers -productVersion`
570 # Strip a number like 10.4.7 to 10.4
571 DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/')
572 # Get "4" out of 10.4 for later pieces in the makefile.
573 DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
575 LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress
576 SharedLinkOptions := -dynamiclib
578 SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
581 SharedLinkOptions=-shared
584 ifeq ($(TARGET_OS),Darwin)
586 TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
591 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
592 ifneq ($(HOST_OS),Darwin)
593 LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
605 # Adjust settings for verbose mode
608 AR.Flags += >/dev/null 2>/dev/null
609 ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
611 ConfigureScriptFLAGS :=
614 # By default, strip symbol information from executable
616 Strip := $(PLATFORMSTRIPOPTS)
617 StripWarnMsg := "(without symbols)"
618 Install.StripFlag += -s
621 ifdef TOOL_NO_EXPORTS
624 DynamicFlag := $(RDYNAMIC)
627 # Adjust linker flags for building an executable
628 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
629 ifneq ($(HOST_OS), Darwin)
631 LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
633 LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
635 LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
639 ifneq ($(DARWIN_MAJVERS),4)
640 LD.Flags += $(RPATH) -Wl,@executable_path/../lib
646 #----------------------------------------------------------
647 # Options To Invoke Tools
648 #----------------------------------------------------------
650 ifdef EXTRA_LD_OPTIONS
651 LD.Flags += $(EXTRA_LD_OPTIONS)
655 CompileCommonOpts += -pedantic -Wno-long-long
657 CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
658 $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT)
659 # Enable cast-qual for C++; the workaround is to use const_cast.
660 CXX.Flags += -Wcast-qual
662 ifeq ($(HOST_OS),HP-UX)
663 CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
666 # If we are building a universal binary on Mac OS/X, pass extra options. This
667 # is useful to people that want to link the LLVM libraries into their universal
670 # The following can be optionally specified:
671 # UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
672 # For Mac OS/X 10.4 Intel machines, the traditional one is:
673 # UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
674 # UNIVERSAL_ARCH can be optionally specified to be a list of architectures
675 # to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64". This defaults to
678 ifndef UNIVERSAL_ARCH
679 UNIVERSAL_ARCH := i386 ppc
681 UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
682 CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
683 ifdef UNIVERSAL_SDK_PATH
684 CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
687 # Building universal cannot compute dependencies automatically.
688 DISABLE_AUTO_DEPENDENCIES=1
690 ifeq ($(TARGET_OS),Darwin)
691 ifeq ($(ARCH),x86_64)
692 TargetCommonOpts = -m64
695 TargetCommonOpts = -m32
701 ifeq ($(HOST_OS),SunOS)
702 CPP.BaseFlags += -include llvm/Support/Solaris.h
705 ifeq ($(HOST_OS),AuroraUX)
706 CPP.BaseFlags += -include llvm/Support/Solaris.h
707 endif # !HOST_OS - AuroraUX.
709 # On Windows, SharedLibDir != LibDir. The order is important.
710 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
711 LD.Flags += -L$(SharedLibDir) -L$(LibDir) -L$(LLVMToolDir) -L$(LLVMLibDir)
713 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
716 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
717 # All -I flags should go here, so that they don't confuse llvm-config.
718 CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
719 $(patsubst %,-I%/include,\
720 $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
721 $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
724 ifeq ($(INCLUDE_BUILD_DIR),1)
725 CPP.Flags += -I$(ObjDir)
728 # SHOW_DIAGNOSTICS support.
729 ifeq ($(SHOW_DIAGNOSTICS),1)
730 Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
731 CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
736 Compile.C = $(Compile.Wrapper) \
737 $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
738 $(TargetCommonOpts) $(CompileCommonOpts) -c
739 Compile.CXX = $(Compile.Wrapper) \
740 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
741 $(TargetCommonOpts) $(CompileCommonOpts) -c
742 Preprocess.CXX= $(Compile.Wrapper) \
743 $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
744 $(CompileCommonOpts) $(CXX.Flags) -E
745 Link = $(Compile.Wrapper) \
746 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
747 $(LDFLAGS) $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
749 BCCompile.C = $(LLVMCC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
750 $(TargetCommonOpts) $(CompileCommonOpts)
751 Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
752 $(TargetCommonOpts) $(CompileCommonOpts) -E
754 BCCompile.CXX = $(LLVMCXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
755 $(TargetCommonOpts) $(CompileCommonOpts)
757 ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
758 ScriptInstall = $(INSTALL) -m 0755
759 DataInstall = $(INSTALL) -m 0644
761 # When compiling under Mingw/Cygwin, the tblgen tool expects Windows
762 # paths. In this case, the SYSPATH function (defined in
763 # Makefile.config) transforms Unix paths into Windows paths.
764 TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
765 -I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
766 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
767 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
768 LLVMTableGen = $(LLVM_TBLGEN) $(TableGen.Flags)
770 Archive = $(AR) $(AR.Flags)
771 LArchive = $(LLVMToolDir)/llvm-ar rcsf
780 #----------------------------------------------------------
781 # Get the list of source files and compute object file
783 #----------------------------------------------------------
786 Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
787 $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
789 Sources := $(SOURCES)
793 Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
796 BaseNameSources := $(sort $(basename $(Sources)))
798 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
799 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
801 #----------------------------------------------------------
802 # For Mingw MSYS bash and Python/w32:
804 # $(ECHOPATH) prints DOSish pathstring.
805 # ex) $(ECHOPATH) /include/sys/types.h
806 # --> C:/mingw/include/sys/types.h
807 # built-in "echo" does not transform path to DOSish path.
809 # FIXME: It would not be needed when MSYS's python
811 #----------------------------------------------------------
813 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
814 ECHOPATH := $(Verb)python -u -c "import sys;print ' '.join(sys.argv[1:])"
816 ECHOPATH := $(Verb)$(ECHO)
819 ###############################################################################
820 # DIRECTORIES: Handle recursive descent of directory structure
821 ###############################################################################
823 #---------------------------------------------------------
824 # Provide rules to make install dirs. This must be early
825 # in the file so they get built before dependencies
826 #---------------------------------------------------------
828 $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
831 # To create other directories, as needed, and timestamp their creation
833 $(Verb) $(MKDIR) $* > /dev/null
834 $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
836 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
837 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
839 #---------------------------------------------------------
840 # Handle the DIRS options for sequential construction
841 #---------------------------------------------------------
847 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
848 $(RecursiveTargets)::
849 $(Verb) for dir in $(DIRS); do \
850 if ([ ! -f $$dir/Makefile ] || \
851 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
853 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
855 ($(MAKE) -C $$dir $@ ) || exit 1; \
858 $(RecursiveTargets)::
859 $(Verb) for dir in $(DIRS); do \
860 ($(MAKE) -C $$dir $@ ) || exit 1; \
866 #---------------------------------------------------------
867 # Handle the EXPERIMENTAL_DIRS options ensuring success
868 # after each directory is built.
869 #---------------------------------------------------------
870 ifdef EXPERIMENTAL_DIRS
871 $(RecursiveTargets)::
872 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
873 if ([ ! -f $$dir/Makefile ] || \
874 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
876 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
878 ($(MAKE) -C $$dir $@ ) || exit 0; \
882 #-----------------------------------------------------------
883 # Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
884 #-----------------------------------------------------------
885 ifdef OPTIONAL_PARALLEL_DIRS
886 PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) -o -f $(T)/Makefile && echo "$(T)"))
889 #-----------------------------------------------------------
890 # Handle the PARALLEL_DIRS options for parallel construction
891 #-----------------------------------------------------------
894 SubDirs += $(PARALLEL_DIRS)
896 # Unfortunately, this list must be maintained if new recursive targets are added
897 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
898 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
899 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
900 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
901 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
902 install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
903 unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS))
905 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
909 SD=$(PROJ_SRC_DIR)/$(@D); \
911 if [ ! -f $$SD/Makefile ]; then \
913 DD=$(notdir $(@D)); \
915 if ([ ! -f $$DD/Makefile ] || \
916 command test $$DD/Makefile -ot \
917 $$SD/Makefile ); then \
919 $(CP) $$SD/Makefile $$DD/Makefile; \
921 $(MAKE) -C $$DD $(subst $(@D)/.make,,$@)
924 #---------------------------------------------------------
925 # Handle the OPTIONAL_DIRS options for directores that may
927 #---------------------------------------------------------
930 SubDirs += $(OPTIONAL_DIRS)
932 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
933 $(RecursiveTargets)::
934 $(Verb) for dir in $(OPTIONAL_DIRS); do \
935 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
936 if ([ ! -f $$dir/Makefile ] || \
937 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
939 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
941 ($(MAKE) -C$$dir $@ ) || exit 1; \
945 $(RecursiveTargets)::
946 $(Verb) for dir in $(OPTIONAL_DIRS); do \
947 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
948 ($(MAKE) -C$$dir $@ ) || exit 1; \
954 #---------------------------------------------------------
955 # Handle the CONFIG_FILES options
956 #---------------------------------------------------------
961 $(Echo) Install circumvented with NO_INSTALL
963 $(Echo) UnInstall circumvented with NO_INSTALL
965 install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
966 $(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir)
967 $(Verb)for file in $(CONFIG_FILES); do \
968 if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
969 $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
970 elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
971 $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
973 $(ECHO) Error: cannot find config file $${file}. ; \
978 $(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
979 $(Verb)for file in $(CONFIG_FILES); do \
980 $(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
986 ###############################################################################
987 # Set up variables for building libraries
988 ###############################################################################
990 #---------------------------------------------------------
991 # Define various command line options pertaining to the
992 # libraries needed when linking. There are "Proj" libs
993 # (defined by the user's project) and "LLVM" libs (defined
994 # by the LLVM project).
995 #---------------------------------------------------------
998 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
999 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
1000 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
1001 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
1005 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
1006 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
1007 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
1008 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
1011 # Loadable module for Win32 requires all symbols resolved for linking.
1012 # Then all symbols in LLVM.dll will be available.
1013 ifeq ($(ENABLE_SHARED),1)
1014 ifdef LOADABLE_MODULE
1015 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
1016 LINK_COMPONENTS += all
1021 ifndef IS_CLEANING_TARGET
1022 ifdef LINK_COMPONENTS
1024 # If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make
1025 # clean in tools, then do a make in tools (instead of at the top level).
1027 @echo "*** llvm-config doesn't exist - rebuilding it."
1028 @$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config
1030 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
1032 ifeq ($(ENABLE_SHARED), 1)
1033 # We can take the "auto-import" feature to get rid of using dllimport.
1034 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1035 LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
1038 LLVMLibsOptions += -lLLVM-$(LLVMVersion)
1039 LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT)
1042 ifndef NO_LLVM_CONFIG
1043 LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)
1044 ifeq ($(LLVMConfigLibs),Error)
1045 $(error llvm-config --libs failed)
1047 LLVMLibsOptions += $(LLVMConfigLibs)
1048 LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error)
1049 ifeq ($(LLVMConfigLibfiles),Error)
1050 $(error llvm-config --libfiles failed)
1052 LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles)
1059 # Set up the library exports file.
1060 ifdef EXPORTED_SYMBOL_FILE
1062 # First, set up the native export file, which may differ from the source
1065 ifeq ($(HOST_OS),Darwin)
1066 # Darwin convention prefixes symbols with underscores.
1067 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed
1068 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1069 $(Verb) sed -e 's/^/_/' < $< > $@
1071 -$(Verb) $(RM) -f $(NativeExportsFile)
1073 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1074 # Gold and BFD ld require a version script rather than a plain list.
1075 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
1076 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1077 $(Verb) echo "{" > $@
1078 $(Verb) grep -q '[[:alnum:]_]' $< && echo " global:" >> $@ || :
1079 $(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@
1080 ifneq ($(HOST_OS),OpenBSD)
1081 $(Verb) echo " local: *;" >> $@
1083 $(Verb) echo "};" >> $@
1085 -$(Verb) $(RM) -f $(NativeExportsFile)
1087 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1088 # GNU ld Win32 accepts .DEF files that contain "DATA" entries.
1089 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def))
1090 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1091 $(Echo) Generating $(notdir $@)
1092 $(Verb) $(ECHO) "EXPORTS" > $@
1093 $(Verb) $(CAT) $< >> $@
1095 -$(Verb) $(RM) -f $(NativeExportsFile)
1097 # Default behavior: just use the exports file verbatim.
1098 NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
1103 # Now add the linker command-line options to use the native export file.
1106 ifeq ($(HOST_OS),Darwin)
1107 LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
1110 # gold, bfd ld, etc.
1111 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1112 LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
1116 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1117 # LLVMLibsOptions is invalidated at processing tools/llvm-shlib.
1118 SharedLinkOptions += $(NativeExportsFile)
1123 ###############################################################################
1124 # Library Build Rules: Four ways to build a library
1125 ###############################################################################
1127 #---------------------------------------------------------
1128 # Bytecode Module Targets:
1129 # If the user set MODULE_NAME then they want to build a
1130 # bytecode module from the sources. We compile all the
1131 # sources and link it together into a single bytecode
1133 #---------------------------------------------------------
1136 ifeq ($(strip $(LLVMCC)),)
1137 $(warning Modules require LLVM capable compiler but none is available ****)
1140 Module := $(LibDir)/$(MODULE_NAME).bc
1141 LinkModule := $(LLVMLINK)
1144 ifdef EXPORTED_SYMBOL_FILE
1145 LinkModule += -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1148 $(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(LLVMLINK)
1149 $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
1150 $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
1152 all-local:: $(Module)
1155 ifneq ($(strip $(Module)),)
1156 -$(Verb) $(RM) -f $(Module)
1159 ifdef BYTECODE_DESTINATION
1160 ModuleDestDir := $(BYTECODE_DESTINATION)
1162 ModuleDestDir := $(DESTDIR)$(PROJ_libdir)
1167 $(Echo) Install circumvented with NO_INSTALL
1169 $(Echo) Uninstall circumvented with NO_INSTALL
1171 DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
1173 install-module:: $(DestModule)
1174 install-local:: $(DestModule)
1176 $(DestModule): $(ModuleDestDir) $(Module)
1177 $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
1178 $(Verb) $(DataInstall) $(Module) $(DestModule)
1181 $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
1182 -$(Verb) $(RM) -f $(DestModule)
1188 # if we're building a library ...
1191 # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option
1192 LIBRARYNAME := $(strip $(LIBRARYNAME))
1193 ifdef LOADABLE_MODULE
1194 BaseLibName.A := $(LIBRARYNAME).a
1195 BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT)
1197 BaseLibName.A := lib$(LIBRARYNAME).a
1198 BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
1200 LibName.A := $(LibDir)/$(BaseLibName.A)
1201 LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
1202 LibName.O := $(LibDir)/$(LIBRARYNAME).o
1203 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
1205 #---------------------------------------------------------
1206 # Shared Library Targets:
1207 # If the user asked for a shared library to be built
1208 # with the SHARED_LIBRARY variable, then we provide
1209 # targets for building them.
1210 #---------------------------------------------------------
1211 ifdef SHARED_LIBRARY
1213 all-local:: $(LibName.SO)
1215 ifdef EXPORTED_SYMBOL_FILE
1216 $(LibName.SO): $(NativeExportsFile)
1219 ifdef LINK_LIBS_IN_SHARED
1220 ifdef LOADABLE_MODULE
1221 SharedLibKindMessage := "Loadable Module"
1222 SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions)
1224 SharedLibKindMessage := "Shared Library"
1226 $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
1227 $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
1229 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
1230 $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
1232 $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
1233 $(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
1234 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
1238 ifneq ($(strip $(LibName.SO)),)
1239 -$(Verb) $(RM) -f $(LibName.SO)
1244 $(Echo) Install circumvented with NO_INSTALL
1246 $(Echo) Uninstall circumvented with NO_INSTALL
1249 # Win32.DLL prefers to be located on the "PATH" of binaries.
1250 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1251 DestSharedLibDir := $(DESTDIR)$(PROJ_bindir)
1253 DestSharedLibDir := $(DESTDIR)$(PROJ_libdir)
1255 DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
1257 install-local:: $(DestSharedLib)
1259 $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir)
1260 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
1261 $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
1264 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
1265 -$(Verb) $(RM) -f $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME).*
1269 #---------------------------------------------------------
1270 # Bytecode Library Targets:
1271 # If the user asked for a bytecode library to be built
1272 # with the BYTECODE_LIBRARY variable, then we provide
1273 # targets for building them.
1274 #---------------------------------------------------------
1275 ifdef BYTECODE_LIBRARY
1276 ifeq ($(strip $(LLVMCC)),)
1277 $(warning Bytecode libraries require LLVM capable compiler but none is available ****)
1280 all-local:: $(LibName.BCA)
1282 ifdef EXPORTED_SYMBOL_FILE
1283 BCLinkLib = $(LLVMLINK) -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
1285 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLINK) \
1286 $(LLVMToolDir)/llvm-ar
1287 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
1289 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).internalize $(ObjectsBC)
1291 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).internalize.bc
1293 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
1294 $(LLVMToolDir)/llvm-ar
1295 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
1297 $(Verb) $(LArchive) $@ $(ObjectsBC)
1302 ifneq ($(strip $(LibName.BCA)),)
1303 -$(Verb) $(RM) -f $(LibName.BCA)
1306 ifdef BYTECODE_DESTINATION
1307 BytecodeDestDir := $(BYTECODE_DESTINATION)
1309 BytecodeDestDir := $(DESTDIR)$(PROJ_libdir)
1312 DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).bca
1314 install-bytecode-local:: $(DestBytecodeLib)
1318 $(Echo) Install circumvented with NO_INSTALL
1320 $(Echo) Uninstall circumvented with NO_INSTALL
1322 install-local:: $(DestBytecodeLib)
1324 $(DestBytecodeLib): $(LibName.BCA) $(BytecodeDestDir)
1325 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1326 $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
1329 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
1330 -$(Verb) $(RM) -f $(DestBytecodeLib)
1335 #---------------------------------------------------------
1337 # If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
1338 # building an archive.
1339 #---------------------------------------------------------
1340 ifndef NO_BUILD_ARCHIVE
1341 ifndef BUILD_ARCHIVE
1342 ifndef LOADABLE_MODULE
1348 #---------------------------------------------------------
1349 # Archive Library Targets:
1350 # If the user wanted a regular archive library built,
1351 # then we provide targets for building them.
1352 #---------------------------------------------------------
1355 all-local:: $(LibName.A)
1357 $(LibName.A): $(ObjectsO) $(LibDir)/.dir
1358 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
1359 -$(Verb) $(RM) -f $@
1360 $(Verb) $(Archive) $@ $(ObjectsO)
1361 $(Verb) $(Ranlib) $@
1364 ifneq ($(strip $(LibName.A)),)
1365 -$(Verb) $(RM) -f $(LibName.A)
1370 $(Echo) Install circumvented with NO_INSTALL
1372 $(Echo) Uninstall circumvented with NO_INSTALL
1374 ifdef NO_INSTALL_ARCHIVES
1376 $(Echo) Install circumvented with NO_INSTALL
1378 $(Echo) Uninstall circumvented with NO_INSTALL
1380 DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a
1382 install-local:: $(DestArchiveLib)
1384 $(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
1385 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
1386 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
1387 $(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
1390 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
1391 -$(Verb) $(RM) -f $(DestArchiveLib)
1399 ###############################################################################
1400 # Tool Build Rules: Build executable tool based on TOOLNAME option
1401 ###############################################################################
1405 #---------------------------------------------------------
1406 # Set up variables for building a tool.
1407 #---------------------------------------------------------
1408 TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
1410 ToolBuildPath := $(ExmplDir)/$(TOOLEXENAME)
1412 ToolBuildPath := $(ToolDir)/$(TOOLEXENAME)
1415 # TOOLALIAS is a name to symlink (or copy) the tool to.
1418 ToolAliasBuildPath := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1420 ToolAliasBuildPath := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1424 #---------------------------------------------------------
1426 #---------------------------------------------------------
1428 # If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
1429 # not exporting all of the weak symbols from the binary. This reduces dyld
1430 # startup time by 4x on darwin in some cases.
1431 ifdef TOOL_NO_EXPORTS
1432 ifeq ($(HOST_OS),Darwin)
1434 # Tiger tools don't support this.
1435 ifneq ($(DARWIN_MAJVERS),4)
1436 LD.Flags += -Wl,-exported_symbol,_main
1440 ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU))
1441 ifneq ($(ARCH), Mips)
1442 LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
1447 #---------------------------------------------------------
1448 # Tool Order File Support
1449 #---------------------------------------------------------
1451 ifeq ($(HOST_OS),Darwin)
1452 ifdef TOOL_ORDER_FILE
1454 LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
1459 #---------------------------------------------------------
1460 # Tool Version Info Support
1461 #---------------------------------------------------------
1463 ifeq ($(HOST_OS),Darwin)
1464 ifdef TOOL_INFO_PLIST
1466 LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST)
1468 $(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST)
1470 $(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir
1471 $(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..."
1472 $(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \
1473 -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \
1474 -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \
1475 -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \
1481 #---------------------------------------------------------
1482 # Provide targets for building the tools
1483 #---------------------------------------------------------
1484 all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
1487 ifneq ($(strip $(ToolBuildPath)),)
1488 -$(Verb) $(RM) -f $(ToolBuildPath)
1490 ifneq ($(strip $(ToolAliasBuildPath)),)
1491 -$(Verb) $(RM) -f $(ToolAliasBuildPath)
1495 $(ToolBuildPath): $(ExmplDir)/.dir
1497 $(ToolBuildPath): $(ToolDir)/.dir
1500 ifdef CODESIGN_TOOLS
1501 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1502 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1503 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1504 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1505 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1507 $(Echo) ======= Code-Signing $(BuildMode) Executable $(TOOLNAME)
1508 $(Verb) codesign -s - $@
1510 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1511 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1512 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1513 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1514 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1518 ifneq ($(strip $(ToolAliasBuildPath)),)
1519 $(ToolAliasBuildPath): $(ToolBuildPath)
1520 $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
1521 $(Verb) $(RM) -f $(ToolAliasBuildPath)
1522 $(Verb) $(AliasTool) $(TOOLEXENAME) $(ToolAliasBuildPath)
1523 $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
1529 $(Echo) Install circumvented with NO_INSTALL
1531 $(Echo) Uninstall circumvented with NO_INSTALL
1535 ToolBinDir = $(DESTDIR)$(PROJ_internal_prefix)/bin
1537 ToolBinDir = $(DESTDIR)$(PROJ_bindir)
1539 DestTool = $(ToolBinDir)/$(TOOLEXENAME)
1541 install-local:: $(DestTool)
1543 $(DestTool): $(ToolBuildPath)
1544 $(Echo) Installing $(BuildMode) $(DestTool)
1545 $(Verb) $(MKDIR) $(ToolBinDir)
1546 $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
1549 $(Echo) Uninstalling $(BuildMode) $(DestTool)
1550 -$(Verb) $(RM) -f $(DestTool)
1552 # TOOLALIAS install.
1554 DestToolAlias = $(ToolBinDir)/$(TOOLALIAS)$(EXEEXT)
1556 install-local:: $(DestToolAlias)
1558 $(DestToolAlias): $(DestTool)
1559 $(Echo) Installing $(BuildMode) $(DestToolAlias)
1560 $(Verb) $(RM) -f $(DestToolAlias)
1561 $(Verb) $(AliasTool) $(TOOLEXENAME) $(DestToolAlias)
1564 $(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
1565 -$(Verb) $(RM) -f $(DestToolAlias)
1571 ###############################################################################
1572 # Object Build Rules: Build object files based on sources
1573 ###############################################################################
1575 # FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
1576 ifeq ($(HOST_OS),HP-UX)
1577 DISABLE_AUTO_DEPENDENCIES=1
1580 # Provide rule sets for when dependency generation is enabled
1581 ifndef DISABLE_AUTO_DEPENDENCIES
1583 #---------------------------------------------------------
1584 # Create .o files in the ObjDir directory from the .cpp and .c files...
1585 #---------------------------------------------------------
1587 DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
1588 -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
1590 # If the build succeeded, move the dependency file over, otherwise
1592 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
1593 else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
1595 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1596 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1597 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1600 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1601 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1602 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1605 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1606 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1607 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1610 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1611 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1612 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1615 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1616 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1617 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1620 #---------------------------------------------------------
1621 # Create .bc files in the ObjDir directory from .cpp .cc and .c files...
1622 #---------------------------------------------------------
1624 BC_DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.bc.d.tmp" \
1625 -MT "$(ObjDir)/$*.ll" -MT "$(ObjDir)/$*.bc.d"
1627 # If the build succeeded, move the dependency file over, otherwise
1629 BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d"; \
1630 else $(RM) "$(ObjDir)/$*.bc.d.tmp"; exit 1; fi
1632 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1633 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1634 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1635 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1636 $(BC_DEPEND_MOVEFILE)
1638 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1639 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1640 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1641 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1642 $(BC_DEPEND_MOVEFILE)
1644 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1645 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1646 $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
1647 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1648 $(BC_DEPEND_MOVEFILE)
1650 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1651 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1652 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1653 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1654 $(BC_DEPEND_MOVEFILE)
1656 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1657 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1658 $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
1659 $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
1660 $(BC_DEPEND_MOVEFILE)
1662 # Provide alternate rule sets if dependencies are disabled
1665 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1666 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1667 $(Compile.CXX) $< -o $@
1669 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1670 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1671 $(Compile.CXX) $< -o $@
1673 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1674 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1675 $(Compile.CXX) $< -o $@
1677 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1678 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1679 $(Compile.C) $< -o $@
1681 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1682 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1683 $(Compile.C) $< -o $@
1685 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1686 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
1687 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1689 $(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1690 $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
1691 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1693 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
1694 $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
1695 $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1697 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1698 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
1699 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1701 $(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
1702 $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
1703 $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
1708 ## Rules for building preprocessed (.i/.ii) outputs.
1709 $(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1710 $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
1711 $(Verb) $(Preprocess.CXX) $< -o $@
1713 $(BuildMode)/%.ii: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1714 $(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file"
1715 $(Verb) $(Preprocess.CXX) $< -o $@
1717 $(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1718 $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
1719 $(Verb) $(Preprocess.CXX) $< -o $@
1721 $(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1722 $(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
1723 $(Verb) $(Preprocess.C) $< -o $@
1725 $(BuildMode)/%.i: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1726 $(Echo) "Compiling $*.m for $(BuildMode) build to .i file"
1727 $(Verb) $(Preprocess.C) $< -o $@
1730 $(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1731 $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
1732 $(Compile.CXX) $< -o $@ -S
1734 $(ObjDir)/%.s: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1735 $(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG)
1736 $(Compile.CXX) $< -o $@ -S
1738 $(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1739 $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
1740 $(Compile.CXX) $< -o $@ -S
1742 $(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1743 $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
1744 $(Compile.C) $< -o $@ -S
1746 $(ObjDir)/%.s: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1747 $(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG)
1748 $(Compile.C) $< -o $@ -S
1751 # make the C and C++ compilers strip debug info out of bytecode libraries.
1753 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1754 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1755 $(Verb) $(LOPT) $< -std-compile-opts -o $@
1757 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT)
1758 $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
1759 $(Verb) $(LOPT) $< -std-compile-opts -strip-debug -o $@
1763 #---------------------------------------------------------
1764 # Provide rule to build .bc files from .ll sources,
1765 # regardless of dependencies
1766 #---------------------------------------------------------
1767 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
1768 $(Echo) "Compiling $*.ll for $(BuildMode) build"
1769 $(Verb) $(LLVMAS) $< -f -o $@
1771 ###############################################################################
1772 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
1773 ###############################################################################
1776 TABLEGEN_INC_FILES_COMMON = 1
1779 ifdef TABLEGEN_INC_FILES_COMMON
1781 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
1782 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1783 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
1785 # INCFiles rule: All of the tblgen generated files are emitted to
1786 # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
1787 # us to only "touch" the real file if the contents of it change. IOW, if
1788 # tblgen is modified, all of the .inc.tmp files are regenerated, but no
1789 # dependencies of the .inc files are, unless the contents of the .inc file
1791 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
1792 $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
1794 endif # TABLEGEN_INC_FILES_COMMON
1798 TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
1799 $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \
1800 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \
1801 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \
1802 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \
1803 $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
1804 $(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td)
1806 # All .inc.tmp files depend on the .td files.
1807 $(INCTMPFiles) : $(TDFiles)
1809 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1810 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1811 $(Echo) "Building $(<F) register info implementation with tblgen"
1812 $(Verb) $(LLVMTableGen) -gen-register-info -o $(call SYSPATH, $@) $<
1814 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1815 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1816 $(Echo) "Building $(<F) instruction information with tblgen"
1817 $(Verb) $(LLVMTableGen) -gen-instr-info -o $(call SYSPATH, $@) $<
1819 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1820 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1821 $(Echo) "Building $(<F) assembly writer with tblgen"
1822 $(Verb) $(LLVMTableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
1824 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1825 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1826 $(Echo) "Building $(<F) assembly writer #1 with tblgen"
1827 $(Verb) $(LLVMTableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
1829 $(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
1830 $(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1831 $(Echo) "Building $(<F) assembly matcher with tblgen"
1832 $(Verb) $(LLVMTableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
1834 $(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \
1835 $(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1836 $(Echo) "Building $(<F) MC code emitter with tblgen"
1837 $(Verb) $(LLVMTableGen) -gen-emitter -mc-emitter -o $(call SYSPATH, $@) $<
1839 $(TARGET:%=$(ObjDir)/%GenMCPseudoLowering.inc.tmp): \
1840 $(ObjDir)/%GenMCPseudoLowering.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1841 $(Echo) "Building $(<F) MC Pseudo instruction expander with tblgen"
1842 $(Verb) $(LLVMTableGen) -gen-pseudo-lowering -o $(call SYSPATH, $@) $<
1844 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1845 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1846 $(Echo) "Building $(<F) code emitter with tblgen"
1847 $(Verb) $(LLVMTableGen) -gen-emitter -o $(call SYSPATH, $@) $<
1849 $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
1850 $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1851 $(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
1852 $(Verb) $(LLVMTableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
1854 $(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \
1855 $(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1856 $(Echo) "Building $(<F) disassembly tables with tblgen"
1857 $(Verb) $(LLVMTableGen) -gen-disassembler -o $(call SYSPATH, $@) $<
1859 $(TARGET:%=$(ObjDir)/%GenEDInfo.inc.tmp): \
1860 $(ObjDir)/%GenEDInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1861 $(Echo) "Building $(<F) enhanced disassembly information with tblgen"
1862 $(Verb) $(LLVMTableGen) -gen-enhanced-disassembly-info -o $(call SYSPATH, $@) $<
1864 $(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
1865 $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1866 $(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
1867 $(Verb) $(LLVMTableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
1869 $(TARGET:%=$(ObjDir)/%GenSubtargetInfo.inc.tmp): \
1870 $(ObjDir)/%GenSubtargetInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1871 $(Echo) "Building $(<F) subtarget information with tblgen"
1872 $(Verb) $(LLVMTableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
1874 $(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
1875 $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1876 $(Echo) "Building $(<F) calling convention information with tblgen"
1877 $(Verb) $(LLVMTableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
1879 $(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
1880 $(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1881 $(Echo) "Building $(<F) intrinsics information with tblgen"
1882 $(Verb) $(LLVMTableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
1884 $(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1885 $(Echo) "Building $(<F) decoder tables with tblgen"
1886 $(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $<
1888 $(ObjDir)/%GenDFAPacketizer.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1889 $(Echo) "Building $(<F) DFA packetizer tables with tblgen"
1890 $(Verb) $(LLVMTableGen) -gen-dfa-packetizer -o $(call SYSPATH, $@) $<
1893 -$(Verb) $(RM) -f $(INCFiles)
1897 ###############################################################################
1898 # OTHER RULES: Other rules needed
1899 ###############################################################################
1901 # To create postscript files from dot files...
1902 ifneq ($(DOT),false)
1904 $(DOT) -Tps < $< > $@
1907 $(Echo) "Cannot build $@: The program dot is not installed"
1910 # This rules ensures that header files that are removed still have a rule for
1911 # which they can be "generated." This allows make to ignore them and
1912 # reproduce the dependency lists.
1916 # Define clean-local to clean the current directory. Note that this uses a
1917 # very conservative approach ensuring that empty variables do not cause
1918 # errors or disastrous removal.
1920 ifneq ($(strip $(ObjRootDir)),)
1921 -$(Verb) $(RM) -rf $(ObjRootDir)
1923 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1924 -$(Verb) $(RM) -f *$(SHLIBEXT)
1928 -$(Verb) $(RM) -rf Debug Release Profile
1931 ###############################################################################
1932 # DEPENDENCIES: Include the dependency files if we should
1933 ###############################################################################
1934 ifndef DISABLE_AUTO_DEPENDENCIES
1936 # If its not one of the cleaning targets
1937 ifndef IS_CLEANING_TARGET
1939 # Get the list of dependency files
1940 DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources)))
1941 DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
1943 # Include bitcode dependency files if using bitcode libraries
1944 ifdef BYTECODE_LIBRARY
1945 DependFiles += $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.bc.d)
1948 -include $(DependFiles) ""
1954 ###############################################################################
1955 # CHECK: Running the test suite
1956 ###############################################################################
1959 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1960 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1961 $(EchoCmd) Running test suite ; \
1962 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
1963 TESTSUITE=$(TESTSUITE) ; \
1965 $(EchoCmd) No Makefile in test directory ; \
1968 $(EchoCmd) No test directory ; \
1971 # An alias dating from when both lit and DejaGNU test runners were used.
1975 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1976 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1977 $(EchoCmd) Running test suite ; \
1978 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \
1980 $(EchoCmd) No Makefile in test directory ; \
1983 $(EchoCmd) No test directory ; \
1986 ###############################################################################
1987 # UNITTESTS: Running the unittests test suite
1988 ###############################################################################
1991 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
1992 if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
1993 $(EchoCmd) Running unittests test suite ; \
1994 $(MAKE) -C $(PROJ_OBJ_ROOT)/unittests unitcheck; \
1996 $(EchoCmd) No Makefile in unittests directory ; \
1999 $(EchoCmd) No unittests directory ; \
2002 ###############################################################################
2003 # DISTRIBUTION: Handle construction of a distribution tarball
2004 ###############################################################################
2006 #------------------------------------------------------------------------
2007 # Define distribution related variables
2008 #------------------------------------------------------------------------
2009 DistName := $(PROJECT_NAME)-$(PROJ_VERSION)
2010 DistDir := $(PROJ_OBJ_ROOT)/$(DistName)
2011 TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName)
2012 DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
2013 DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip
2014 DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
2015 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
2016 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
2017 Makefile.config.in configure autoconf
2018 DistOther := $(notdir $(wildcard \
2019 $(PROJ_SRC_DIR)/*.h \
2020 $(PROJ_SRC_DIR)/*.td \
2021 $(PROJ_SRC_DIR)/*.def \
2022 $(PROJ_SRC_DIR)/*.ll \
2023 $(PROJ_SRC_DIR)/*.in))
2024 DistSubDirs := $(SubDirs)
2025 DistSources = $(Sources) $(EXTRA_DIST)
2026 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
2028 #------------------------------------------------------------------------
2029 # We MUST build distribution with OBJ_DIR != SRC_DIR
2030 #------------------------------------------------------------------------
2031 ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
2032 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
2033 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
2037 #------------------------------------------------------------------------
2038 # Prevent attempt to run dist targets from anywhere but the top level
2039 #------------------------------------------------------------------------
2041 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
2042 $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
2045 #------------------------------------------------------------------------
2046 # Provide the top level targets
2047 #------------------------------------------------------------------------
2049 dist-gzip:: $(DistTarGZip)
2051 $(DistTarGZip) : $(TopDistDir)/.makedistdir
2052 $(Echo) Packing gzipped distribution tar file.
2053 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
2054 $(GZIP) -c > "$(DistTarGZip)"
2056 dist-bzip2:: $(DistTarBZ2)
2058 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
2059 $(Echo) Packing bzipped distribution tar file.
2060 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
2061 $(BZIP2) -c >$(DistTarBZ2)
2063 dist-zip:: $(DistZip)
2065 $(DistZip) : $(TopDistDir)/.makedistdir
2066 $(Echo) Packing zipped distribution file.
2067 $(Verb) rm -f $(DistZip)
2068 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
2070 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
2071 $(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL =====
2073 DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
2075 dist-check:: $(DistTarGZip)
2076 $(Echo) Checking distribution tar file.
2077 $(Verb) if test -d $(DistCheckDir) ; then \
2078 $(RM) -rf $(DistCheckDir) ; \
2080 $(Verb) $(MKDIR) $(DistCheckDir)
2081 $(Verb) cd $(DistCheckDir) && \
2082 $(MKDIR) $(DistCheckDir)/build && \
2083 $(MKDIR) $(DistCheckDir)/install && \
2084 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
2086 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
2087 --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
2090 $(MAKE) unittests && \
2091 $(MAKE) install && \
2092 $(MAKE) uninstall && \
2093 $(MAKE) dist-clean && \
2094 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
2097 $(Echo) Cleaning distribution files
2098 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
2103 #------------------------------------------------------------------------
2104 # Provide the recursive distdir target for building the distribution directory
2105 #------------------------------------------------------------------------
2106 distdir: $(DistDir)/.makedistdir
2107 $(DistDir)/.makedistdir: $(DistSources)
2108 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2109 if test -d "$(DistDir)" ; then \
2110 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
2113 $(EchoCmd) Removing old $(DistDir) ; \
2114 $(RM) -rf $(DistDir); \
2115 $(EchoCmd) Making 'all' to verify build ; \
2116 $(MAKE) ENABLE_OPTIMIZED=1 all ; \
2118 $(Echo) Building Distribution Directory $(DistDir)
2119 $(Verb) $(MKDIR) $(DistDir)
2120 $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
2121 srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
2122 for file in $(DistFiles) ; do \
2124 $(PROJ_SRC_DIR)/*) \
2125 file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
2127 $(PROJ_SRC_ROOT)/*) \
2128 file=`echo "$$file" | \
2129 sed "s#^$$srcrootstrip/##"` \
2132 if test -f "$(PROJ_SRC_DIR)/$$file" || \
2133 test -d "$(PROJ_SRC_DIR)/$$file" ; then \
2134 from_dir="$(PROJ_SRC_DIR)" ; \
2135 elif test -f "$$file" || test -d "$$file" ; then \
2138 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
2139 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
2140 to_dir="$(DistDir)/$$dir"; \
2141 $(MKDIR) "$$to_dir" ; \
2143 to_dir="$(DistDir)"; \
2145 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
2146 if test -n "$$mid_dir" ; then \
2147 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
2149 if test -d "$$from_dir/$$file"; then \
2150 if test -d "$(PROJ_SRC_DIR)/$$file" && \
2151 test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
2152 cd $(PROJ_SRC_DIR) ; \
2153 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2154 ( cd $$to_dir ; $(TAR) xf - ) ; \
2155 cd $(PROJ_OBJ_DIR) ; \
2158 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
2159 ( cd $$to_dir ; $(TAR) xf - ) ; \
2160 cd $(PROJ_OBJ_DIR) ; \
2162 elif test -f "$$from_dir/$$file" ; then \
2163 $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
2164 elif test -L "$$from_dir/$$file" ; then \
2165 $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
2166 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
2167 $(EchoCmd) "===== WARNING: Distribution Source " \
2168 "$$from_dir/$$file Not Found!" ; \
2169 elif test "$(Verb)" != '@' ; then \
2170 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
2173 $(Verb) for subdir in $(DistSubDirs) ; do \
2174 if test "$$subdir" \!= "." ; then \
2175 new_distdir="$(DistDir)/$$subdir" ; \
2176 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
2177 ( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
2178 DistDir="$$new_distdir" distdir ) || exit 1; \
2181 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2182 $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
2183 $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
2184 -name .svn \) -print` ;\
2185 $(MAKE) dist-hook ; \
2186 $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
2187 -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
2188 -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
2189 -o ! -type d ! -perm -444 -exec \
2190 $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
2191 || chmod -R a+r $(DistDir) ; \
2194 # This is invoked by distdir target, define it as a no-op to avoid errors if not
2200 ###############################################################################
2201 # TOP LEVEL - targets only to apply at the top level directory
2202 ###############################################################################
2206 #------------------------------------------------------------------------
2207 # Install support for the project's include files:
2208 #------------------------------------------------------------------------
2211 $(Echo) Install circumvented with NO_INSTALL
2213 $(Echo) Uninstall circumvented with NO_INSTALL
2216 $(Echo) Installing include files
2217 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
2218 $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
2219 cd $(PROJ_SRC_ROOT)/include && \
2220 for hdr in `find . -type f \
2221 '(' -name LICENSE.TXT \
2226 ')' -print | grep -v CVS | \
2227 grep -v .svn` ; do \
2228 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2229 if test \! -d "$$instdir" ; then \
2230 $(EchoCmd) Making install directory $$instdir ; \
2231 $(MKDIR) $$instdir ;\
2233 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2236 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
2237 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
2238 cd $(PROJ_OBJ_ROOT)/include && \
2239 for hdr in `find . -type f \
2240 '(' -name LICENSE.TXT \
2245 ')' -print | grep -v CVS | \
2246 grep -v .svn` ; do \
2247 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2248 if test \! -d "$$instdir" ; then \
2249 $(EchoCmd) Making install directory $$instdir ; \
2250 $(MKDIR) $$instdir ;\
2252 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2258 $(Echo) Uninstalling include files
2259 $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
2260 cd $(PROJ_SRC_ROOT)/include && \
2261 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
2262 '!' '(' -name '*~' -o -name '.#*' \
2263 -o -name '*.in' ')' -print ')' | \
2264 grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2265 cd $(PROJ_SRC_ROOT)/include && \
2266 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
2267 -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2273 @echo searching for overlength lines in files: $(Sources)
2276 egrep -n '.{81}' $(Sources) /dev/null
2279 @echo searching for tabs in files: $(Sources)
2282 egrep -n ' ' $(Sources) /dev/null
2285 @ls -l $(LibDir) | awk '\
2286 BEGIN { sum = 0; } \
2288 END { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2289 @ls -l $(ToolDir) | awk '\
2290 BEGIN { sum = 0; } \
2292 END { printf("Programs: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2293 #------------------------------------------------------------------------
2294 # Print out the directories used for building
2295 #------------------------------------------------------------------------
2297 $(Echo) "BuildMode : " '$(BuildMode)'
2298 $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
2299 $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
2300 $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
2301 $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
2302 $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
2303 $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
2304 $(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
2305 $(Echo) "PROJ_internal_prefix : " '$(PROJ_internal_prefix)'
2306 $(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
2307 $(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
2308 $(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
2309 $(Echo) "PROJ_includedir : " '$(PROJ_includedir)'
2310 $(Echo) "UserTargets : " '$(UserTargets)'
2311 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
2312 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
2313 $(Echo) "ObjDir : " '$(ObjDir)'
2314 $(Echo) "LibDir : " '$(LibDir)'
2315 $(Echo) "ToolDir : " '$(ToolDir)'
2316 $(Echo) "ExmplDir : " '$(ExmplDir)'
2317 $(Echo) "Sources : " '$(Sources)'
2318 $(Echo) "TDFiles : " '$(TDFiles)'
2319 $(Echo) "INCFiles : " '$(INCFiles)'
2320 $(Echo) "INCTMPFiles : " '$(INCTMPFiles)'
2321 $(Echo) "PreConditions: " '$(PreConditions)'
2322 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
2323 $(Echo) "Compile.C : " '$(Compile.C)'
2324 $(Echo) "Archive : " '$(Archive)'
2325 $(Echo) "YaccFiles : " '$(YaccFiles)'
2326 $(Echo) "LexFiles : " '$(LexFiles)'
2327 $(Echo) "Module : " '$(Module)'
2328 $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
2329 $(Echo) "SubDirs : " '$(SubDirs)'
2330 $(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
2331 $(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
2336 # General debugging rule, use 'make dbg-print-XXX' to print the
2337 # definition, value and origin of XXX.
2339 $(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))