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 # make the C and C++ compilers strip debug info out of bytecode libraries.
514 BCCompile.C += -Wa,-strip-debug
515 BCCompile.CXX += -Wa,-strip-debug
517 all-local:: $(LibName.BCA)
519 ifdef EXPORTED_SYMBOL_FILE
520 BCLinkLib = $(LLVMGCC) -shared -nostdlib -Xlinker \
521 -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
523 $(LibName.BCA): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
524 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
526 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC)
527 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o
529 $(LibName.BCA): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
530 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
531 $(Verb) $(LArchive) $@ $(ObjectsBC)
536 ifneq ($(strip $(LibName.BCA)),)
537 -$(Verb) $(RM) -f $(LibName.BCA)
540 DestBytecodeLib = $(bytecode_libdir)/lib$(LIBRARYNAME).a
542 install-bytecode: $(DestBytecodeLib)
544 install-local:: $(DestBytecodeLib)
546 $(DestBytecodeLib): $(bytecode_libdir) $(LibName.BCA)
547 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
548 $(Verb) $(INSTALL) $(LibName.BCA) $@
551 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
552 -$(Verb) $(RM) -f $(DestBytecodeLib)
556 #---------------------------------------------------------
557 # ReLinked Library Targets:
558 # If the user didn't explicitly forbid building a
559 # relinked then we provide targets for building them.
560 #---------------------------------------------------------
561 ifndef DONT_BUILD_RELINKED
563 all-local:: $(LibName.O)
565 $(LibName.O): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
566 $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
567 $(Verb) $(Relink) -o $@ $(ObjectsO)
570 ifneq ($(strip $(LibName.O)),)
571 -$(Verb) $(RM) -f $(LibName.O)
574 DestRelinkedLib = $(libdir)/$(LIBRARYNAME).o
576 install-local:: $(DestRelinkedLib)
578 $(DestRelinkedLib): $(libdir) $(LibName.O)
579 $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
580 $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
583 $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
584 -$(Verb) $(RM) -f $(DestRelinkedLib)
588 #---------------------------------------------------------
589 # Archive Library Targets:
590 # If the user wanted a regular archive library built,
591 # then we provide targets for building them.
592 #---------------------------------------------------------
595 all-local:: $(LibName.A)
597 $(LibName.A): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
598 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
600 $(Verb) $(Archive) $@ $(ObjectsO)
604 ifneq ($(strip $(LibName.A)),)
605 -$(Verb) $(RM) -f $(LibName.A)
608 DestArchiveLib := $(libdir)/lib$(LIBRARYNAME).a
610 install-local:: $(DestArchiveLib)
612 $(DestArchiveLib): $(libdir) $(LibName.A)
613 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
614 $(Verb) $(MKDIR) $(libdir)
615 $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
618 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
619 -$(Verb) $(RM) -f $(DestArchiveLib)
626 ###############################################################################
627 # Tool Build Rules: Build executable tool based on TOOLNAME option
628 ###############################################################################
632 #---------------------------------------------------------
633 # Handle the special "JIT" value for LLVM_LIBS which is a
634 # shorthand for a bunch of libraries that get the correct
635 # JIT support for a tool that runs JIT.
636 #---------------------------------------------------------
637 ifeq ($(LLVMLIBS),JIT)
639 # Make sure we can get our own symbols in the tool
642 # Generic JIT libraries
643 JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
645 # You can enable the X86 JIT on a non-X86 host by setting the flag
646 # ENABLE_X86_JIT on the make command line. If not, it will still be
647 # enabled automagically on an X86 host.
652 # What the X86 JIT requires
654 JIT_LIBS += LLVMX86 LLVMSelectionDAG
657 # You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
658 # ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
659 # enabled automagically on an SparcV9 host.
660 ifeq ($(ARCH), Sparc)
661 ENABLE_SPARCV9_JIT = 1
664 # What the Sparc JIT requires
665 ifdef ENABLE_SPARCV9_JIT
666 JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
667 LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \
668 LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
669 LLVMDataStructure.a LLVMSparcV9RegAlloc
672 # You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
673 # ENABLE_PPC_JIT on the make command line. If not, it will still be
674 # enabled automagically on an PowerPC host.
675 ifeq ($(ARCH), PowerPC)
679 # What the PowerPC JIT requires
681 JIT_LIBS += LLVMPowerPC
684 LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \
685 LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
686 LLVMSystem.a $(PLATFORMLIBDL)
689 #---------------------------------------------------------
690 # Set up variables for building a tool.
691 #---------------------------------------------------------
693 ToolBuildPath := $(ExmplDir)/$(TOOLNAME)$(EXEEXT)
695 ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
697 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
698 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
699 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
700 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
701 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
702 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
703 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
704 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
706 #---------------------------------------------------------
707 # Tell make that we need to rebuild subdirectories before
708 # we can link the tool. This affects things like LLI which
709 # has library subdirectories.
710 #---------------------------------------------------------
711 $(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
713 #---------------------------------------------------------
714 # Provide targets for building the tools
715 #---------------------------------------------------------
716 all-local:: $(ToolBuildPath)
719 ifneq ($(strip $(ToolBuildPath)),)
720 -$(Verb) $(RM) -f $(ToolBuildPath)
724 $(ToolBuildPath): $(ExmplDir)/.dir
726 $(ToolBuildPath): $(ToolDir)/.dir
729 $(ToolBuildPath): $(BUILT_SOURCES) $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
730 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
731 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
732 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB)
733 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg)
735 DestTool = $(bindir)/$(TOOLNAME)
737 install-local:: $(DestTool)
739 $(DestTool): $(bindir) $(ToolBuildPath)
740 $(Echo) Installing $(BuildMode) $(DestTool)
741 $(Verb) $(INSTALL) $(ToolBuildPath) $(DestTool)
744 $(Echo) Uninstalling $(BuildMode) $(DestTool)
745 -$(Verb) $(RM) -f $(DestTool)
749 ###############################################################################
750 # Object Build Rules: Build object files based on sources
751 ###############################################################################
753 # Provide rule sets for when dependency generation is enabled
754 ifndef DISABLE_AUTO_DEPENDENCIES
756 #---------------------------------------------------------
757 # Create .lo files in the ObjDir directory from the .cpp and .c files...
758 #---------------------------------------------------------
761 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
762 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
763 $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
764 then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
765 else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
767 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
768 $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
769 $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
770 then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
771 else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
773 #---------------------------------------------------------
774 # Create .o files in the ObjDir directory from the .cpp and .c files...
775 #---------------------------------------------------------
778 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
779 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
780 $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
781 then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
782 else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
784 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
785 $(Echo) "Compiling $*.c for $(BuildMode) build"
786 $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
787 then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
788 else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
792 #---------------------------------------------------------
793 # Create .bc files in the ObjDir directory from .cpp and .c files...
794 #---------------------------------------------------------
795 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS)
796 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
797 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
798 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
799 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
801 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS)
802 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
803 $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
804 then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
805 else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
807 # Provide alternate rule sets if dependencies are disabled
812 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
813 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
814 $(LTCompile.CXX) $< -o $@
816 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
817 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
818 $(LTCompile.C) $< -o $@
822 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
823 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
824 $(Compile.CXX) $< -o $@
826 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
827 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
828 $(Compile.C) $< -o $@
831 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS)
832 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
833 $(BCCompile.CXX) $< -o $@
835 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS)
836 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
837 $(BCCompile.C) $< -o $@
841 #---------------------------------------------------------
842 # Provide rule to build .bc files from .ll sources,
843 # regardless of dependencies
844 #---------------------------------------------------------
845 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
846 $(Echo) "Compiling $*.ll for $(BuildMode) build"
847 $(Verb) $(LLVMAS) $< -f -o $@
849 ###############################################################################
850 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
851 ###############################################################################
855 TDFiles := $(strip $(wildcard $(BUILD_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
856 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
858 $(INCFiles) : $(TBLGEN) $(TDFiles)
860 %GenRegisterNames.inc : %.td
861 $(Echo) "Building $(<F) register names with tblgen"
862 $(Verb) $(TableGen) -gen-register-enums -o $@ $<
864 %GenRegisterInfo.h.inc : %.td
865 $(Echo) "Building $(<F) register information header with tblgen"
866 $(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
868 %GenRegisterInfo.inc : %.td
869 $(Echo) "Building $(<F) register info implementation with tblgen"
870 $(Verb) $(TableGen) -gen-register-desc -o $@ $<
872 %GenInstrNames.inc : %.td
873 $(Echo) "Building $(<F) instruction names with tblgen"
874 $(Verb) $(TableGen) -gen-instr-enums -o $@ $<
876 %GenInstrInfo.inc : %.td
877 $(Echo) "Building $(<F) instruction information with tblgen"
878 $(Verb) $(TableGen) -gen-instr-desc -o $@ $<
880 %GenAsmWriter.inc : %.td
881 $(Echo) "Building $(<F) assembly writer with tblgen"
882 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
884 %GenATTAsmWriter.inc : %.td
885 $(Echo) "Building $(<F) AT&T assembly writer with tblgen"
886 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
888 %GenIntelAsmWriter.inc : %.td
889 $(Echo) "Building $(<F) Intel assembly writer with tblgen"
890 $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
892 %GenInstrSelector.inc: %.td
893 $(Echo) "Building $(<F) instruction selector with tblgen"
894 $(Verb) $(TableGen) -gen-instr-selector -o $@ $<
896 %GenCodeEmitter.inc:: %.td
897 $(Echo) "Building $(<F) code emitter with tblgen"
898 $(Verb) $(TableGen) -gen-emitter -o $@ $<
901 -$(Verb) $(RM) -f $(INCFiles)
905 ###############################################################################
906 # LEX AND YACC: Provide rules for generating sources with lex and yacc
907 ###############################################################################
909 #---------------------------------------------------------
910 # Provide rules for generating a .cpp source file from
911 # (f)lex input sources.
912 #---------------------------------------------------------
914 LexFiles := $(filter %.l,$(Sources))
918 LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
920 .PRECIOUS: $(LexOutput)
922 # Note the extra sed filtering here, used to cut down on the warnings emited
923 # by GCC. The last line is a gross hack to work around flex aparently not
924 # being able to resize the buffer on a large token input. Currently, for
925 # uninitialized string buffers in LLVM we can generate very long tokens, so
926 # this is a hack around it.
927 # FIXME. (f.e. char Buffer[10000] )
930 $(Verb) $(FLEX) -t $< | \
931 $(SED) 's/void yyunput/inline void yyunput/' | \
932 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
933 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
937 -$(Verb) $(RM) -f $(LexOutput)
938 $(Verb) $(RM) -f $(LexOutput)
942 #---------------------------------------------------------
943 # Provide rules for generating a .cpp and .h source files
944 # from yacc (bison) input sources.
945 #---------------------------------------------------------
947 YaccFiles := $(filter %.y,$(Sources))
948 ifneq ($(YaccFiles),)
949 YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
951 .PRECIOUS: $(YaccOutput)
953 # Cancel built-in rules for yacc
958 # Rule for building the bison parsers...
960 $(Echo) "Bisoning $*.y"
961 $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
962 $(Verb) $(MV) -f $*.tab.c $*.cpp
963 $(Verb) $(MV) -f $*.tab.h $*.h
966 -$(Verb) $(RM) -f $(YaccOutput)
967 $(Verb) $(RM) -f $(YaccOutput)
970 ###############################################################################
971 # OTHER RULES: Other rules needed
972 ###############################################################################
974 # To create postscript files from dot files...
977 $(DOT) -Tps < $< > $@
980 $(Echo) "Cannot build $@: The program dot is not installed"
983 # This rules ensures that header files that are removed still have a rule for
984 # which they can be "generated." This allows make to ignore them and
985 # reproduce the dependency lists.
988 # Define clean-local to clean the current directory. Note that this uses a
989 # very conservative approach ensuring that empty variables do not cause
990 # errors or disastrous removal.
992 ifneq ($(strip $(ObjDir)),)
993 -$(Verb) $(RM) -rf $(ObjDir)
995 -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
996 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
997 -$(Verb) $(RM) -f *$(SHLIBEXT)
1001 -$(Verb) $(RM) -rf Debug Release Profile
1003 # Build tags database for Emacs/Xemacs:
1007 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
1008 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
1009 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1010 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1011 -name '*.cpp' -o -name '*.h' | \
1012 $(ETAGS) $(ETAGSFLAGS) -
1015 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
1016 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
1017 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1018 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1019 \( -name '*.cpp' -o -name '*.h' \) -print | \
1020 ctags -ImtT -o $(BUILD_OBJ_ROOT)/CTAGS -L -
1023 ###############################################################################
1024 # DEPENDENCIES: Include the dependency files if we should
1025 ###############################################################################
1026 ifndef DISABLE_AUTO_DEPENDENCIES
1028 # If its not one of the cleaning targets
1029 ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
1031 # Get the list of dependency files
1032 DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
1033 DependFiles := $(patsubst %,$(BUILD_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
1035 -include /dev/null $(DependFiles)
1041 ###############################################################################
1042 # DISTRIBUTION: Handle construction of a distribution tarball
1043 ###############################################################################
1045 #------------------------------------------------------------------------
1046 # Define distribution related variables
1047 #------------------------------------------------------------------------
1048 DistName := $(LLVM_TARBALL_NAME)
1049 DistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1050 TopDistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1051 DistTarGZip := $(BUILD_OBJ_ROOT)/$(DistName).tar.gz
1052 DistZip := $(BUILD_OBJ_ROOT)/$(DistName).zip
1053 DistTarBZ2 := $(BUILD_OBJ_ROOT)/$(DistName).tar.bz2
1054 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1055 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1056 Makefile.config.in configure autoconf
1057 DistOther := $(notdir $(wildcard \
1058 $(BUILD_SRC_DIR)/*.h \
1059 $(BUILD_SRC_DIR)/*.td \
1060 $(BUILD_SRC_DIR)/*.def \
1061 $(BUILD_SRC_DIR)/*.ll \
1062 $(BUILD_SRC_DIR)/*.in))
1063 DistSubDirs := $(SubDirs)
1064 DistSources = $(Sources) $(EXTRA_DIST)
1065 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
1067 #------------------------------------------------------------------------
1068 # We MUST build distribution with OBJ_DIR != SRC_DIR
1069 #------------------------------------------------------------------------
1070 ifeq ($(BUILD_SRC_DIR),$(BUILD_OBJ_DIR))
1071 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1072 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1077 DistCheckTop := check
1079 #------------------------------------------------------------------------
1080 # Prevent catastrophic remove
1081 #------------------------------------------------------------------------
1082 ifeq ($(LLVM_TARBALL_NAME),)
1083 $(error LLVM_TARBALL_NAME is empty. Please rerun configure)
1086 #------------------------------------------------------------------------
1087 # Prevent attempt to run dist targets from anywhere but the top level
1088 #------------------------------------------------------------------------
1091 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1092 $(Echo) ERROR: You must run $@ from $(BUILD_OBJ_ROOT)
1096 #------------------------------------------------------------------------
1097 # Provide the top level targets
1098 #------------------------------------------------------------------------
1100 dist-gzip:: $(DistTarGZip)
1102 $(DistTarGZip) : distdir
1103 $(Echo) Packing gzipped distribution tar file.
1104 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1105 $(GZIP) -c > "$(DistTarGZip)"
1107 dist-bzip2:: $(DistTarBZ2)
1109 $(DistTarBZ2) : distdir
1110 $(Echo) Packing bzipped distribution tar file.
1111 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1112 $(BZIP2) -c >$(DistTarBZ2)
1114 dist-zip:: $(DistZip)
1116 $(DistZip) : distdir
1117 $(Echo) Packing zipped distribution file.
1118 $(Verb) rm -f $(DistZip)
1119 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1121 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
1122 $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
1124 DistCheckDir := $(LLVM_OBJ_ROOT)/_distcheckdir
1126 dist-check:: $(DistCheckTop) $(DistTarGZip)
1127 $(Echo) Checking distribution tar file.
1128 $(Verb) if test -d $(DistCheckDir) ; then \
1129 $(RM) -rf $(DistCheckDir) ; \
1131 $(Verb) $(MKDIR) $(DistCheckDir)
1132 $(Verb) cd $(DistCheckDir) && \
1133 $(MKDIR) $(DistCheckDir)/build && \
1134 $(MKDIR) $(DistCheckDir)/install && \
1135 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1137 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1138 --srcdir=../$(DistName) --with-llvmgccdir="$(LLVMGCCDIR)" && \
1140 $(MAKE) install && \
1141 $(MAKE) uninstall && \
1144 $(MAKE) dist-clean && \
1145 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1148 $(Echo) Cleaning distribution files
1149 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) $(DistCheckDir)
1153 #------------------------------------------------------------------------
1154 # Provide the recursive distdir target for building the distribution directory
1155 #------------------------------------------------------------------------
1156 distdir : $(DistSources)
1157 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1158 if test -d "$(DistDir)" ; then \
1159 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
1162 $(EchoCmd) Removing $(DistDir) ; \
1163 $(RM) -rf $(DistDir); \
1165 $(Echo) Building Distribution Directory $(DistDir)
1166 $(Verb) $(MKDIR) $(DistDir)
1167 $(Verb) srcdirstrip=`echo "$(BUILD_SRC_DIR)" | sed 's|.|.|g'`; \
1168 srcrootstrip=`echo "$(BUILD_SRC_ROOT)" | sed 's|.|.|g'`; \
1169 for file in $(DistFiles) ; do \
1171 $(BUILD_SRC_DIR)/*) file=`echo "$$file" | sed "s#^$$srcdirstrip/##"`;; \
1172 $(BUILD_SRC_ROOT)/*) file=`echo "$$file" | sed "s#^$$srcrootstrip/#$(BUILD_OBJ_ROOT)/#"`;; \
1174 if test -f "$$file" || test -d "$$file" ; then \
1177 from_dir=$(BUILD_SRC_DIR); \
1179 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'`; \
1180 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1181 to_dir="$(DistDir)/$$dir"; \
1182 $(MKDIR) "$$to_dir" ; \
1184 to_dir="$(DistDir)"; \
1186 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1187 if test -n "$$mid_dir" ; then \
1188 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1190 if test -d "$$from_dir/$$file"; then \
1191 if test -d "$(BUILD_SRC_DIR)/$$file" && \
1192 test "$$from_dir" != "$(BUILD_SRC_DIR)" ; then \
1193 cp -pR "$(BUILD_SRC_DIR)/$$file" "$$to_dir" || exit 1; \
1195 cp -pR $$from_dir/$$file $$to_dir || exit 1; \
1196 elif test -f "$$from_dir/$$file" ; then \
1197 cp -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1198 elif test -L "$$from_dir/$$file" ; then \
1199 cp -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
1200 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1201 $(EchoCmd) "===== WARNING: Distribution Source $$from_dir/$$file Not Found!" ; \
1202 elif test "$(Verb)" != '@' ; then \
1203 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
1206 $(Verb) for subdir in $(DistSubDirs) ; do \
1207 if test "$$subdir" \!= "." ; then \
1208 new_distdir="$(DistDir)/$$subdir" ; \
1209 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
1210 ( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || exit 1; \
1213 $(Verb) $(MAKE) DistDir="$(DistDir)" dist-hook || exit 1
1214 -$(Verb) find $(DistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
1215 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
1216 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
1217 ! -type d ! -perm -444 -exec $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1218 || chmod -R a+r $(DistDir)
1220 # This is invoked by distdir target, define it as a no-op to avoid errors if not
1226 ###############################################################################
1227 # TOP LEVEL - targets only to apply at the top level directory
1228 ###############################################################################
1232 #------------------------------------------------------------------------
1233 # Install support for project's include files:
1234 #------------------------------------------------------------------------
1236 $(Echo) Installing include files
1237 $(Verb) $(MKDIR) $(includedir)
1238 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1239 cd $(BUILD_SRC_ROOT)/include && \
1240 find . -path '*/Internal' -prune -o '(' -type f \
1241 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1242 -print ')' | grep -v CVS | pax -rwdvpe $(includedir) ; \
1246 $(Echo) Uninstalling include files
1247 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1248 cd $(BUILD_SRC_ROOT)/include && \
1249 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
1250 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1251 -print ')' | grep -v CVS | sed 's#^#$(includedir)/#'` ; \
1256 #------------------------------------------------------------------------
1257 # Print out the directories used for building
1258 #------------------------------------------------------------------------
1260 $(Echo) "BuildMode : " '$(BuildMode)'
1261 $(Echo) "BUILD_SRC_ROOT : " '$(BUILD_SRC_ROOT)'
1262 $(Echo) "BUILD_SRC_DIR : " '$(BUILD_SRC_DIR)'
1263 $(Echo) "BUILD_OBJ_ROOT : " '$(BUILD_OBJ_ROOT)'
1264 $(Echo) "BUILD_OBJ_DIR : " '$(BUILD_OBJ_DIR)'
1265 $(Echo) "LLVM_SRC_ROOT : " '$(LLVM_SRC_ROOT)'
1266 $(Echo) "LLVM_OBJ_ROOT : " '$(LLVM_OBJ_ROOT)'
1267 $(Echo) "libdir : " '$(libdir)'
1268 $(Echo) "bindir : " '$(bindir)'
1269 $(Echo) "sysconfdir : " '$(sysconfdir)'
1270 $(Echo) "bytecode_libdir: " '$(bytecode_libdir)'
1271 $(Echo) "UserTargets : " '$(UserTargets)'
1272 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1273 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1274 $(Echo) "ObjDir : " '$(ObjDir)'
1275 $(Echo) "LibDir : " '$(LibDir)'
1276 $(Echo) "ToolDir : " '$(ToolDir)'
1277 $(Echo) "ExmplDir : " '$(ExmplDir)'
1278 $(Echo) "TDFiles : " '$(TDFiles)'
1279 $(Echo) "INCFiles : " '$(INCFiles)'
1280 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
1281 $(Echo) "Compile.C : " '$(Compile.C)'
1282 $(Echo) "Archive : " '$(Archive)'
1283 $(Echo) "YaccFiles : " '$(YaccFiles)'
1284 $(Echo) "LexFiles : " '$(LexFiles)'