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 check install uninstall install-bytecode
23 LocalTargets := all-local clean-local clean-all-local check-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)
136 clean-all:: clean-local clean-all-local
137 install:: install-local
138 uninstall:: uninstall-local
139 check-local:: all-local
140 install-local:: all-local
141 install-bytecode:: install-bytecode-local
143 ###############################################################################
144 # VARIABLES: Set up various variables based on configuration data
145 ###############################################################################
147 #--------------------------------------------------------------------
148 # Variables derived from configuration we are building
149 #--------------------------------------------------------------------
151 ifdef ENABLE_PROFILING
153 CXX.Flags := -O3 -DNDEBUG -felide-constructors -finline-functions -pg
154 C.Flags := -O3 -DNDEBUG -pg
155 LD.Flags := -O3 -DNDEBUG -pg
157 ifdef ENABLE_OPTIMIZED
159 CXX.Flags := -O3 -DNDEBUG -finline-functions -felide-constructors -fomit-frame-pointer
160 C.Flags := -O3 -DNDEBUG -fomit-frame-pointer
161 LD.Flags := -O3 -DNDEBUG
164 CXX.Flags := -g -D_DEBUG
165 C.Flags := -g -D_DEBUG
166 LD.Flags := -g -D_DEBUG
171 CXX.Flags += $(CXXFLAGS)
173 CPP.Flags += $(CPPFLAGS)
174 LD.Flags += $(LDFLAGS)
176 LibTool.Flags := --tag=CXX
178 #--------------------------------------------------------------------
179 # Directory locations
180 #--------------------------------------------------------------------
181 ObjDir := $(BUILD_OBJ_DIR)/$(BuildMode)
182 LibDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/lib
183 ToolDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/bin
184 ExmplDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/examples
185 LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
186 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
187 LExmplDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
189 #--------------------------------------------------------------------
190 # Full Paths To Compiled Tools and Utilities
191 #--------------------------------------------------------------------
192 EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
195 LIBTOOL := $(LLVM_OBJ_ROOT)/mklib
198 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
201 BURG := $(LLVMToolDir)/burg$(EXEEXT)
204 TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT)
207 GCCAS := $(LLVMToolDir)/gccas$(EXEEXT)
210 GCCLD := $(LLVMToolDir)/gccld$(EXEEXT)
213 LLVMGCC := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/gcc
216 LLVMGXX := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/g++
219 # Need a better way to compute this.
220 LLVMGCCLibDir := $(dir $(shell $(LLVMGCC) -print-file-name=libgcc.a))/
222 #--------------------------------------------------------------------
223 # Adjust to user's request
224 #--------------------------------------------------------------------
226 # Adjust LIBTOOL flags for shared libraries, or not.
227 ifndef SHARED_LIBRARY
228 LibTool.Flags += --tag=disable-shared
230 LD.Flags += -rpath $(LibDir)
241 # Adjust settings for verbose mode
244 LibTool.Flags += --silent
245 AR.Flags += >/dev/null 2>/dev/null
246 ConfigureScriptFLAGS += >$(BUILD_OBJ_DIR)/configure.out 2>&1
248 ConfigureScriptFLAGS :=
251 # By default, strip symbol information from executable
253 Strip := $(PLATFORMSTRIPOPTS)
254 StripWarnMsg := "(without symbols)"
257 # Adjust linker flags for building an executable
260 LD.Flags += -rpath $(ExmplDir) -export-dynamic
262 LD.Flags += -rpath $(ToolDir) -export-dynamic
266 #----------------------------------------------------------
267 # Options To Invoke Tools
268 #----------------------------------------------------------
270 CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
272 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
273 CPP.Flags += -I$(BUILD_OBJ_DIR) \
275 -I$(BUILD_SRC_ROOT)/include \
276 -I$(BUILD_OBJ_ROOT)/include \
277 -I$(LLVM_OBJ_ROOT)/include \
278 -I$(LLVM_SRC_ROOT)/include \
279 -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
281 Compile.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags)
282 LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
283 BCCompile.C = $(LLVMGCC) $(CPP.Flags) $(CompileCommonOpts) $(C.Flags) -c
284 Compile.CXX = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
285 LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
286 BCCompile.CXX = $(LLVMGXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
287 Link = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
288 $(CompileCommonOpts) $(LD.Flags) $(Strip)
289 Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
291 LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL)
292 Burg = $(BURG) -I $(BUILD_SRC_DIR)
293 TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR)
294 Archive = $(AR) $(AR.Flags)
295 LArchive = $(LLVMToolDir)/llvm-ar rcsf
302 #----------------------------------------------------------
303 # Get the list of source files
304 #----------------------------------------------------------
306 Sources := $(notdir $(wildcard $(BUILD_SRC_DIR)/*.cpp \
307 $(BUILD_SRC_DIR)/*.cc $(BUILD_SRC_DIR)/*.c $(BUILD_SRC_DIR)/*.y \
308 $(BUILD_SRC_DIR)/*.l))
310 Sources := $(SOURCES)
314 Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
317 #----------------------------------------------------------
318 # Types of objects that can be built from sources
319 #----------------------------------------------------------
320 BaseNameSources := $(sort $(basename $(Sources)))
321 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
322 ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
323 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
325 ###############################################################################
326 # DIRECTORIES: Handle recursive descent of directory structure
327 ###############################################################################
329 #---------------------------------------------------------
330 # Provide rules to make install dirs. This must be early
331 # in the file so they get built before dependencies
332 #---------------------------------------------------------
335 $(Verb) $(MKDIR) $(bindir)
338 $(Verb) $(MKDIR) $(libdir)
341 $(Verb) $(MKDIR) $(bytecode_libdir)
344 $(Verb) $(MKDIR) $(sysconfdir)
346 # To create other directories, as needed, and timestamp their creation
348 $(Verb) $(MKDIR) $* > /dev/null
351 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
352 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
354 #---------------------------------------------------------
355 # Handle the DIRS options for sequential construction
356 #---------------------------------------------------------
361 $(RecursiveTargets)::
362 $(Verb) for dir in $(DIRS); do \
363 if [ ! -f $$dir/Makefile ]; then \
365 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
367 ($(MAKE) -C $$dir $@ ) || exit 1; \
371 #---------------------------------------------------------
372 # Handle the EXPERIMENTAL_DIRS options ensuring success
373 # after each directory is built.
374 #---------------------------------------------------------
375 ifdef EXPERIMENTAL_DIRS
376 $(RecursiveTargets)::
377 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
378 if [ ! -f $$dir/Makefile ]; then \
380 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
382 ($(MAKE) -C $$dir $@ ) || exit 0; \
386 #---------------------------------------------------------
387 # Handle the PARALLEL_DIRS options for parallel construction
388 #---------------------------------------------------------
391 SubDirs += $(PARALLEL_DIRS)
393 # Unfortunately, this list must be maintained if new recursive targets are added
394 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
395 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
396 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
397 check :: $(addsuffix /.makecheck ,$(PARALLEL_DIRS))
398 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
399 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
400 install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
402 Parallel_Targets := $(foreach T,$(RecursiveTargets),%/.make$(T))
404 $(Parallel_Targets) :
405 $(Verb) if [ ! -f $(@D)/Makefile ]; then \
407 cp $(BUILD_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
409 $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
412 #---------------------------------------------------------
413 # Handle the OPTIONAL_DIRS options for directores that may
415 #---------------------------------------------------------
418 SubDirs += $(OPTIONAL_DIRS)
420 $(RecursiveTargets)::
421 $(Verb) for dir in $(OPTIONAL_DIRS); do \
422 if [ -d $(BUILD_SRC_DIR)/$$dir ]; then\
423 if [ ! -f $$dir/Makefile ]; then \
425 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
427 ($(MAKE) -C$$dir $@ ) || exit 1; \
432 #---------------------------------------------------------
433 # Handle the CONFIG_FILES options
434 #---------------------------------------------------------
437 install-local:: $(sysconfdir) $(CONFIG_FILES)
438 $(Echo) Installing Configuration Files To $(sysconfdir)
439 $(Verb)for file in $(CONFIG_FILES); do \
440 if test -f $(BUILD_OBJ_DIR)/$${file} ; then \
441 $(INSTALL) $(BUILD_OBJ_DIR)/$${file} $(sysconfdir) ; \
442 elif test -f $(BUILD_SRC_DIR)/$${file} ; then \
443 $(INSTALL) $(BUILD_SRC_DIR)/$${file} $(sysconfdir) ; \
445 $(ECHO) Error: cannot find config file $${file}. ; \
450 $(Echo) Uninstalling Configuration Files From $(sysconfdir)
451 $(Verb)for file in $(CONFIG_FILES); do \
452 $(RM) -f $(sysconfdir)/$${file} ; \
457 ###############################################################################
458 # Library Build Rules: Four ways to build a library
459 ###############################################################################
462 # if we're building a library ...
465 # Make sure there isn't any extranous whitespace on the LIBRARYNAME option
466 LIBRARYNAME := $(strip $(LIBRARYNAME))
467 LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
468 LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
469 LibName.O := $(LibDir)/$(LIBRARYNAME).o
470 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
472 #---------------------------------------------------------
473 # Shared Library Targets:
474 # If the user asked for a shared library to be built
475 # with the SHARED_LIBRARY variable, then we provide
476 # targets for building them.
477 #---------------------------------------------------------
480 all-local:: $(LibName.LA)
482 $(LibName.LA): $(BUILT_SOURCES) $(ObjectsLO) $(LibDir)/.dir
483 $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
484 $(Verb) $(Link) -o $@ $(ObjectsLO)
485 $(Verb) $(LTInstall) $@ $(LibDir)
488 ifneq ($(strip $(LibName.LA)),)
489 -$(Verb) $(RM) -f $(LibName.LA)
492 DestSharedLib = $(libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
494 install-local:: $(DestSharedLib)
496 $(DestSharedLib): $(libdir) $(LibName.LA)
497 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
498 $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
499 $(Verb) $(LIBTOOL) --finish $(libdir)
502 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
503 -$(Verb) $(RM) -f $(libdir)/lib$(LIBRARYNAME).*
507 #---------------------------------------------------------
508 # Bytecode Library Targets:
509 # If the user asked for a bytecode library to be built
510 # with the BYTECODE_LIBRARY variable, then we provide
511 # targets for building them.
512 #---------------------------------------------------------
513 ifdef BYTECODE_LIBRARY
515 # make the C and C++ compilers strip debug info out of bytecode libraries.
516 BCCompile.C += -Wa,-strip-debug
517 BCCompile.CXX += -Wa,-strip-debug
519 all-local:: $(LibName.BCA)
521 ifdef EXPORTED_SYMBOL_FILE
522 BCLinkLib = $(LLVMGCC) -shared -nostdlib -Xlinker \
523 -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
525 $(LibName.BCA): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
526 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
528 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC)
529 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o
531 $(LibName.BCA): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
532 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
533 $(Verb) $(LArchive) $@ $(ObjectsBC)
538 ifneq ($(strip $(LibName.BCA)),)
539 -$(Verb) $(RM) -f $(LibName.BCA)
542 DestBytecodeLib = $(bytecode_libdir)/lib$(LIBRARYNAME).a
544 install-bytecode-local:: $(DestBytecodeLib)
546 install-local:: $(DestBytecodeLib)
548 $(DestBytecodeLib): $(bytecode_libdir) $(LibName.BCA)
549 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
550 $(Verb) $(INSTALL) $(LibName.BCA) $@
553 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
554 -$(Verb) $(RM) -f $(DestBytecodeLib)
558 #---------------------------------------------------------
559 # ReLinked Library Targets:
560 # If the user didn't explicitly forbid building a
561 # relinked then we provide targets for building them.
562 #---------------------------------------------------------
563 ifndef DONT_BUILD_RELINKED
565 all-local:: $(LibName.O)
567 $(LibName.O): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
568 $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
569 $(Verb) $(Relink) -o $@ $(ObjectsO)
572 ifneq ($(strip $(LibName.O)),)
573 -$(Verb) $(RM) -f $(LibName.O)
576 DestRelinkedLib = $(libdir)/$(LIBRARYNAME).o
578 install-local:: $(DestRelinkedLib)
580 $(DestRelinkedLib): $(libdir) $(LibName.O)
581 $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
582 $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
585 $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
586 -$(Verb) $(RM) -f $(DestRelinkedLib)
590 #---------------------------------------------------------
591 # Archive Library Targets:
592 # If the user wanted a regular archive library built,
593 # then we provide targets for building them.
594 #---------------------------------------------------------
597 all-local:: $(LibName.A)
599 $(LibName.A): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
600 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
602 $(Verb) $(Archive) $@ $(ObjectsO)
606 ifneq ($(strip $(LibName.A)),)
607 -$(Verb) $(RM) -f $(LibName.A)
610 DestArchiveLib := $(libdir)/lib$(LIBRARYNAME).a
612 install-local:: $(DestArchiveLib)
614 $(DestArchiveLib): $(libdir) $(LibName.A)
615 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
616 $(Verb) $(MKDIR) $(libdir)
617 $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
620 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
621 -$(Verb) $(RM) -f $(DestArchiveLib)
628 ###############################################################################
629 # Tool Build Rules: Build executable tool based on TOOLNAME option
630 ###############################################################################
634 #---------------------------------------------------------
635 # Handle the special "JIT" value for LLVM_LIBS which is a
636 # shorthand for a bunch of libraries that get the correct
637 # JIT support for a tool that runs JIT.
638 #---------------------------------------------------------
639 ifeq ($(LLVMLIBS),JIT)
641 # Make sure we can get our own symbols in the tool
644 # Generic JIT libraries
645 JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
647 # You can enable the X86 JIT on a non-X86 host by setting the flag
648 # ENABLE_X86_JIT on the make command line. If not, it will still be
649 # enabled automagically on an X86 host.
654 # What the X86 JIT requires
656 JIT_LIBS += LLVMX86 LLVMSelectionDAG
659 # You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
660 # ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
661 # enabled automagically on an SparcV9 host.
662 ifeq ($(ARCH), Sparc)
663 ENABLE_SPARCV9_JIT = 1
666 # What the Sparc JIT requires
667 ifdef ENABLE_SPARCV9_JIT
668 JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
669 LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \
670 LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
671 LLVMDataStructure.a LLVMSparcV9RegAlloc
674 # You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
675 # ENABLE_PPC_JIT on the make command line. If not, it will still be
676 # enabled automagically on an PowerPC host.
677 ifeq ($(ARCH), PowerPC)
681 # What the PowerPC JIT requires
683 JIT_LIBS += LLVMPowerPC
686 LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \
687 LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
688 LLVMSystem.a $(PLATFORMLIBDL)
691 #---------------------------------------------------------
692 # Set up variables for building a tool.
693 #---------------------------------------------------------
695 ToolBuildPath := $(ExmplDir)/$(TOOLNAME)$(EXEEXT)
697 ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
699 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
700 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
701 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
702 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
703 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
704 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
705 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
706 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
708 #---------------------------------------------------------
709 # Tell make that we need to rebuild subdirectories before
710 # we can link the tool. This affects things like LLI which
711 # has library subdirectories.
712 #---------------------------------------------------------
713 $(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
715 #---------------------------------------------------------
716 # Provide targets for building the tools
717 #---------------------------------------------------------
718 all-local:: $(ToolBuildPath)
721 ifneq ($(strip $(ToolBuildPath)),)
722 -$(Verb) $(RM) -f $(ToolBuildPath)
726 $(ToolBuildPath): $(ExmplDir)/.dir
728 $(ToolBuildPath): $(ToolDir)/.dir
731 $(ToolBuildPath): $(BUILT_SOURCES) $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
732 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
733 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
734 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB)
735 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg)
737 DestTool = $(bindir)/$(TOOLNAME)
739 install-local:: $(DestTool)
741 $(DestTool): $(bindir) $(ToolBuildPath)
742 $(Echo) Installing $(BuildMode) $(DestTool)
743 $(Verb) $(INSTALL) $(ToolBuildPath) $(DestTool)
746 $(Echo) Uninstalling $(BuildMode) $(DestTool)
747 -$(Verb) $(RM) -f $(DestTool)
751 ###############################################################################
752 # Object Build Rules: Build object files based on sources
753 ###############################################################################
755 # Provide rule sets for when dependency generation is enabled
756 ifndef DISABLE_AUTO_DEPENDENCIES
758 #---------------------------------------------------------
759 # Create .lo files in the ObjDir directory from the .cpp and .c files...
760 #---------------------------------------------------------
763 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
764 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
765 $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
766 then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
767 else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
769 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
770 $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
771 $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
772 then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
773 else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
775 #---------------------------------------------------------
776 # Create .o files in the ObjDir directory from the .cpp and .c files...
777 #---------------------------------------------------------
780 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
781 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
782 $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
783 then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
784 else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
786 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
787 $(Echo) "Compiling $*.c for $(BuildMode) build"
788 $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
789 then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
790 else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
794 #---------------------------------------------------------
795 # Create .bc files in the ObjDir directory from .cpp and .c files...
796 #---------------------------------------------------------
797 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS)
798 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
799 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
800 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
801 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
803 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS)
804 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
805 $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
806 then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
807 else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
809 # Provide alternate rule sets if dependencies are disabled
814 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
815 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
816 $(LTCompile.CXX) $< -o $@
818 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
819 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
820 $(LTCompile.C) $< -o $@
824 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
825 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
826 $(Compile.CXX) $< -o $@
828 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
829 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
830 $(Compile.C) $< -o $@
833 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS)
834 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
835 $(BCCompile.CXX) $< -o $@
837 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS)
838 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
839 $(BCCompile.C) $< -o $@
843 #---------------------------------------------------------
844 # Provide rule to build .bc files from .ll sources,
845 # regardless of dependencies
846 #---------------------------------------------------------
847 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
848 $(Echo) "Compiling $*.ll for $(BuildMode) build"
849 $(Verb) $(LLVMAS) $< -f -o $@
851 ###############################################################################
852 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
853 ###############################################################################
857 TDFiles := $(strip $(wildcard $(BUILD_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
858 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
860 $(INCFiles) : $(TBLGEN) $(TDFiles)
862 %GenRegisterNames.inc : %.td
863 $(Echo) "Building $(<F) register names with tblgen"
864 $(Verb) $(TableGen) -gen-register-enums -o $@ $<
866 %GenRegisterInfo.h.inc : %.td
867 $(Echo) "Building $(<F) register information header with tblgen"
868 $(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
870 %GenRegisterInfo.inc : %.td
871 $(Echo) "Building $(<F) register info implementation with tblgen"
872 $(Verb) $(TableGen) -gen-register-desc -o $@ $<
874 %GenInstrNames.inc : %.td
875 $(Echo) "Building $(<F) instruction names with tblgen"
876 $(Verb) $(TableGen) -gen-instr-enums -o $@ $<
878 %GenInstrInfo.inc : %.td
879 $(Echo) "Building $(<F) instruction information with tblgen"
880 $(Verb) $(TableGen) -gen-instr-desc -o $@ $<
882 %GenAsmWriter.inc : %.td
883 $(Echo) "Building $(<F) assembly writer with tblgen"
884 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
886 %GenATTAsmWriter.inc : %.td
887 $(Echo) "Building $(<F) AT&T assembly writer with tblgen"
888 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
890 %GenIntelAsmWriter.inc : %.td
891 $(Echo) "Building $(<F) Intel assembly writer with tblgen"
892 $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
894 %GenInstrSelector.inc: %.td
895 $(Echo) "Building $(<F) instruction selector with tblgen"
896 $(Verb) $(TableGen) -gen-instr-selector -o $@ $<
898 %GenCodeEmitter.inc:: %.td
899 $(Echo) "Building $(<F) code emitter with tblgen"
900 $(Verb) $(TableGen) -gen-emitter -o $@ $<
903 -$(Verb) $(RM) -f $(INCFiles)
907 ###############################################################################
908 # LEX AND YACC: Provide rules for generating sources with lex and yacc
909 ###############################################################################
911 #---------------------------------------------------------
912 # Provide rules for generating a .cpp source file from
913 # (f)lex input sources.
914 #---------------------------------------------------------
916 LexFiles := $(filter %.l,$(Sources))
920 LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
922 .PRECIOUS: $(LexOutput)
924 # Note the extra sed filtering here, used to cut down on the warnings emited
925 # by GCC. The last line is a gross hack to work around flex aparently not
926 # being able to resize the buffer on a large token input. Currently, for
927 # uninitialized string buffers in LLVM we can generate very long tokens, so
928 # this is a hack around it.
929 # FIXME. (f.e. char Buffer[10000] )
932 $(Verb) $(FLEX) -t $< | \
933 $(SED) 's/void yyunput/inline void yyunput/' | \
934 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
935 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
939 -$(Verb) $(RM) -f $(LexOutput)
940 $(Verb) $(RM) -f $(LexOutput)
944 #---------------------------------------------------------
945 # Provide rules for generating a .cpp and .h source files
946 # from yacc (bison) input sources.
947 #---------------------------------------------------------
949 YaccFiles := $(filter %.y,$(Sources))
950 ifneq ($(YaccFiles),)
951 YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
953 .PRECIOUS: $(YaccOutput)
955 # Cancel built-in rules for yacc
960 # Rule for building the bison parsers...
962 $(Echo) "Bisoning $*.y"
963 $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
964 $(Verb) $(MV) -f $*.tab.c $*.cpp
965 $(Verb) $(MV) -f $*.tab.h $*.h
968 -$(Verb) $(RM) -f $(YaccOutput)
969 $(Verb) $(RM) -f $(YaccOutput)
972 ###############################################################################
973 # OTHER RULES: Other rules needed
974 ###############################################################################
976 # To create postscript files from dot files...
979 $(DOT) -Tps < $< > $@
982 $(Echo) "Cannot build $@: The program dot is not installed"
985 # This rules ensures that header files that are removed still have a rule for
986 # which they can be "generated." This allows make to ignore them and
987 # reproduce the dependency lists.
990 # Define clean-local to clean the current directory. Note that this uses a
991 # very conservative approach ensuring that empty variables do not cause
992 # errors or disastrous removal.
994 ifneq ($(strip $(ObjDir)),)
995 -$(Verb) $(RM) -rf $(ObjDir)
997 -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
998 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
999 -$(Verb) $(RM) -f *$(SHLIBEXT)
1003 -$(Verb) $(RM) -rf Debug Release Profile
1005 # Build tags database for Emacs/Xemacs:
1009 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
1010 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
1011 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1012 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1013 -name '*.cpp' -o -name '*.h' | \
1014 $(ETAGS) $(ETAGSFLAGS) -
1017 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
1018 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
1019 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1020 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1021 \( -name '*.cpp' -o -name '*.h' \) -print | \
1022 ctags -ImtT -o $(BUILD_OBJ_ROOT)/CTAGS -L -
1025 ###############################################################################
1026 # DEPENDENCIES: Include the dependency files if we should
1027 ###############################################################################
1028 ifndef DISABLE_AUTO_DEPENDENCIES
1030 # If its not one of the cleaning targets
1031 ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
1033 # Get the list of dependency files
1034 DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
1035 DependFiles := $(patsubst %,$(BUILD_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
1037 -include /dev/null $(DependFiles)
1043 ###############################################################################
1044 # DISTRIBUTION: Handle construction of a distribution tarball
1045 ###############################################################################
1047 #------------------------------------------------------------------------
1048 # Define distribution related variables
1049 #------------------------------------------------------------------------
1050 DistName := $(LLVM_TARBALL_NAME)
1051 DistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1052 TopDistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1053 DistTarGZip := $(BUILD_OBJ_ROOT)/$(DistName).tar.gz
1054 DistZip := $(BUILD_OBJ_ROOT)/$(DistName).zip
1055 DistTarBZ2 := $(BUILD_OBJ_ROOT)/$(DistName).tar.bz2
1056 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1057 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1058 Makefile.config.in configure autoconf
1059 DistOther := $(notdir $(wildcard \
1060 $(BUILD_SRC_DIR)/*.h \
1061 $(BUILD_SRC_DIR)/*.td \
1062 $(BUILD_SRC_DIR)/*.def \
1063 $(BUILD_SRC_DIR)/*.ll \
1064 $(BUILD_SRC_DIR)/*.in))
1065 DistSubDirs := $(SubDirs)
1066 DistSources = $(Sources) $(EXTRA_DIST)
1067 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
1069 #------------------------------------------------------------------------
1070 # We MUST build distribution with OBJ_DIR != SRC_DIR
1071 #------------------------------------------------------------------------
1072 ifeq ($(BUILD_SRC_DIR),$(BUILD_OBJ_DIR))
1073 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1074 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1079 DistCheckTop := check
1081 #------------------------------------------------------------------------
1082 # Prevent catastrophic remove
1083 #------------------------------------------------------------------------
1084 ifeq ($(LLVM_TARBALL_NAME),)
1085 $(error LLVM_TARBALL_NAME is empty. Please rerun configure)
1088 #------------------------------------------------------------------------
1089 # Prevent attempt to run dist targets from anywhere but the top level
1090 #------------------------------------------------------------------------
1093 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1094 $(Echo) ERROR: You must run $@ from $(BUILD_OBJ_ROOT)
1098 #------------------------------------------------------------------------
1099 # Provide the top level targets
1100 #------------------------------------------------------------------------
1102 dist-gzip:: $(DistTarGZip)
1104 $(DistTarGZip) : distdir
1105 $(Echo) Packing gzipped distribution tar file.
1106 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1107 $(GZIP) -c > "$(DistTarGZip)"
1109 dist-bzip2:: $(DistTarBZ2)
1111 $(DistTarBZ2) : distdir
1112 $(Echo) Packing bzipped distribution tar file.
1113 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1114 $(BZIP2) -c >$(DistTarBZ2)
1116 dist-zip:: $(DistZip)
1118 $(DistZip) : distdir
1119 $(Echo) Packing zipped distribution file.
1120 $(Verb) rm -f $(DistZip)
1121 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1123 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
1124 $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
1126 DistCheckDir := $(LLVM_OBJ_ROOT)/_distcheckdir
1128 dist-check:: $(DistCheckTop) $(DistTarGZip)
1129 $(Echo) Checking distribution tar file.
1130 $(Verb) if test -d $(DistCheckDir) ; then \
1131 $(RM) -rf $(DistCheckDir) ; \
1133 $(Verb) $(MKDIR) $(DistCheckDir)
1134 $(Verb) cd $(DistCheckDir) && \
1135 $(MKDIR) $(DistCheckDir)/build && \
1136 $(MKDIR) $(DistCheckDir)/install && \
1137 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1139 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1140 --srcdir=../$(DistName) --with-llvmgccdir="$(LLVMGCCDIR)" && \
1142 $(MAKE) install && \
1143 $(MAKE) uninstall && \
1146 $(MAKE) dist-clean && \
1147 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1150 $(Echo) Cleaning distribution files
1151 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) $(DistCheckDir)
1155 #------------------------------------------------------------------------
1156 # Provide the recursive distdir target for building the distribution directory
1157 #------------------------------------------------------------------------
1158 distdir : $(DistSources)
1159 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1160 if test -d "$(DistDir)" ; then \
1161 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
1164 $(EchoCmd) Removing $(DistDir) ; \
1165 $(RM) -rf $(DistDir); \
1167 $(Echo) Building Distribution Directory $(DistDir)
1168 $(Verb) $(MKDIR) $(DistDir)
1169 $(Verb) srcdirstrip=`echo "$(BUILD_SRC_DIR)" | sed 's|.|.|g'`; \
1170 srcrootstrip=`echo "$(BUILD_SRC_ROOT)" | sed 's|.|.|g'`; \
1171 for file in $(DistFiles) ; do \
1173 $(BUILD_SRC_DIR)/*) file=`echo "$$file" | sed "s#^$$srcdirstrip/##"`;; \
1174 $(BUILD_SRC_ROOT)/*) file=`echo "$$file" | sed "s#^$$srcrootstrip/#$(BUILD_OBJ_ROOT)/#"`;; \
1176 if test -f "$$file" || test -d "$$file" ; then \
1179 from_dir=$(BUILD_SRC_DIR); \
1181 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'`; \
1182 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1183 to_dir="$(DistDir)/$$dir"; \
1184 $(MKDIR) "$$to_dir" ; \
1186 to_dir="$(DistDir)"; \
1188 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1189 if test -n "$$mid_dir" ; then \
1190 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1192 if test -d "$$from_dir/$$file"; then \
1193 if test -d "$(BUILD_SRC_DIR)/$$file" && \
1194 test "$$from_dir" != "$(BUILD_SRC_DIR)" ; then \
1195 cp -pR "$(BUILD_SRC_DIR)/$$file" "$$to_dir" || exit 1; \
1197 cp -pR $$from_dir/$$file $$to_dir || exit 1; \
1198 elif test -f "$$from_dir/$$file" ; then \
1199 cp -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1200 elif test -L "$$from_dir/$$file" ; then \
1201 cp -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
1202 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1203 $(EchoCmd) "===== WARNING: Distribution Source $$from_dir/$$file Not Found!" ; \
1204 elif test "$(Verb)" != '@' ; then \
1205 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
1208 $(Verb) for subdir in $(DistSubDirs) ; do \
1209 if test "$$subdir" \!= "." ; then \
1210 new_distdir="$(DistDir)/$$subdir" ; \
1211 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
1212 ( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || exit 1; \
1215 $(Verb) $(MAKE) DistDir="$(DistDir)" dist-hook || exit 1
1216 -$(Verb) find $(DistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
1217 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
1218 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
1219 ! -type d ! -perm -444 -exec $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1220 || chmod -R a+r $(DistDir)
1222 # This is invoked by distdir target, define it as a no-op to avoid errors if not
1228 ###############################################################################
1229 # TOP LEVEL - targets only to apply at the top level directory
1230 ###############################################################################
1234 #------------------------------------------------------------------------
1235 # Install support for project's include files:
1236 #------------------------------------------------------------------------
1238 $(Echo) Installing include files
1239 $(Verb) $(MKDIR) $(includedir)
1240 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1241 cd $(BUILD_SRC_ROOT)/include && \
1242 find . -path '*/Internal' -prune -o '(' -type f \
1243 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1244 -print ')' | grep -v CVS | pax -rwdvpe $(includedir) ; \
1248 $(Echo) Uninstalling include files
1249 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1250 cd $(BUILD_SRC_ROOT)/include && \
1251 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
1252 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1253 -print ')' | grep -v CVS | sed 's#^#$(includedir)/#'` ; \
1258 #------------------------------------------------------------------------
1259 # Print out the directories used for building
1260 #------------------------------------------------------------------------
1262 $(Echo) "BuildMode : " '$(BuildMode)'
1263 $(Echo) "BUILD_SRC_ROOT : " '$(BUILD_SRC_ROOT)'
1264 $(Echo) "BUILD_SRC_DIR : " '$(BUILD_SRC_DIR)'
1265 $(Echo) "BUILD_OBJ_ROOT : " '$(BUILD_OBJ_ROOT)'
1266 $(Echo) "BUILD_OBJ_DIR : " '$(BUILD_OBJ_DIR)'
1267 $(Echo) "LLVM_SRC_ROOT : " '$(LLVM_SRC_ROOT)'
1268 $(Echo) "LLVM_OBJ_ROOT : " '$(LLVM_OBJ_ROOT)'
1269 $(Echo) "libdir : " '$(libdir)'
1270 $(Echo) "bindir : " '$(bindir)'
1271 $(Echo) "sysconfdir : " '$(sysconfdir)'
1272 $(Echo) "bytecode_libdir: " '$(bytecode_libdir)'
1273 $(Echo) "UserTargets : " '$(UserTargets)'
1274 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1275 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1276 $(Echo) "ObjDir : " '$(ObjDir)'
1277 $(Echo) "LibDir : " '$(LibDir)'
1278 $(Echo) "ToolDir : " '$(ToolDir)'
1279 $(Echo) "ExmplDir : " '$(ExmplDir)'
1280 $(Echo) "TDFiles : " '$(TDFiles)'
1281 $(Echo) "INCFiles : " '$(INCFiles)'
1282 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
1283 $(Echo) "Compile.C : " '$(Compile.C)'
1284 $(Echo) "Archive : " '$(Archive)'
1285 $(Echo) "YaccFiles : " '$(YaccFiles)'
1286 $(Echo) "LexFiles : " '$(LexFiles)'