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
23 LocalTargets := all-local clean-local clean-all-local check-local \
24 install-local printvars uninstall-local
25 TopLevelTargets := dist dist-check dist-clean tags dist-gzip dist-bzip2 \
27 UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
28 InternalTargets := preconditions distdir dist-hook
30 ################################################################################
31 # INITIALIZATION: Basic things the makefile needs
32 ################################################################################
34 #--------------------------------------------------------------------
35 # Set the VPATH so that we can find source files.
36 #--------------------------------------------------------------------
37 VPATH=$(BUILD_SRC_DIR)
39 #--------------------------------------------------------------------
40 # Reset the list of suffixes we know how to build
41 #--------------------------------------------------------------------
43 .SUFFIXES: .c .cpp .h .hpp .y .l .lo .o .a .bc .td .ps .dot
44 .SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
46 #--------------------------------------------------------------------
47 # Mark all of these targets as phony to avoid implicit rule search
48 #--------------------------------------------------------------------
49 .PHONY: $(UserTargets) $(InternalTargets)
51 #--------------------------------------------------------------------
52 # Make sure all the user-target rules are double colon rules and
53 # they are defined first.
54 #--------------------------------------------------------------------
58 ################################################################################
59 # PRECONDITIONS: that which must be built/checked first
60 ################################################################################
62 SrcMakefiles := $(filter %Makefile %Makefile.tests %Makefile.JIT,\
63 $(wildcard $(BUILD_SRC_DIR)/Makefile*))
64 ObjMakefiles := $(subst $(BUILD_SRC_DIR),$(BUILD_OBJ_DIR),$(SrcMakefiles))
65 ConfigureScript := $(LLVM_SRC_ROOT)/configure
66 ConfigStatusScript := $(LLVM_OBJ_ROOT)/config.status
67 MakefileConfigIn := $(LLVM_SRC_ROOT)/Makefile.config.in
68 MakefileConfig := $(LLVM_OBJ_ROOT)/Makefile.config
69 PreConditions := $(ConfigStatusScript) $(MakefileConfig) $(ObjMakefiles)
71 preconditions : $(PreConditions)
73 #------------------------------------------------------------------------
74 # Make sure the BUILT_SOURCES are built first
75 #------------------------------------------------------------------------
76 $(filter-out clean clean-local,UserTargets):: $(BUILT_SOURCES)
79 ifneq ($(strip $(BUILT_SOURCES)),)
80 -$(Verb) $(RM) -f $(BUILT_SOURCES)
83 $(BUILT_SOURCES) : $(ObjMakefiles)
85 #------------------------------------------------------------------------
86 # Make sure we're not using a stale configuration
87 #------------------------------------------------------------------------
88 .PRECIOUS: $(ConfigStatusScript)
89 $(ConfigStatusScript): $(ConfigureScript)
90 $(Echo) Reconfiguring with $<
91 $(Verb) cd $(BUILD_OBJ_ROOT) && \
92 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
95 #------------------------------------------------------------------------
96 # Make sure the configuration makefile is up to date
97 #------------------------------------------------------------------------
98 $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
99 $(Echo) Regenerating $@
100 $(Verb) cd $(LLVM_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
102 #------------------------------------------------------------------------
103 # If the Makefile in the source tree has been updated, copy it over into the
104 # build tree. But, only do this if the source and object makefiles differ
105 #------------------------------------------------------------------------
106 ifneq ($(BUILD_OBJ_DIR),$(BUILD_SRC_DIR))
108 Makefile: $(BUILD_SRC_DIR)/Makefile
109 $(Echo) "Updating Makefile"
110 $(Verb) $(MKDIR) $(@D)
113 # Copy the Makefile.* files unless we're in the root directory which avoids
114 # the copying of Makefile.config.in or other things that should be explicitly
116 $(BUILD_OBJ_DIR)/Makefile% : $(BUILD_SRC_DIR)/Makefile%
118 *Makefile.rules) ;; \
120 *) $(Echo) "Updating $(@F)" ; \
127 #------------------------------------------------------------------------
128 # Set up the basic dependencies
129 #------------------------------------------------------------------------
130 $(UserTargets):: $(PreConditions)
135 clean-all:: clean-local clean-all-local
136 install:: install-local
137 uninstall:: uninstall-local
138 check-local:: all-local
139 install-local:: all-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
392 # recursive targets are added.
393 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
394 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
395 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
396 check :: $(addsuffix /.makecheck ,$(PARALLEL_DIRS))
397 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
398 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
400 Parallel_Targets := $(foreach T,$(RecursiveTargets),%/.make$(T))
402 $(Parallel_Targets) :
403 $(Verb) if [ ! -f $(@D)/Makefile ]; then \
405 cp $(BUILD_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
407 $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
410 #---------------------------------------------------------
411 # Handle the OPTIONAL_DIRS options for directores that may
413 #---------------------------------------------------------
416 SubDirs += $(OPTIONAL_DIRS)
418 $(RecursiveTargets)::
419 $(Verb) for dir in $(OPTIONAL_DIRS); do \
420 if [ -d $(BUILD_SRC_DIR)/$$dir ]; then\
421 if [ ! -f $$dir/Makefile ]; then \
423 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
425 ($(MAKE) -C$$dir $@ ) || exit 1; \
430 #---------------------------------------------------------
431 # Handle the CONFIG_FILES options
432 #---------------------------------------------------------
435 install-local:: $(sysconfdir) $(CONFIG_FILES)
436 $(Echo) Installing Configuration Files To $(sysconfdir)
437 $(Verb)for file in $(CONFIG_FILES); do \
438 if test -f $(BUILD_OBJ_DIR)/$${file} ; then \
439 $(INSTALL) $(BUILD_OBJ_DIR)/$${file} $(sysconfdir) ; \
440 elif test -f $(BUILD_SRC_DIR)/$${file} ; then \
441 $(INSTALL) $(BUILD_SRC_DIR)/$${file} $(sysconfdir) ; \
443 $(ECHO) Error: cannot find config file $${file}. ; \
448 $(Echo) Uninstalling Configuration Files From $(sysconfdir)
449 $(Verb)for file in $(CONFIG_FILES); do \
450 $(RM) -f $(sysconfdir)/$${file} ; \
455 ###############################################################################
456 # Library Build Rules: Four ways to build a library
457 ###############################################################################
460 # if we're building a library ...
463 # Make sure there isn't any extranous whitespace on the LIBRARYNAME option
464 LIBRARYNAME := $(strip $(LIBRARYNAME))
465 LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
466 LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
467 LibName.O := $(LibDir)/$(LIBRARYNAME).o
468 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
470 #---------------------------------------------------------
471 # Shared Library Targets:
472 # If the user asked for a shared library to be built
473 # with the SHARED_LIBRARY variable, then we provide
474 # targets for building them.
475 #---------------------------------------------------------
478 all-local:: $(LibName.LA)
480 $(LibName.LA): $(BUILT_SOURCES) $(ObjectsLO) $(LibDir)/.dir
481 $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
482 $(Verb) $(Link) -o $@ $(ObjectsLO)
483 $(Verb) $(LTInstall) $@ $(LibDir)
486 ifneq ($(strip $(LibName.LA)),)
487 -$(Verb) $(RM) -f $(LibName.LA)
490 DestSharedLib = $(libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
492 install-local:: $(DestSharedLib)
494 $(DestSharedLib): $(libdir) $(LibName.LA)
495 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
496 $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
497 $(Verb) $(LIBTOOL) --finish $(libdir)
500 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
501 -$(Verb) $(RM) -f $(libdir)/lib$(LIBRARYNAME).*
505 #---------------------------------------------------------
506 # Bytecode Library Targets:
507 # If the user asked for a bytecode library to be built
508 # with the BYTECODE_LIBRARY variable, then we provide
509 # targets for building them.
510 #---------------------------------------------------------
511 ifdef BYTECODE_LIBRARY
513 all-local:: $(LibName.BCA)
515 ifdef EXPORTED_SYMBOL_FILE
516 BCLinkLib = $(LLVMGCC) -shared -nostdlib -Xlinker \
517 -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
519 $(LibName.BCA): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
520 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
522 $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC)
523 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o
525 $(LibName.BCA): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
526 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
527 $(Verb) $(LArchive) $@ $(ObjectsBC)
532 ifneq ($(strip $(LibName.BCA)),)
533 -$(Verb) $(RM) -f $(LibName.BCA)
536 DestBytecodeLib = $(bytecode_libdir)/lib$(LIBRARYNAME).a
538 install-bytecode: $(DestBytecodeLib)
540 install-local:: $(DestBytecodeLib)
542 $(DestBytecodeLib): $(bytecode_libdir) $(LibName.BCA)
543 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
544 $(Verb) $(INSTALL) $(LibName.BCA) $@
547 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
548 -$(Verb) $(RM) -f $(DestBytecodeLib)
552 #---------------------------------------------------------
553 # ReLinked Library Targets:
554 # If the user didn't explicitly forbid building a
555 # relinked then we provide targets for building them.
556 #---------------------------------------------------------
557 ifndef DONT_BUILD_RELINKED
559 all-local:: $(LibName.O)
561 $(LibName.O): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
562 $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
563 $(Verb) $(Relink) -o $@ $(ObjectsO)
566 ifneq ($(strip $(LibName.O)),)
567 -$(Verb) $(RM) -f $(LibName.O)
570 DestRelinkedLib = $(libdir)/$(LIBRARYNAME).o
572 install-local:: $(DestRelinkedLib)
574 $(DestRelinkedLib): $(libdir) $(LibName.O)
575 $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
576 $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
579 $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
580 -$(Verb) $(RM) -f $(DestRelinkedLib)
584 #---------------------------------------------------------
585 # Archive Library Targets:
586 # If the user wanted a regular archive library built,
587 # then we provide targets for building them.
588 #---------------------------------------------------------
591 all-local:: $(LibName.A)
593 $(LibName.A): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
594 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
596 $(Verb) $(Archive) $@ $(ObjectsO)
600 ifneq ($(strip $(LibName.A)),)
601 -$(Verb) $(RM) -f $(LibName.A)
604 DestArchiveLib := $(libdir)/lib$(LIBRARYNAME).a
606 install-local:: $(DestArchiveLib)
608 $(DestArchiveLib): $(libdir) $(LibName.A)
609 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
610 $(Verb) $(MKDIR) $(libdir)
611 $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
614 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
615 -$(Verb) $(RM) -f $(DestArchiveLib)
622 ###############################################################################
623 # Tool Build Rules: Build executable tool based on TOOLNAME option
624 ###############################################################################
628 #---------------------------------------------------------
629 # Handle the special "JIT" value for LLVM_LIBS which is a
630 # shorthand for a bunch of libraries that get the correct
631 # JIT support for a tool that runs JIT.
632 #---------------------------------------------------------
633 ifeq ($(LLVMLIBS),JIT)
635 # Make sure we can get our own symbols in the tool
638 # Generic JIT libraries
639 JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
641 # You can enable the X86 JIT on a non-X86 host by setting the flag
642 # ENABLE_X86_JIT on the make command line. If not, it will still be
643 # enabled automagically on an X86 host.
648 # What the X86 JIT requires
650 JIT_LIBS += LLVMX86 LLVMSelectionDAG
653 # You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
654 # ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
655 # enabled automagically on an SparcV9 host.
656 ifeq ($(ARCH), Sparc)
657 ENABLE_SPARCV9_JIT = 1
660 # What the Sparc JIT requires
661 ifdef ENABLE_SPARCV9_JIT
662 JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
663 LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \
664 LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
665 LLVMDataStructure.a LLVMSparcV9RegAlloc
668 # You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
669 # ENABLE_PPC_JIT on the make command line. If not, it will still be
670 # enabled automagically on an PowerPC host.
671 ifeq ($(ARCH), PowerPC)
675 # What the PowerPC JIT requires
677 JIT_LIBS += LLVMPowerPC
680 LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \
681 LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
682 LLVMSystem.a $(PLATFORMLIBDL)
685 #---------------------------------------------------------
686 # Set up variables for building a tool.
687 #---------------------------------------------------------
689 ToolBuildPath := $(ExmplDir)/$(TOOLNAME)$(EXEEXT)
691 ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
693 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
694 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
695 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
696 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
697 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
698 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
699 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
700 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
702 #---------------------------------------------------------
703 # Tell make that we need to rebuild subdirectories before
704 # we can link the tool. This affects things like LLI which
705 # has library subdirectories.
706 #---------------------------------------------------------
707 $(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
709 #---------------------------------------------------------
710 # Provide targets for building the tools
711 #---------------------------------------------------------
712 all-local:: $(ToolBuildPath)
715 ifneq ($(strip $(ToolBuildPath)),)
716 -$(Verb) $(RM) -f $(ToolBuildPath)
720 $(ToolBuildPath): $(ExmplDir)/.dir
722 $(ToolBuildPath): $(ToolDir)/.dir
725 $(ToolBuildPath): $(BUILT_SOURCES) $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
726 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
727 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
728 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB)
729 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg)
731 DestTool = $(bindir)/$(TOOLNAME)
733 install-local:: $(DestTool)
735 $(DestTool): $(bindir) $(ToolBuildPath)
736 $(Echo) Installing $(BuildMode) $(DestTool)
737 $(Verb) $(INSTALL) $(ToolBuildPath) $(DestTool)
740 $(Echo) Uninstalling $(BuildMode) $(DestTool)
741 -$(Verb) $(RM) -f $(DestTool)
745 ###############################################################################
746 # Object Build Rules: Build object files based on sources
747 ###############################################################################
749 # Provide rule sets for when dependency generation is enabled
750 ifndef DISABLE_AUTO_DEPENDENCIES
752 #---------------------------------------------------------
753 # Create .lo files in the ObjDir directory from the .cpp and .c files...
754 #---------------------------------------------------------
757 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
758 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
759 $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
760 then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
761 else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
763 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
764 $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
765 $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
766 then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
767 else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
769 #---------------------------------------------------------
770 # Create .o files in the ObjDir directory from the .cpp and .c files...
771 #---------------------------------------------------------
774 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
775 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
776 $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
777 then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
778 else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
780 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
781 $(Echo) "Compiling $*.c for $(BuildMode) build"
782 $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
783 then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
784 else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
788 #---------------------------------------------------------
789 # Create .bc files in the ObjDir directory from .cpp and .c files...
790 #---------------------------------------------------------
791 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS)
792 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
793 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
794 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
795 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
797 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS)
798 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
799 $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
800 then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
801 else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
803 # Provide alternate rule sets if dependencies are disabled
808 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
809 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
810 $(LTCompile.CXX) $< -o $@
812 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
813 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
814 $(LTCompile.C) $< -o $@
818 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
819 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
820 $(Compile.CXX) $< -o $@
822 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
823 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
824 $(Compile.C) $< -o $@
827 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS)
828 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
829 $(BCCompile.CXX) $< -o $@
831 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS)
832 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
833 $(BCCompile.C) $< -o $@
837 #---------------------------------------------------------
838 # Provide rule to build .bc files from .ll sources,
839 # regardless of dependencies
840 #---------------------------------------------------------
841 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
842 $(Echo) "Compiling $*.ll for $(BuildMode) build"
843 $(Verb) $(LLVMAS) $< -f -o $@
845 ###############################################################################
846 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
847 ###############################################################################
851 TDFiles := $(strip $(wildcard $(BUILD_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
852 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
854 $(INCFiles) : $(TBLGEN) $(TDFiles)
856 %GenRegisterNames.inc : %.td
857 $(Echo) "Building $(<F) register names with tblgen"
858 $(Verb) $(TableGen) -gen-register-enums -o $@ $<
860 %GenRegisterInfo.h.inc : %.td
861 $(Echo) "Building $(<F) register information header with tblgen"
862 $(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
864 %GenRegisterInfo.inc : %.td
865 $(Echo) "Building $(<F) register info implementation with tblgen"
866 $(Verb) $(TableGen) -gen-register-desc -o $@ $<
868 %GenInstrNames.inc : %.td
869 $(Echo) "Building $(<F) instruction names with tblgen"
870 $(Verb) $(TableGen) -gen-instr-enums -o $@ $<
872 %GenInstrInfo.inc : %.td
873 $(Echo) "Building $(<F) instruction information with tblgen"
874 $(Verb) $(TableGen) -gen-instr-desc -o $@ $<
876 %GenAsmWriter.inc : %.td
877 $(Echo) "Building $(<F) assembly writer with tblgen"
878 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
880 %GenATTAsmWriter.inc : %.td
881 $(Echo) "Building $(<F) AT&T assembly writer with tblgen"
882 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
884 %GenIntelAsmWriter.inc : %.td
885 $(Echo) "Building $(<F) Intel assembly writer with tblgen"
886 $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
888 %GenInstrSelector.inc: %.td
889 $(Echo) "Building $(<F) instruction selector with tblgen"
890 $(Verb) $(TableGen) -gen-instr-selector -o $@ $<
892 %GenCodeEmitter.inc:: %.td
893 $(Echo) "Building $(<F) code emitter with tblgen"
894 $(Verb) $(TableGen) -gen-emitter -o $@ $<
897 -$(Verb) $(RM) -f $(INCFiles)
901 ###############################################################################
902 # LEX AND YACC: Provide rules for generating sources with lex and yacc
903 ###############################################################################
905 #---------------------------------------------------------
906 # Provide rules for generating a .cpp source file from
907 # (f)lex input sources.
908 #---------------------------------------------------------
910 LexFiles := $(filter %.l,$(Sources))
914 LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
916 .PRECIOUS: $(LexOutput)
918 # Note the extra sed filtering here, used to cut down on the warnings emited
919 # by GCC. The last line is a gross hack to work around flex aparently not
920 # being able to resize the buffer on a large token input. Currently, for
921 # uninitialized string buffers in LLVM we can generate very long tokens, so
922 # this is a hack around it.
923 # FIXME. (f.e. char Buffer[10000] )
926 $(Verb) $(FLEX) -t $< | \
927 $(SED) 's/void yyunput/inline void yyunput/' | \
928 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
929 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
933 -$(Verb) $(RM) -f $(LexOutput)
934 $(Verb) $(RM) -f $(LexOutput)
938 #---------------------------------------------------------
939 # Provide rules for generating a .cpp and .h source files
940 # from yacc (bison) input sources.
941 #---------------------------------------------------------
943 YaccFiles := $(filter %.y,$(Sources))
944 ifneq ($(YaccFiles),)
945 YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
947 .PRECIOUS: $(YaccOutput)
949 # Cancel built-in rules for yacc
954 # Rule for building the bison parsers...
956 $(Echo) "Bisoning $*.y"
957 $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
958 $(Verb) $(MV) -f $*.tab.c $*.cpp
959 $(Verb) $(MV) -f $*.tab.h $*.h
962 -$(Verb) $(RM) -f $(YaccOutput)
963 $(Verb) $(RM) -f $(YaccOutput)
966 ###############################################################################
967 # OTHER RULES: Other rules needed
968 ###############################################################################
970 # To create postscript files from dot files...
973 $(DOT) -Tps < $< > $@
976 $(Echo) "Cannot build $@: The program dot is not installed"
979 # This rules ensures that header files that are removed still have a rule for
980 # which they can be "generated." This allows make to ignore them and
981 # reproduce the dependency lists.
984 # Define clean-local to clean the current directory. Note that this uses a
985 # very conservative approach ensuring that empty variables do not cause
986 # errors or disastrous removal.
988 ifneq ($(strip $(ObjDir)),)
989 -$(Verb) $(RM) -rf $(ObjDir)
991 -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
992 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
993 -$(Verb) $(RM) -f *$(SHLIBEXT)
997 -$(Verb) $(RM) -rf Debug Release Profile
999 # Build tags database for Emacs/Xemacs:
1003 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
1004 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
1005 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1006 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1007 -name '*.cpp' -o -name '*.h' | \
1008 $(ETAGS) $(ETAGSFLAGS) -
1011 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
1012 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
1013 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1014 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1015 \( -name '*.cpp' -o -name '*.h' \) -print | \
1016 ctags -ImtT -o $(BUILD_OBJ_ROOT)/CTAGS -L -
1019 ###############################################################################
1020 # DEPENDENCIES: Include the dependency files if we should
1021 ###############################################################################
1022 ifndef DISABLE_AUTO_DEPENDENCIES
1024 # If its not one of the cleaning targets
1025 ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
1027 # Get the list of dependency files
1028 DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
1029 DependFiles := $(patsubst %,$(BUILD_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
1031 -include /dev/null $(DependFiles)
1037 ###############################################################################
1038 # DISTRIBUTION: Handle construction of a distribution tarball
1039 ###############################################################################
1041 #------------------------------------------------------------------------
1042 # Define distribution related variables
1043 #------------------------------------------------------------------------
1044 DistName := $(LLVM_TARBALL_NAME)
1045 DistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1046 TopDistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1047 DistTarGZip := $(BUILD_OBJ_ROOT)/$(DistName).tar.gz
1048 DistZip := $(BUILD_OBJ_ROOT)/$(DistName).zip
1049 DistTarBZ2 := $(BUILD_OBJ_ROOT)/$(DistName).tar.bz2
1050 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1051 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1052 Makefile.config.in configure autoconf
1053 DistOther := $(notdir $(wildcard \
1054 $(BUILD_SRC_DIR)/*.h \
1055 $(BUILD_SRC_DIR)/*.td \
1056 $(BUILD_SRC_DIR)/*.def \
1057 $(BUILD_SRC_DIR)/*.ll \
1058 $(BUILD_SRC_DIR)/*.in))
1059 DistSubDirs := $(SubDirs)
1060 DistSources = $(Sources) $(EXTRA_DIST)
1061 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
1063 #------------------------------------------------------------------------
1064 # We MUST build distribution with OBJ_DIR != SRC_DIR
1065 #------------------------------------------------------------------------
1066 ifeq ($(BUILD_SRC_DIR),$(BUILD_OBJ_DIR))
1067 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1068 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1073 DistCheckTop := check
1075 #------------------------------------------------------------------------
1076 # Prevent catastrophic remove
1077 #------------------------------------------------------------------------
1078 ifeq ($(LLVM_TARBALL_NAME),)
1079 $(error LLVM_TARBALL_NAME is empty. Please rerun configure)
1082 #------------------------------------------------------------------------
1083 # Prevent attempt to run dist targets from anywhere but the top level
1084 #------------------------------------------------------------------------
1087 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1088 $(Echo) ERROR: You must run $@ from $(BUILD_OBJ_ROOT)
1092 #------------------------------------------------------------------------
1093 # Provide the top level targets
1094 #------------------------------------------------------------------------
1096 dist-gzip:: $(DistTarGZip)
1098 $(DistTarGZip) : distdir
1099 $(Echo) Packing gzipped distribution tar file.
1100 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1101 $(GZIP) -c > "$(DistTarGZip)"
1103 dist-bzip2:: $(DistTarBZ2)
1105 $(DistTarBZ2) : distdir
1106 $(Echo) Packing bzipped distribution tar file.
1107 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1108 $(BZIP2) -c >$(DistTarBZ2)
1110 dist-zip:: $(DistZip)
1112 $(DistZip) : distdir
1113 $(Echo) Packing zipped distribution file.
1114 $(Verb) rm -f $(DistZip)
1115 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1117 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
1118 $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
1120 DistCheckDir := $(LLVM_OBJ_ROOT)/_distcheckdir
1122 dist-check:: $(DistCheckTop) $(DistTarGZip)
1123 $(Echo) Checking distribution tar file.
1124 $(Verb) if test -d $(DistCheckDir) ; then \
1125 $(RM) -rf $(DistCheckDir) ; \
1127 $(Verb) $(MKDIR) $(DistCheckDir)
1128 $(Verb) cd $(DistCheckDir) && \
1129 $(MKDIR) $(DistCheckDir)/build && \
1130 $(MKDIR) $(DistCheckDir)/install && \
1131 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1133 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1134 --srcdir=../$(DistName) --with-llvmgccdir="$(LLVMGCCDIR)" && \
1136 $(MAKE) install && \
1137 $(MAKE) uninstall && \
1140 $(MAKE) dist-clean && \
1141 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1144 $(Echo) Cleaning distribution files
1145 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) $(DistCheckDir)
1149 #------------------------------------------------------------------------
1150 # Provide the recursive distdir target for building the distribution directory
1151 #------------------------------------------------------------------------
1152 distdir : $(DistSources)
1153 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1154 if test -d "$(DistDir)" ; then \
1155 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
1158 $(EchoCmd) Removing $(DistDir) ; \
1159 $(RM) -rf $(DistDir); \
1161 $(Echo) Building Distribution Directory $(DistDir)
1162 $(Verb) $(MKDIR) $(DistDir)
1163 $(Verb) srcdirstrip=`echo "$(BUILD_SRC_DIR)" | sed 's|.|.|g'`; \
1164 srcrootstrip=`echo "$(BUILD_SRC_ROOT)" | sed 's|.|.|g'`; \
1165 for file in $(DistFiles) ; do \
1167 $(BUILD_SRC_DIR)/*) file=`echo "$$file" | sed "s#^$$srcdirstrip/##"`;; \
1168 $(BUILD_SRC_ROOT)/*) file=`echo "$$file" | sed "s#^$$srcrootstrip/#$(BUILD_OBJ_ROOT)/#"`;; \
1170 if test -f "$$file" || test -d "$$file" ; then \
1173 from_dir=$(BUILD_SRC_DIR); \
1175 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'`; \
1176 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1177 to_dir="$(DistDir)/$$dir"; \
1178 $(MKDIR) "$$to_dir" ; \
1180 to_dir="$(DistDir)"; \
1182 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1183 if test -n "$$mid_dir" ; then \
1184 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1186 if test -d "$$from_dir/$$file"; then \
1187 if test -d "$(BUILD_SRC_DIR)/$$file" && \
1188 test "$$from_dir" != "$(BUILD_SRC_DIR)" ; then \
1189 cp -pR "$(BUILD_SRC_DIR)/$$file" "$$to_dir" || exit 1; \
1191 cp -pR $$from_dir/$$file $$to_dir || exit 1; \
1192 elif test -f "$$from_dir/$$file" ; then \
1193 cp -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1194 elif test -L "$$from_dir/$$file" ; then \
1195 cp -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
1196 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1197 $(EchoCmd) "===== WARNING: Distribution Source $$from_dir/$$file Not Found!" ; \
1198 elif test "$(Verb)" != '@' ; then \
1199 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
1202 $(Verb) for subdir in $(DistSubDirs) ; do \
1203 if test "$$subdir" \!= "." ; then \
1204 new_distdir="$(DistDir)/$$subdir" ; \
1205 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
1206 ( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || exit 1; \
1209 $(Verb) $(MAKE) DistDir="$(DistDir)" dist-hook || exit 1
1210 -$(Verb) find $(DistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
1211 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
1212 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
1213 ! -type d ! -perm -444 -exec $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1214 || chmod -R a+r $(DistDir)
1216 # This is invoked by distdir target, define it as a no-op to avoid errors if not
1222 ###############################################################################
1223 # TOP LEVEL - targets only to apply at the top level directory
1224 ###############################################################################
1228 #------------------------------------------------------------------------
1229 # Install support for project's include files:
1230 #------------------------------------------------------------------------
1232 $(Echo) Installing include files
1233 $(Verb) $(MKDIR) $(includedir)
1234 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1235 cd $(BUILD_SRC_ROOT)/include && \
1236 find . -path '*/Internal' -prune -o '(' -type f \
1237 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1238 -print ')' | grep -v CVS | pax -rwdvpe $(includedir) ; \
1242 $(Echo) Uninstalling include files
1243 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1244 cd $(BUILD_SRC_ROOT)/include && \
1245 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
1246 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1247 -print ')' | grep -v CVS | sed 's#^#$(includedir)/#'` ; \
1252 #------------------------------------------------------------------------
1253 # Print out the directories used for building
1254 #------------------------------------------------------------------------
1256 $(Echo) "BuildMode : " '$(BuildMode)'
1257 $(Echo) "BUILD_SRC_ROOT : " '$(BUILD_SRC_ROOT)'
1258 $(Echo) "BUILD_SRC_DIR : " '$(BUILD_SRC_DIR)'
1259 $(Echo) "BUILD_OBJ_ROOT : " '$(BUILD_OBJ_ROOT)'
1260 $(Echo) "BUILD_OBJ_DIR : " '$(BUILD_OBJ_DIR)'
1261 $(Echo) "LLVM_SRC_ROOT : " '$(LLVM_SRC_ROOT)'
1262 $(Echo) "LLVM_OBJ_ROOT : " '$(LLVM_OBJ_ROOT)'
1263 $(Echo) "libdir : " '$(libdir)'
1264 $(Echo) "bindir : " '$(bindir)'
1265 $(Echo) "sysconfdir : " '$(sysconfdir)'
1266 $(Echo) "bytecode_libdir: " '$(bytecode_libdir)'
1267 $(Echo) "UserTargets : " '$(UserTargets)'
1268 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1269 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1270 $(Echo) "ObjDir : " '$(ObjDir)'
1271 $(Echo) "LibDir : " '$(LibDir)'
1272 $(Echo) "ToolDir : " '$(ToolDir)'
1273 $(Echo) "ExmplDir : " '$(ExmplDir)'
1274 $(Echo) "TDFiles : " '$(TDFiles)'
1275 $(Echo) "INCFiles : " '$(INCFiles)'
1276 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
1277 $(Echo) "Compile.C : " '$(Compile.C)'
1278 $(Echo) "Archive : " '$(Archive)'
1279 $(Echo) "YaccFiles : " '$(YaccFiles)'
1280 $(Echo) "LexFiles : " '$(LexFiles)'