1 #===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===#
3 # The LLVM Compiler Infrastructure
5 # This file was developed by the LLVM research group and is distributed under
6 # the University of Illinois Open Source 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
23 LocalTargets := all-local clean-local clean-all-local \
24 install-local printvars uninstall-local \
25 install-bytecode-local
26 TopLevelTargets := dist dist-check dist-clean tags dist-gzip dist-bzip2 \
28 UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
29 InternalTargets := preconditions distdir dist-hook
31 ################################################################################
32 # INITIALIZATION: Basic things the makefile needs
33 ################################################################################
35 #--------------------------------------------------------------------
36 # Set the VPATH so that we can find source files.
37 #--------------------------------------------------------------------
38 VPATH=$(BUILD_SRC_DIR)
40 #--------------------------------------------------------------------
41 # Reset the list of suffixes we know how to build
42 #--------------------------------------------------------------------
44 .SUFFIXES: .c .cpp .h .hpp .y .l .lo .o .a .bc .td .ps .dot
45 .SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
47 #--------------------------------------------------------------------
48 # Mark all of these targets as phony to avoid implicit rule search
49 #--------------------------------------------------------------------
50 .PHONY: $(UserTargets) $(InternalTargets)
52 #--------------------------------------------------------------------
53 # Make sure all the user-target rules are double colon rules and
54 # they are defined first.
55 #--------------------------------------------------------------------
59 ################################################################################
60 # PRECONDITIONS: that which must be built/checked first
61 ################################################################################
63 SrcMakefiles := $(filter %Makefile %Makefile.tests,\
64 $(wildcard $(BUILD_SRC_DIR)/Makefile*))
65 ObjMakefiles := $(subst $(BUILD_SRC_DIR),$(BUILD_OBJ_DIR),$(SrcMakefiles))
66 ConfigureScript := $(LLVM_SRC_ROOT)/configure
67 ConfigStatusScript := $(LLVM_OBJ_ROOT)/config.status
68 MakefileConfigIn := $(LLVM_SRC_ROOT)/Makefile.config.in
69 MakefileConfig := $(LLVM_OBJ_ROOT)/Makefile.config
70 PreConditions := $(ConfigStatusScript) $(MakefileConfig) $(ObjMakefiles)
72 preconditions : $(PreConditions)
74 #------------------------------------------------------------------------
75 # Make sure the BUILT_SOURCES are built first
76 #------------------------------------------------------------------------
77 $(filter-out clean clean-local,UserTargets):: $(BUILT_SOURCES)
80 ifneq ($(strip $(BUILT_SOURCES)),)
81 -$(Verb) $(RM) -f $(BUILT_SOURCES)
84 $(BUILT_SOURCES) : $(ObjMakefiles)
86 #------------------------------------------------------------------------
87 # Make sure we're not using a stale configuration
88 #------------------------------------------------------------------------
89 .PRECIOUS: $(ConfigStatusScript)
90 $(ConfigStatusScript): $(ConfigureScript)
91 $(Echo) Reconfiguring with $<
92 $(Verb) cd $(BUILD_OBJ_ROOT) && \
93 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
96 #------------------------------------------------------------------------
97 # Make sure the configuration makefile is up to date
98 #------------------------------------------------------------------------
99 $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
100 $(Echo) Regenerating $@
101 $(Verb) cd $(LLVM_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
103 #------------------------------------------------------------------------
104 # If the Makefile in the source tree has been updated, copy it over into the
105 # build tree. But, only do this if the source and object makefiles differ
106 #------------------------------------------------------------------------
107 ifneq ($(BUILD_OBJ_DIR),$(BUILD_SRC_DIR))
109 Makefile: $(BUILD_SRC_DIR)/Makefile
110 $(Echo) "Updating Makefile"
111 $(Verb) $(MKDIR) $(@D)
114 # Copy the Makefile.* files unless we're in the root directory which avoids
115 # the copying of Makefile.config.in or other things that should be explicitly
117 $(BUILD_OBJ_DIR)/Makefile% : $(BUILD_SRC_DIR)/Makefile%
119 *Makefile.rules) ;; \
121 *) $(Echo) "Updating $(@F)" ; \
128 #------------------------------------------------------------------------
129 # Set up the basic dependencies
130 #------------------------------------------------------------------------
131 $(UserTargets):: $(PreConditions)
135 clean-all:: clean-local clean-all-local
136 install:: install-local
137 uninstall:: uninstall-local
138 install-local:: all-local
139 install-bytecode:: install-bytecode-local
141 ###############################################################################
142 # VARIABLES: Set up various variables based on configuration data
143 ###############################################################################
145 #--------------------------------------------------------------------
146 # Variables derived from configuration we are building
147 #--------------------------------------------------------------------
149 ifdef ENABLE_PROFILING
151 CXX.Flags := -O3 -DNDEBUG -felide-constructors -finline-functions -pg
152 C.Flags := -O3 -DNDEBUG -pg
153 LD.Flags := -O3 -DNDEBUG -pg
155 ifdef ENABLE_OPTIMIZED
157 CXX.Flags := -O3 -DNDEBUG -finline-functions -felide-constructors -fomit-frame-pointer
158 C.Flags := -O3 -DNDEBUG -fomit-frame-pointer
159 LD.Flags := -O3 -DNDEBUG
162 CXX.Flags := -g -D_DEBUG
163 C.Flags := -g -D_DEBUG
164 LD.Flags := -g -D_DEBUG
169 CXX.Flags += $(CXXFLAGS)
171 CPP.Flags += $(CPPFLAGS)
172 LD.Flags += $(LDFLAGS)
174 LibTool.Flags := --tag=CXX
176 #--------------------------------------------------------------------
177 # Directory locations
178 #--------------------------------------------------------------------
179 ObjDir := $(BUILD_OBJ_DIR)/$(BuildMode)
180 LibDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/lib
181 ToolDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/bin
182 ExmplDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/examples
183 LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
184 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
185 LExmplDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
187 #--------------------------------------------------------------------
188 # Full Paths To Compiled Tools and Utilities
189 #--------------------------------------------------------------------
190 EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
193 LIBTOOL := $(LLVM_OBJ_ROOT)/mklib
196 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
199 BURG := $(LLVMToolDir)/burg$(EXEEXT)
202 TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT)
205 GCCAS := $(LLVMToolDir)/gccas$(EXEEXT)
208 GCCLD := $(LLVMToolDir)/gccld$(EXEEXT)
211 LLVMGCC := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/gcc
214 LLVMGXX := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/g++
217 # Need a better way to compute this.
218 LLVMGCCLibDir := $(dir $(shell $(LLVMGCC) -print-file-name=libgcc.a))/
220 #--------------------------------------------------------------------
221 # Adjust to user's request
222 #--------------------------------------------------------------------
224 # Adjust LIBTOOL flags for shared libraries, or not.
225 ifndef SHARED_LIBRARY
226 LibTool.Flags += --tag=disable-shared
228 LD.Flags += -rpath $(LibDir)
239 # Adjust settings for verbose mode
242 LibTool.Flags += --silent
243 AR.Flags += >/dev/null 2>/dev/null
244 ConfigureScriptFLAGS += >$(BUILD_OBJ_DIR)/configure.out 2>&1
246 ConfigureScriptFLAGS :=
249 # By default, strip symbol information from executable
251 Strip := $(PLATFORMSTRIPOPTS)
252 StripWarnMsg := "(without symbols)"
255 # Adjust linker flags for building an executable
258 LD.Flags += -rpath $(ExmplDir) -export-dynamic
260 LD.Flags += -rpath $(ToolDir) -export-dynamic
264 #----------------------------------------------------------
265 # Options To Invoke Tools
266 #----------------------------------------------------------
268 CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
270 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
271 CPP.Flags += -I$(BUILD_OBJ_DIR) \
273 -I$(BUILD_SRC_ROOT)/include \
274 -I$(BUILD_OBJ_ROOT)/include \
275 -I$(LLVM_OBJ_ROOT)/include \
276 -I$(LLVM_SRC_ROOT)/include \
277 -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
279 Compile.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags)
280 LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
281 BCCompile.C = $(LLVMGCC) $(CPP.Flags) $(CompileCommonOpts) $(C.Flags) -c
282 Compile.CXX = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
283 LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
284 BCCompile.CXX = $(LLVMGXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
285 Link = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
286 $(CompileCommonOpts) $(LD.Flags) $(Strip)
287 Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
289 LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL)
290 Burg = $(BURG) -I $(BUILD_SRC_DIR)
291 TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR)
292 Archive = $(AR) $(AR.Flags)
293 LArchive = $(LLVMToolDir)/llvm-ar rcsf
300 #----------------------------------------------------------
301 # Get the list of source files
302 #----------------------------------------------------------
304 Sources := $(notdir $(wildcard $(BUILD_SRC_DIR)/*.cpp \
305 $(BUILD_SRC_DIR)/*.cc $(BUILD_SRC_DIR)/*.c $(BUILD_SRC_DIR)/*.y \
306 $(BUILD_SRC_DIR)/*.l))
308 Sources := $(SOURCES)
312 Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
315 #----------------------------------------------------------
316 # Types of objects that can be built from sources
317 #----------------------------------------------------------
318 BaseNameSources := $(sort $(basename $(Sources)))
319 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
320 ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
321 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
323 ###############################################################################
324 # DIRECTORIES: Handle recursive descent of directory structure
325 ###############################################################################
327 #---------------------------------------------------------
328 # Provide rules to make install dirs. This must be early
329 # in the file so they get built before dependencies
330 #---------------------------------------------------------
333 $(Verb) $(MKDIR) $(bindir)
336 $(Verb) $(MKDIR) $(libdir)
339 $(Verb) $(MKDIR) $(bytecode_libdir)
342 $(Verb) $(MKDIR) $(sysconfdir)
344 # To create other directories, as needed, and timestamp their creation
346 $(Verb) $(MKDIR) $* > /dev/null
349 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
350 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
352 #---------------------------------------------------------
353 # Handle the DIRS options for sequential construction
354 #---------------------------------------------------------
359 $(RecursiveTargets)::
360 $(Verb) for dir in $(DIRS); do \
361 if [ ! -f $$dir/Makefile ]; then \
363 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
365 ($(MAKE) -C $$dir $@ ) || exit 1; \
369 #---------------------------------------------------------
370 # Handle the EXPERIMENTAL_DIRS options ensuring success
371 # after each directory is built.
372 #---------------------------------------------------------
373 ifdef EXPERIMENTAL_DIRS
374 $(RecursiveTargets)::
375 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
376 if [ ! -f $$dir/Makefile ]; then \
378 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
380 ($(MAKE) -C $$dir $@ ) || exit 0; \
384 #---------------------------------------------------------
385 # Handle the PARALLEL_DIRS options for parallel construction
386 #---------------------------------------------------------
389 SubDirs += $(PARALLEL_DIRS)
391 # Unfortunately, this list must be maintained if new recursive targets are added
392 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
393 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
394 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
395 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
396 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
397 install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
399 Parallel_Targets := $(foreach T,$(RecursiveTargets),%/.make$(T))
401 $(Parallel_Targets) :
402 $(Verb) if [ ! -f $(@D)/Makefile ]; then \
404 cp $(BUILD_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
406 $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
409 #---------------------------------------------------------
410 # Handle the OPTIONAL_DIRS options for directores that may
412 #---------------------------------------------------------
415 SubDirs += $(OPTIONAL_DIRS)
417 $(RecursiveTargets)::
418 $(Verb) for dir in $(OPTIONAL_DIRS); do \
419 if [ -d $(BUILD_SRC_DIR)/$$dir ]; then\
420 if [ ! -f $$dir/Makefile ]; then \
422 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
424 ($(MAKE) -C$$dir $@ ) || exit 1; \
429 #---------------------------------------------------------
430 # Handle the CONFIG_FILES options
431 #---------------------------------------------------------
434 install-local:: $(sysconfdir) $(CONFIG_FILES)
435 $(Echo) Installing Configuration Files To $(sysconfdir)
436 $(Verb)for file in $(CONFIG_FILES); do \
437 if test -f $(BUILD_OBJ_DIR)/$${file} ; then \
438 $(INSTALL) $(BUILD_OBJ_DIR)/$${file} $(sysconfdir) ; \
439 elif test -f $(BUILD_SRC_DIR)/$${file} ; then \
440 $(INSTALL) $(BUILD_SRC_DIR)/$${file} $(sysconfdir) ; \
442 $(ECHO) Error: cannot find config file $${file}. ; \
447 $(Echo) Uninstalling Configuration Files From $(sysconfdir)
448 $(Verb)for file in $(CONFIG_FILES); do \
449 $(RM) -f $(sysconfdir)/$${file} ; \
454 ###############################################################################
455 # Library Build Rules: Four ways to build a library
456 ###############################################################################
459 # if we're building a library ...
462 # Make sure there isn't any extranous whitespace on the LIBRARYNAME option
463 LIBRARYNAME := $(strip $(LIBRARYNAME))
464 LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
465 LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
466 LibName.O := $(LibDir)/$(LIBRARYNAME).o
467 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
469 #---------------------------------------------------------
470 # Shared Library Targets:
471 # If the user asked for a shared library to be built
472 # with the SHARED_LIBRARY variable, then we provide
473 # targets for building them.
474 #---------------------------------------------------------
477 all-local:: $(LibName.LA)
479 $(LibName.LA): $(BUILT_SOURCES) $(ObjectsLO) $(LibDir)/.dir
480 $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
481 $(Verb) $(Link) -o $@ $(ObjectsLO)
482 $(Verb) $(LTInstall) $@ $(LibDir)
485 ifneq ($(strip $(LibName.LA)),)
486 -$(Verb) $(RM) -f $(LibName.LA)
489 DestSharedLib = $(libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
491 install-local:: $(DestSharedLib)
493 $(DestSharedLib): $(libdir) $(LibName.LA)
494 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
495 $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
496 $(Verb) $(LIBTOOL) --finish $(libdir)
499 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
500 -$(Verb) $(RM) -f $(libdir)/lib$(LIBRARYNAME).*
504 #---------------------------------------------------------
505 # Bytecode Library Targets:
506 # If the user asked for a bytecode library to be built
507 # with the BYTECODE_LIBRARY variable, then we provide
508 # targets for building them.
509 #---------------------------------------------------------
510 ifdef BYTECODE_LIBRARY
512 # make the C and C++ compilers strip debug info out of bytecode libraries.
513 BCCompile.C += -Wa,-strip-debug
514 BCCompile.CXX += -Wa,-strip-debug
516 all-local:: $(LibName.BCA)
518 ifdef EXPORTED_SYMBOL_FILE
519 BCLinkLib = $(LLVMGCC) -shared -nostdlib -Xlinker \
520 -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
522 $(LibName.BCA): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
523 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
525 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC)
526 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o
528 $(LibName.BCA): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
529 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
530 $(Verb) $(LArchive) $@ $(ObjectsBC)
535 ifneq ($(strip $(LibName.BCA)),)
536 -$(Verb) $(RM) -f $(LibName.BCA)
539 DestBytecodeLib = $(bytecode_libdir)/lib$(LIBRARYNAME).a
541 install-bytecode-local:: $(DestBytecodeLib)
543 install-local:: $(DestBytecodeLib)
545 $(DestBytecodeLib): $(bytecode_libdir) $(LibName.BCA)
546 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
547 $(Verb) $(INSTALL) $(LibName.BCA) $@
550 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
551 -$(Verb) $(RM) -f $(DestBytecodeLib)
555 #---------------------------------------------------------
556 # ReLinked Library Targets:
557 # If the user didn't explicitly forbid building a
558 # relinked then we provide targets for building them.
559 #---------------------------------------------------------
560 ifndef DONT_BUILD_RELINKED
562 all-local:: $(LibName.O)
564 $(LibName.O): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
565 $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
566 $(Verb) $(Relink) -o $@ $(ObjectsO)
569 ifneq ($(strip $(LibName.O)),)
570 -$(Verb) $(RM) -f $(LibName.O)
573 DestRelinkedLib = $(libdir)/$(LIBRARYNAME).o
575 install-local:: $(DestRelinkedLib)
577 $(DestRelinkedLib): $(libdir) $(LibName.O)
578 $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
579 $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
582 $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
583 -$(Verb) $(RM) -f $(DestRelinkedLib)
587 #---------------------------------------------------------
588 # Archive Library Targets:
589 # If the user wanted a regular archive library built,
590 # then we provide targets for building them.
591 #---------------------------------------------------------
594 all-local:: $(LibName.A)
596 $(LibName.A): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
597 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
599 $(Verb) $(Archive) $@ $(ObjectsO)
603 ifneq ($(strip $(LibName.A)),)
604 -$(Verb) $(RM) -f $(LibName.A)
607 DestArchiveLib := $(libdir)/lib$(LIBRARYNAME).a
609 install-local:: $(DestArchiveLib)
611 $(DestArchiveLib): $(libdir) $(LibName.A)
612 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
613 $(Verb) $(MKDIR) $(libdir)
614 $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
617 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
618 -$(Verb) $(RM) -f $(DestArchiveLib)
625 ###############################################################################
626 # Tool Build Rules: Build executable tool based on TOOLNAME option
627 ###############################################################################
631 #---------------------------------------------------------
632 # Handle the special "JIT" value for LLVM_LIBS which is a
633 # shorthand for a bunch of libraries that get the correct
634 # JIT support for a tool that runs JIT.
635 #---------------------------------------------------------
636 ifeq ($(LLVMLIBS),JIT)
638 # Make sure we can get our own symbols in the tool
641 # Generic JIT libraries
642 JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
644 # You can enable the X86 JIT on a non-X86 host by setting the flag
645 # ENABLE_X86_JIT on the make command line. If not, it will still be
646 # enabled automagically on an X86 host.
651 # What the X86 JIT requires
653 JIT_LIBS += LLVMX86 LLVMSelectionDAG
656 # You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
657 # ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
658 # enabled automagically on an SparcV9 host.
659 ifeq ($(ARCH), Sparc)
660 ENABLE_SPARCV9_JIT = 1
663 # What the Sparc JIT requires
664 ifdef ENABLE_SPARCV9_JIT
665 JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
666 LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \
667 LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
668 LLVMDataStructure.a LLVMSparcV9RegAlloc
671 # You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
672 # ENABLE_PPC_JIT on the make command line. If not, it will still be
673 # enabled automagically on an PowerPC host.
674 ifeq ($(ARCH), PowerPC)
678 # What the PowerPC JIT requires
680 JIT_LIBS += LLVMPowerPC
683 LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \
684 LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
685 LLVMSystem.a $(PLATFORMLIBDL)
688 #---------------------------------------------------------
689 # Set up variables for building a tool.
690 #---------------------------------------------------------
692 ToolBuildPath := $(ExmplDir)/$(TOOLNAME)$(EXEEXT)
694 ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
696 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
697 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
698 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
699 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
700 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
701 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
702 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
703 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
705 #---------------------------------------------------------
706 # Tell make that we need to rebuild subdirectories before
707 # we can link the tool. This affects things like LLI which
708 # has library subdirectories.
709 #---------------------------------------------------------
710 $(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
712 #---------------------------------------------------------
713 # Provide targets for building the tools
714 #---------------------------------------------------------
715 all-local:: $(ToolBuildPath)
718 ifneq ($(strip $(ToolBuildPath)),)
719 -$(Verb) $(RM) -f $(ToolBuildPath)
723 $(ToolBuildPath): $(ExmplDir)/.dir
725 $(ToolBuildPath): $(ToolDir)/.dir
728 $(ToolBuildPath): $(BUILT_SOURCES) $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
729 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
730 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
731 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB)
732 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg)
734 DestTool = $(bindir)/$(TOOLNAME)
736 install-local:: $(DestTool)
738 $(DestTool): $(bindir) $(ToolBuildPath)
739 $(Echo) Installing $(BuildMode) $(DestTool)
740 $(Verb) $(INSTALL) $(ToolBuildPath) $(DestTool)
743 $(Echo) Uninstalling $(BuildMode) $(DestTool)
744 -$(Verb) $(RM) -f $(DestTool)
748 ###############################################################################
749 # Object Build Rules: Build object files based on sources
750 ###############################################################################
752 # Provide rule sets for when dependency generation is enabled
753 ifndef DISABLE_AUTO_DEPENDENCIES
755 #---------------------------------------------------------
756 # Create .lo files in the ObjDir directory from the .cpp and .c files...
757 #---------------------------------------------------------
760 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
761 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
762 $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
763 then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
764 else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
766 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
767 $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
768 $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
769 then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
770 else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
772 #---------------------------------------------------------
773 # Create .o files in the ObjDir directory from the .cpp and .c files...
774 #---------------------------------------------------------
777 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
778 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
779 $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
780 then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
781 else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
783 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
784 $(Echo) "Compiling $*.c for $(BuildMode) build"
785 $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
786 then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
787 else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
791 #---------------------------------------------------------
792 # Create .bc files in the ObjDir directory from .cpp and .c files...
793 #---------------------------------------------------------
794 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS)
795 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
796 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
797 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
798 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
800 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS)
801 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
802 $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
803 then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
804 else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
806 # Provide alternate rule sets if dependencies are disabled
811 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
812 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
813 $(LTCompile.CXX) $< -o $@
815 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
816 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
817 $(LTCompile.C) $< -o $@
821 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
822 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
823 $(Compile.CXX) $< -o $@
825 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
826 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
827 $(Compile.C) $< -o $@
830 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS)
831 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
832 $(BCCompile.CXX) $< -o $@
834 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS)
835 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
836 $(BCCompile.C) $< -o $@
840 #---------------------------------------------------------
841 # Provide rule to build .bc files from .ll sources,
842 # regardless of dependencies
843 #---------------------------------------------------------
844 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
845 $(Echo) "Compiling $*.ll for $(BuildMode) build"
846 $(Verb) $(LLVMAS) $< -f -o $@
848 ###############################################################################
849 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
850 ###############################################################################
854 TDFiles := $(strip $(wildcard $(BUILD_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
855 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
857 $(INCFiles) : $(TBLGEN) $(TDFiles)
859 %GenRegisterNames.inc : %.td
860 $(Echo) "Building $(<F) register names with tblgen"
861 $(Verb) $(TableGen) -gen-register-enums -o $@ $<
863 %GenRegisterInfo.h.inc : %.td
864 $(Echo) "Building $(<F) register information header with tblgen"
865 $(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
867 %GenRegisterInfo.inc : %.td
868 $(Echo) "Building $(<F) register info implementation with tblgen"
869 $(Verb) $(TableGen) -gen-register-desc -o $@ $<
871 %GenInstrNames.inc : %.td
872 $(Echo) "Building $(<F) instruction names with tblgen"
873 $(Verb) $(TableGen) -gen-instr-enums -o $@ $<
875 %GenInstrInfo.inc : %.td
876 $(Echo) "Building $(<F) instruction information with tblgen"
877 $(Verb) $(TableGen) -gen-instr-desc -o $@ $<
879 %GenAsmWriter.inc : %.td
880 $(Echo) "Building $(<F) assembly writer with tblgen"
881 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
883 %GenATTAsmWriter.inc : %.td
884 $(Echo) "Building $(<F) AT&T assembly writer with tblgen"
885 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
887 %GenIntelAsmWriter.inc : %.td
888 $(Echo) "Building $(<F) Intel assembly writer with tblgen"
889 $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
891 %GenInstrSelector.inc: %.td
892 $(Echo) "Building $(<F) instruction selector with tblgen"
893 $(Verb) $(TableGen) -gen-instr-selector -o $@ $<
895 %GenCodeEmitter.inc:: %.td
896 $(Echo) "Building $(<F) code emitter with tblgen"
897 $(Verb) $(TableGen) -gen-emitter -o $@ $<
900 -$(Verb) $(RM) -f $(INCFiles)
904 ###############################################################################
905 # LEX AND YACC: Provide rules for generating sources with lex and yacc
906 ###############################################################################
908 #---------------------------------------------------------
909 # Provide rules for generating a .cpp source file from
910 # (f)lex input sources.
911 #---------------------------------------------------------
913 LexFiles := $(filter %.l,$(Sources))
917 LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
919 .PRECIOUS: $(LexOutput)
921 # Note the extra sed filtering here, used to cut down on the warnings emited
922 # by GCC. The last line is a gross hack to work around flex aparently not
923 # being able to resize the buffer on a large token input. Currently, for
924 # uninitialized string buffers in LLVM we can generate very long tokens, so
925 # this is a hack around it.
926 # FIXME. (f.e. char Buffer[10000] )
929 $(Verb) $(FLEX) -t $< | \
930 $(SED) 's/void yyunput/inline void yyunput/' | \
931 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
932 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
936 -$(Verb) $(RM) -f $(LexOutput)
937 $(Verb) $(RM) -f $(LexOutput)
941 #---------------------------------------------------------
942 # Provide rules for generating a .cpp and .h source files
943 # from yacc (bison) input sources.
944 #---------------------------------------------------------
946 YaccFiles := $(filter %.y,$(Sources))
947 ifneq ($(YaccFiles),)
948 YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
950 .PRECIOUS: $(YaccOutput)
952 # Cancel built-in rules for yacc
957 # Rule for building the bison parsers...
959 $(Echo) "Bisoning $*.y"
960 $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
961 $(Verb) $(MV) -f $*.tab.c $*.cpp
962 $(Verb) $(MV) -f $*.tab.h $*.h
965 -$(Verb) $(RM) -f $(YaccOutput)
966 $(Verb) $(RM) -f $(YaccOutput)
969 ###############################################################################
970 # OTHER RULES: Other rules needed
971 ###############################################################################
973 # To create postscript files from dot files...
976 $(DOT) -Tps < $< > $@
979 $(Echo) "Cannot build $@: The program dot is not installed"
982 # This rules ensures that header files that are removed still have a rule for
983 # which they can be "generated." This allows make to ignore them and
984 # reproduce the dependency lists.
987 # Define clean-local to clean the current directory. Note that this uses a
988 # very conservative approach ensuring that empty variables do not cause
989 # errors or disastrous removal.
991 ifneq ($(strip $(ObjDir)),)
992 -$(Verb) $(RM) -rf $(ObjDir)
994 -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
995 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
996 -$(Verb) $(RM) -f *$(SHLIBEXT)
1000 -$(Verb) $(RM) -rf Debug Release Profile
1002 # Build tags database for Emacs/Xemacs:
1006 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
1007 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
1008 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1009 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1010 -name '*.cpp' -o -name '*.h' | \
1011 $(ETAGS) $(ETAGSFLAGS) -
1014 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
1015 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
1016 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1017 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1018 \( -name '*.cpp' -o -name '*.h' \) -print | \
1019 ctags -ImtT -o $(BUILD_OBJ_ROOT)/CTAGS -L -
1022 ###############################################################################
1023 # DEPENDENCIES: Include the dependency files if we should
1024 ###############################################################################
1025 ifndef DISABLE_AUTO_DEPENDENCIES
1027 # If its not one of the cleaning targets
1028 ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
1030 # Get the list of dependency files
1031 DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
1032 DependFiles := $(patsubst %,$(BUILD_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
1034 -include /dev/null $(DependFiles)
1040 ###############################################################################
1041 # DISTRIBUTION: Handle construction of a distribution tarball
1042 ###############################################################################
1044 #------------------------------------------------------------------------
1045 # Define distribution related variables
1046 #------------------------------------------------------------------------
1047 DistName := $(LLVM_TARBALL_NAME)
1048 DistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1049 TopDistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1050 DistTarGZip := $(BUILD_OBJ_ROOT)/$(DistName).tar.gz
1051 DistZip := $(BUILD_OBJ_ROOT)/$(DistName).zip
1052 DistTarBZ2 := $(BUILD_OBJ_ROOT)/$(DistName).tar.bz2
1053 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1054 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1055 Makefile.config.in configure autoconf
1056 DistOther := $(notdir $(wildcard \
1057 $(BUILD_SRC_DIR)/*.h \
1058 $(BUILD_SRC_DIR)/*.td \
1059 $(BUILD_SRC_DIR)/*.def \
1060 $(BUILD_SRC_DIR)/*.ll \
1061 $(BUILD_SRC_DIR)/*.in))
1062 DistSubDirs := $(SubDirs)
1063 DistSources = $(Sources) $(EXTRA_DIST)
1064 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
1066 #------------------------------------------------------------------------
1067 # We MUST build distribution with OBJ_DIR != SRC_DIR
1068 #------------------------------------------------------------------------
1069 ifeq ($(BUILD_SRC_DIR),$(BUILD_OBJ_DIR))
1070 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1071 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1078 #------------------------------------------------------------------------
1079 # Prevent catastrophic remove
1080 #------------------------------------------------------------------------
1081 ifeq ($(LLVM_TARBALL_NAME),)
1082 $(error LLVM_TARBALL_NAME is empty. Please rerun configure)
1085 #------------------------------------------------------------------------
1086 # Prevent attempt to run dist targets from anywhere but the top level
1087 #------------------------------------------------------------------------
1090 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1091 $(Echo) ERROR: You must run $@ from $(BUILD_OBJ_ROOT)
1095 #------------------------------------------------------------------------
1096 # Provide the top level targets
1097 #------------------------------------------------------------------------
1099 dist-gzip:: $(DistTarGZip)
1101 $(DistTarGZip) : distdir
1102 $(Echo) Packing gzipped distribution tar file.
1103 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1104 $(GZIP) -c > "$(DistTarGZip)"
1106 dist-bzip2:: $(DistTarBZ2)
1108 $(DistTarBZ2) : distdir
1109 $(Echo) Packing bzipped distribution tar file.
1110 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1111 $(BZIP2) -c >$(DistTarBZ2)
1113 dist-zip:: $(DistZip)
1115 $(DistZip) : distdir
1116 $(Echo) Packing zipped distribution file.
1117 $(Verb) rm -f $(DistZip)
1118 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1120 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
1121 $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
1123 DistCheckDir := $(LLVM_OBJ_ROOT)/_distcheckdir
1125 dist-check:: $(DistCheckTop) $(DistTarGZip)
1126 $(Echo) Checking distribution tar file.
1127 $(Verb) if test -d $(DistCheckDir) ; then \
1128 $(RM) -rf $(DistCheckDir) ; \
1130 $(Verb) $(MKDIR) $(DistCheckDir)
1131 $(Verb) cd $(DistCheckDir) && \
1132 $(MKDIR) $(DistCheckDir)/build && \
1133 $(MKDIR) $(DistCheckDir)/install && \
1134 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1136 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1137 --srcdir=../$(DistName) --with-llvmgccdir="$(LLVMGCCDIR)" && \
1139 $(MAKE) install && \
1140 $(MAKE) uninstall && \
1143 $(MAKE) dist-clean && \
1144 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1147 $(Echo) Cleaning distribution files
1148 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) $(DistCheckDir)
1152 #------------------------------------------------------------------------
1153 # Provide the recursive distdir target for building the distribution directory
1154 #------------------------------------------------------------------------
1155 distdir : $(DistSources)
1156 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1157 if test -d "$(DistDir)" ; then \
1158 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
1161 $(EchoCmd) Removing $(DistDir) ; \
1162 $(RM) -rf $(DistDir); \
1164 $(Echo) Building Distribution Directory $(DistDir)
1165 $(Verb) $(MKDIR) $(DistDir)
1166 $(Verb) srcdirstrip=`echo "$(BUILD_SRC_DIR)" | sed 's|.|.|g'`; \
1167 srcrootstrip=`echo "$(BUILD_SRC_ROOT)" | sed 's|.|.|g'`; \
1168 for file in $(DistFiles) ; do \
1170 $(BUILD_SRC_DIR)/*) file=`echo "$$file" | sed "s#^$$srcdirstrip/##"`;; \
1171 $(BUILD_SRC_ROOT)/*) file=`echo "$$file" | sed "s#^$$srcrootstrip/#$(BUILD_OBJ_ROOT)/#"`;; \
1173 if test -f "$$file" || test -d "$$file" ; then \
1176 from_dir=$(BUILD_SRC_DIR); \
1178 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'`; \
1179 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1180 to_dir="$(DistDir)/$$dir"; \
1181 $(MKDIR) "$$to_dir" ; \
1183 to_dir="$(DistDir)"; \
1185 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1186 if test -n "$$mid_dir" ; then \
1187 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1189 if test -d "$$from_dir/$$file"; then \
1190 if test -d "$(BUILD_SRC_DIR)/$$file" && \
1191 test "$$from_dir" != "$(BUILD_SRC_DIR)" ; then \
1192 cp -pR "$(BUILD_SRC_DIR)/$$file" "$$to_dir" || exit 1; \
1194 cp -pR $$from_dir/$$file $$to_dir || exit 1; \
1195 elif test -f "$$from_dir/$$file" ; then \
1196 cp -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1197 elif test -L "$$from_dir/$$file" ; then \
1198 cp -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
1199 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1200 $(EchoCmd) "===== WARNING: Distribution Source $$from_dir/$$file Not Found!" ; \
1201 elif test "$(Verb)" != '@' ; then \
1202 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
1205 $(Verb) for subdir in $(DistSubDirs) ; do \
1206 if test "$$subdir" \!= "." ; then \
1207 new_distdir="$(DistDir)/$$subdir" ; \
1208 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
1209 ( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || exit 1; \
1212 $(Verb) $(MAKE) DistDir="$(DistDir)" dist-hook || exit 1
1213 -$(Verb) find $(DistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
1214 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
1215 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
1216 ! -type d ! -perm -444 -exec $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1217 || chmod -R a+r $(DistDir)
1219 # This is invoked by distdir target, define it as a no-op to avoid errors if not
1225 ###############################################################################
1226 # TOP LEVEL - targets only to apply at the top level directory
1227 ###############################################################################
1231 #------------------------------------------------------------------------
1232 # Install support for project's include files:
1233 #------------------------------------------------------------------------
1235 $(Echo) Installing include files
1236 $(Verb) $(MKDIR) $(includedir)
1237 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1238 cd $(BUILD_SRC_ROOT)/include && \
1239 find . -path '*/Internal' -prune -o '(' -type f \
1240 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1241 -print ')' | grep -v CVS | pax -rwdvpe $(includedir) ; \
1245 $(Echo) Uninstalling include files
1246 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1247 cd $(BUILD_SRC_ROOT)/include && \
1248 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
1249 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1250 -print ')' | grep -v CVS | sed 's#^#$(includedir)/#'` ; \
1255 #------------------------------------------------------------------------
1256 # Print out the directories used for building
1257 #------------------------------------------------------------------------
1259 $(Echo) "BuildMode : " '$(BuildMode)'
1260 $(Echo) "BUILD_SRC_ROOT : " '$(BUILD_SRC_ROOT)'
1261 $(Echo) "BUILD_SRC_DIR : " '$(BUILD_SRC_DIR)'
1262 $(Echo) "BUILD_OBJ_ROOT : " '$(BUILD_OBJ_ROOT)'
1263 $(Echo) "BUILD_OBJ_DIR : " '$(BUILD_OBJ_DIR)'
1264 $(Echo) "LLVM_SRC_ROOT : " '$(LLVM_SRC_ROOT)'
1265 $(Echo) "LLVM_OBJ_ROOT : " '$(LLVM_OBJ_ROOT)'
1266 $(Echo) "libdir : " '$(libdir)'
1267 $(Echo) "bindir : " '$(bindir)'
1268 $(Echo) "sysconfdir : " '$(sysconfdir)'
1269 $(Echo) "bytecode_libdir: " '$(bytecode_libdir)'
1270 $(Echo) "UserTargets : " '$(UserTargets)'
1271 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1272 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1273 $(Echo) "ObjDir : " '$(ObjDir)'
1274 $(Echo) "LibDir : " '$(LibDir)'
1275 $(Echo) "ToolDir : " '$(ToolDir)'
1276 $(Echo) "ExmplDir : " '$(ExmplDir)'
1277 $(Echo) "TDFiles : " '$(TDFiles)'
1278 $(Echo) "INCFiles : " '$(INCFiles)'
1279 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
1280 $(Echo) "Compile.C : " '$(Compile.C)'
1281 $(Echo) "Archive : " '$(Archive)'
1282 $(Echo) "YaccFiles : " '$(YaccFiles)'
1283 $(Echo) "LexFiles : " '$(LexFiles)'