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)
235 BCLinkLib.Flags += -v
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 BCLinkLib = $(LLVMGCC) -shared -nostdlib $(BCLinkLib.Flags)
290 LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL)
291 Burg = $(BURG) -I $(BUILD_SRC_DIR)
292 TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR)
293 Archive = $(AR) $(AR.Flags)
294 LArchive = $(ToolDir)/llvm-ar rcsf
301 #----------------------------------------------------------
302 # Get the list of source files
303 #----------------------------------------------------------
305 Sources := $(notdir $(wildcard $(BUILD_SRC_DIR)/*.cpp \
306 $(BUILD_SRC_DIR)/*.cc $(BUILD_SRC_DIR)/*.c $(BUILD_SRC_DIR)/*.y \
307 $(BUILD_SRC_DIR)/*.l))
309 Sources := $(SOURCES)
313 Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
316 #----------------------------------------------------------
317 # Types of objects that can be built from sources
318 #----------------------------------------------------------
319 BaseNameSources := $(sort $(basename $(Sources)))
320 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
321 ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
322 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
324 ###############################################################################
325 # DIRECTORIES: Handle recursive descent of directory structure
326 ###############################################################################
328 #---------------------------------------------------------
329 # Provide rules to make install dirs. This must be early
330 # in the file so they get built before dependencies
331 #---------------------------------------------------------
334 $(Verb) $(MKDIR) $(bindir)
337 $(Verb) $(MKDIR) $(libdir)
340 $(Verb) $(MKDIR) $(bytecode_libdir)
343 $(Verb) $(MKDIR) $(sysconfdir)
345 # To create other directories, as needed, and timestamp their creation
347 $(Verb) $(MKDIR) $* > /dev/null
350 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
351 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
353 #---------------------------------------------------------
354 # Handle the DIRS options for sequential construction
355 #---------------------------------------------------------
360 $(RecursiveTargets)::
361 $(Verb) for dir in $(DIRS); do \
362 if [ ! -f $$dir/Makefile ]; then \
364 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
366 ($(MAKE) -C $$dir $@ ) || exit 1; \
370 #---------------------------------------------------------
371 # Handle the EXPERIMENTAL_DIRS options ensuring success
372 # after each directory is built.
373 #---------------------------------------------------------
374 ifdef EXPERIMENTAL_DIRS
375 $(RecursiveTargets)::
376 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
377 if [ ! -f $$dir/Makefile ]; then \
379 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
381 ($(MAKE) -C $$dir $@ ) || exit 0; \
385 #---------------------------------------------------------
386 # Handle the PARALLEL_DIRS options for parallel construction
387 #---------------------------------------------------------
390 SubDirs += $(PARALLEL_DIRS)
392 # Unfortunately, this list must be maintained if new
393 # 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))
401 Parallel_Targets := $(foreach T,$(RecursiveTargets),%/.make$(T))
403 $(Parallel_Targets) :
404 $(Verb) if [ ! -f $(@D)/Makefile ]; then \
406 cp $(BUILD_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
408 $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
411 #---------------------------------------------------------
412 # Handle the OPTIONAL_DIRS options for directores that may
414 #---------------------------------------------------------
417 SubDirs += $(OPTIONAL_DIRS)
419 $(RecursiveTargets)::
420 $(Verb) for dir in $(OPTIONAL_DIRS); do \
421 if [ -d $(BUILD_SRC_DIR)/$$dir ]; then\
422 if [ ! -f $$dir/Makefile ]; then \
424 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
426 ($(MAKE) -C$$dir $@ ) || exit 1; \
431 #---------------------------------------------------------
432 # Handle the CONFIG_FILES options
433 #---------------------------------------------------------
436 install-local:: $(sysconfdir) $(CONFIG_FILES)
437 $(Echo) Installing Configuration Files To $(sysconfdir)
438 $(Verb)for file in $(CONFIG_FILES); do \
439 if test -f $(BUILD_OBJ_DIR)/$${file} ; then \
440 $(INSTALL) $(BUILD_OBJ_DIR)/$${file} $(sysconfdir) ; \
441 elif test -f $(BUILD_SRC_DIR)/$${file} ; then \
442 $(INSTALL) $(BUILD_SRC_DIR)/$${file} $(sysconfdir) ; \
444 $(ECHO) Error: cannot find config file $${file}. ; \
449 $(Echo) Uninstalling Configuration Files From $(sysconfdir)
450 $(Verb)for file in $(CONFIG_FILES); do \
451 $(RM) -f $(sysconfdir)/$${file} ; \
456 ###############################################################################
457 # Library Build Rules: Four ways to build a library
458 ###############################################################################
461 # if we're building a library ...
464 # Make sure there isn't any extranous whitespace on the LIBRARYNAME option
465 LIBRARYNAME := $(strip $(LIBRARYNAME))
466 LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
467 LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
468 LibName.O := $(LibDir)/$(LIBRARYNAME).o
469 LibName.BC := $(LibDir)/lib$(LIBRARYNAME).bc
471 #---------------------------------------------------------
472 # Shared Library Targets:
473 # If the user asked for a shared library to be built
474 # with the SHARED_LIBRARY variable, then we provide
475 # targets for building them.
476 #---------------------------------------------------------
479 all-local:: $(LibName.LA)
481 $(LibName.LA): $(BUILT_SOURCES) $(ObjectsLO) $(LibDir)/.dir
482 $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
483 $(Verb) $(Link) -o $@ $(ObjectsLO)
484 $(Verb) $(LTInstall) $@ $(LibDir)
487 ifneq ($(strip $(LibName.LA)),)
488 -$(Verb) $(RM) -f $(LibName.LA)
491 DestSharedLib = $(libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
493 install-local:: $(DestSharedLib)
495 $(DestSharedLib): $(libdir) $(LibName.LA)
496 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
497 $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
498 $(Verb) $(LIBTOOL) --finish $(libdir)
501 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
502 -$(Verb) $(RM) -f $(libdir)/lib$(LIBRARYNAME).*
506 #---------------------------------------------------------
507 # Bytecode Library Targets:
508 # If the user asked for a bytecode library to be built
509 # with the BYTECODE_LIBRARY variable, then we provide
510 # targets for building them.
511 #---------------------------------------------------------
512 ifdef BYTECODE_LIBRARY
514 ifdef EXPORTED_SYMBOL_LIST
515 BCLinkLib += -Xlinker -internalize-public-api-list=$(EXPORTED_SYMBOL_LIST)
517 ifdef EXPORTED_SYMBOL_FILE
518 BCLinkLib += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
520 BCLinkLib += -Xlinker -disable-internalize
524 all-local:: $(LibName.BC)
526 $(LibName.BC): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
527 $(Echo) Linking $(BuildMode) Bytecode Library $(notdir $@)
528 $(Verb) $(BCLinkLib) -o $@ $(ObjectsBC)
531 ifneq ($(strip $(LibName.BC)),)
532 -$(Verb) $(RM) -f $(LibName.BC)
535 DestBytecodeLib = $(bytecode_libdir)/lib$(LIBRARYNAME).bc
537 install-local:: $(DestBytecodeLib)
539 $(DestBytecodeLib): $(bytecode_libdir) $(LibName.BC)
540 $(Echo) Installing $(BuildMode) Bytecode Library $(DestBytecodeLib)
541 $(Verb) $(INSTALL) $(LibName.BC) $@
544 $(Echo) Uninstalling $(BuildMode) Bytecode Library $(DestBytecodeLib)
545 -$(Verb) $(RM) -f $(DestBytecodeLib)
549 #---------------------------------------------------------
550 # ReLinked Library Targets:
551 # If the user didn't explicitly forbid building a
552 # relinked then we provide targets for building them.
553 #---------------------------------------------------------
554 ifndef DONT_BUILD_RELINKED
556 all-local:: $(LibName.O)
558 $(LibName.O): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
559 $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
560 $(Verb) $(Relink) -o $@ $(ObjectsO)
563 ifneq ($(strip $(LibName.O)),)
564 -$(Verb) $(RM) -f $(LibName.O)
567 DestRelinkedLib = $(libdir)/$(LIBRARYNAME).o
569 install-local:: $(DestRelinkedLib)
571 $(DestRelinkedLib): $(libdir) $(LibName.O)
572 $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
573 $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
576 $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
577 -$(Verb) $(RM) -f $(DestRelinkedLib)
581 #---------------------------------------------------------
582 # Archive Library Targets:
583 # If the user wanted a regular archive library built,
584 # then we provide targets for building them.
585 #---------------------------------------------------------
588 all-local:: $(LibName.A)
590 $(LibName.A): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
591 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
593 $(Verb) $(Archive) $@ $(ObjectsO)
597 ifneq ($(strip $(LibName.A)),)
598 -$(Verb) $(RM) -f $(LibName.A)
601 DestArchiveLib := $(libdir)/lib$(LIBRARYNAME).a
603 install-local:: $(DestArchiveLib)
605 $(DestArchiveLib): $(libdir) $(LibName.A)
606 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
607 $(Verb) $(MKDIR) $(libdir)
608 $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
611 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
612 -$(Verb) $(RM) -f $(DestArchiveLib)
619 ###############################################################################
620 # Tool Build Rules: Build executable tool based on TOOLNAME option
621 ###############################################################################
625 #---------------------------------------------------------
626 # Handle the special "JIT" value for LLVM_LIBS which is a
627 # shorthand for a bunch of libraries that get the correct
628 # JIT support for a tool that runs JIT.
629 #---------------------------------------------------------
630 ifeq ($(LLVMLIBS),JIT)
632 # Make sure we can get our own symbols in the tool
635 # Generic JIT libraries
636 JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
638 # You can enable the X86 JIT on a non-X86 host by setting the flag
639 # ENABLE_X86_JIT on the make command line. If not, it will still be
640 # enabled automagically on an X86 host.
645 # What the X86 JIT requires
647 JIT_LIBS += LLVMX86 LLVMSelectionDAG
650 # You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
651 # ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
652 # enabled automagically on an SparcV9 host.
653 ifeq ($(ARCH), Sparc)
654 ENABLE_SPARCV9_JIT = 1
657 # What the Sparc JIT requires
658 ifdef ENABLE_SPARCV9_JIT
659 JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
660 LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \
661 LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
662 LLVMDataStructure.a LLVMSparcV9RegAlloc
665 # You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
666 # ENABLE_PPC_JIT on the make command line. If not, it will still be
667 # enabled automagically on an PowerPC host.
668 ifeq ($(ARCH), PowerPC)
672 # What the PowerPC JIT requires
674 JIT_LIBS += LLVMPowerPC
677 LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \
678 LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
679 LLVMSystem.a $(PLATFORMLIBDL)
682 #---------------------------------------------------------
683 # Set up variables for building a tool.
684 #---------------------------------------------------------
686 ToolBuildPath := $(ExmplDir)/$(TOOLNAME)$(EXEEXT)
688 ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
690 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
691 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
692 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
693 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
694 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
695 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
696 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
697 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
699 #---------------------------------------------------------
700 # Tell make that we need to rebuild subdirectories before
701 # we can link the tool. This affects things like LLI which
702 # has library subdirectories.
703 #---------------------------------------------------------
704 $(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
706 #---------------------------------------------------------
707 # Provide targets for building the tools
708 #---------------------------------------------------------
709 all-local:: $(ToolBuildPath)
712 ifneq ($(strip $(ToolBuildPath)),)
713 -$(Verb) $(RM) -f $(ToolBuildPath)
717 $(ToolBuildPath): $(ExmplDir)/.dir
719 $(ToolBuildPath): $(ToolDir)/.dir
722 $(ToolBuildPath): $(BUILT_SOURCES) $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
723 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
724 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
725 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB)
726 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg)
728 DestTool = $(bindir)/$(TOOLNAME)
730 install-local:: $(DestTool)
732 $(DestTool): $(bindir) $(ToolBuildPath)
733 $(Echo) Installing $(BuildMode) $(DestTool)
734 $(Verb) $(INSTALL) $(ToolBuildPath) $(DestTool)
737 $(Echo) Uninstalling $(BuildMode) $(DestTool)
738 -$(Verb) $(RM) -f $(DestTool)
742 ###############################################################################
743 # Object Build Rules: Build object files based on sources
744 ###############################################################################
746 # Provide rule sets for when dependency generation is enabled
747 ifndef DISABLE_AUTO_DEPENDENCIES
749 #---------------------------------------------------------
750 # Create .lo files in the ObjDir directory from the .cpp and .c files...
751 #---------------------------------------------------------
754 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
755 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
756 $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
757 then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
758 else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
760 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
761 $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
762 $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
763 then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
764 else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
766 #---------------------------------------------------------
767 # Create .o files in the ObjDir directory from the .cpp and .c files...
768 #---------------------------------------------------------
771 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
772 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
773 $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
774 then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
775 else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
777 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
778 $(Echo) "Compiling $*.c for $(BuildMode) build"
779 $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
780 then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
781 else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
785 #---------------------------------------------------------
786 # Create .bc files in the ObjDir directory from .cpp and .c files...
787 #---------------------------------------------------------
788 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS)
789 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
790 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
791 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
792 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
794 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS)
795 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
796 $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
797 then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
798 else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
800 # Provide alternate rule sets if dependencies are disabled
805 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
806 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
807 $(LTCompile.CXX) $< -o $@
809 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
810 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
811 $(LTCompile.C) $< -o $@
815 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
816 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
817 $(Compile.CXX) $< -o $@
819 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
820 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
821 $(Compile.C) $< -o $@
824 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS)
825 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
826 $(BCCompile.CXX) $< -o $@
828 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS)
829 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
830 $(BCCompile.C) $< -o $@
834 #---------------------------------------------------------
835 # Provide rule to build .bc files from .ll sources,
836 # regardless of dependencies
837 #---------------------------------------------------------
838 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
839 $(Echo) "Compiling $*.ll for $(BuildMode) build"
840 $(Verb) $(LLVMAS) $< -f -o $@
842 ###############################################################################
843 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
844 ###############################################################################
848 TDFiles := $(strip $(wildcard $(BUILD_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
849 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
851 $(INCFiles) : $(TBLGEN) $(TDFiles)
853 %GenRegisterNames.inc : %.td
854 $(Echo) "Building $(<F) register names with tblgen"
855 $(Verb) $(TableGen) -gen-register-enums -o $@ $<
857 %GenRegisterInfo.h.inc : %.td
858 $(Echo) "Building $(<F) register information header with tblgen"
859 $(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
861 %GenRegisterInfo.inc : %.td
862 $(Echo) "Building $(<F) register info implementation with tblgen"
863 $(Verb) $(TableGen) -gen-register-desc -o $@ $<
865 %GenInstrNames.inc : %.td
866 $(Echo) "Building $(<F) instruction names with tblgen"
867 $(Verb) $(TableGen) -gen-instr-enums -o $@ $<
869 %GenInstrInfo.inc : %.td
870 $(Echo) "Building $(<F) instruction information with tblgen"
871 $(Verb) $(TableGen) -gen-instr-desc -o $@ $<
873 %GenAsmWriter.inc : %.td
874 $(Echo) "Building $(<F) assembly writer with tblgen"
875 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
877 %GenATTAsmWriter.inc : %.td
878 $(Echo) "Building $(<F) AT&T assembly writer with tblgen"
879 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
881 %GenIntelAsmWriter.inc : %.td
882 $(Echo) "Building $(<F) Intel assembly writer with tblgen"
883 $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
885 %GenInstrSelector.inc: %.td
886 $(Echo) "Building $(<F) instruction selector with tblgen"
887 $(Verb) $(TableGen) -gen-instr-selector -o $@ $<
889 %GenCodeEmitter.inc:: %.td
890 $(Echo) "Building $(<F) code emitter with tblgen"
891 $(Verb) $(TableGen) -gen-emitter -o $@ $<
894 -$(Verb) $(RM) -f $(INCFiles)
898 ###############################################################################
899 # LEX AND YACC: Provide rules for generating sources with lex and yacc
900 ###############################################################################
902 #---------------------------------------------------------
903 # Provide rules for generating a .cpp source file from
904 # (f)lex input sources.
905 #---------------------------------------------------------
907 LexFiles := $(filter %.l,$(Sources))
911 LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
913 .PRECIOUS: $(LexOutput)
915 # Note the extra sed filtering here, used to cut down on the warnings emited
916 # by GCC. The last line is a gross hack to work around flex aparently not
917 # being able to resize the buffer on a large token input. Currently, for
918 # uninitialized string buffers in LLVM we can generate very long tokens, so
919 # this is a hack around it.
920 # FIXME. (f.e. char Buffer[10000] )
923 $(Verb) $(FLEX) -t $< | \
924 $(SED) 's/void yyunput/inline void yyunput/' | \
925 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
926 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
930 -$(Verb) $(RM) -f $(LexOutput)
931 $(Verb) $(RM) -f $(LexOutput)
935 #---------------------------------------------------------
936 # Provide rules for generating a .cpp and .h source files
937 # from yacc (bison) input sources.
938 #---------------------------------------------------------
940 YaccFiles := $(filter %.y,$(Sources))
941 ifneq ($(YaccFiles),)
942 YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
944 .PRECIOUS: $(YaccOutput)
946 # Cancel built-in rules for yacc
951 # Rule for building the bison parsers...
953 $(Echo) "Bisoning $*.y"
954 $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
955 $(Verb) $(MV) -f $*.tab.c $*.cpp
956 $(Verb) $(MV) -f $*.tab.h $*.h
959 -$(Verb) $(RM) -f $(YaccOutput)
960 $(Verb) $(RM) -f $(YaccOutput)
963 ###############################################################################
964 # OTHER RULES: Other rules needed
965 ###############################################################################
967 # To create postscript files from dot files...
970 $(DOT) -Tps < $< > $@
973 $(Echo) "Cannot build $@: The program dot is not installed"
976 # This rules ensures that header files that are removed still have a rule for
977 # which they can be "generated." This allows make to ignore them and
978 # reproduce the dependency lists.
981 # Define clean-local to clean the current directory. Note that this uses a
982 # very conservative approach ensuring that empty variables do not cause
983 # errors or disastrous removal.
985 ifneq ($(strip $(ObjDir)),)
986 -$(Verb) $(RM) -rf $(ObjDir)
988 -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
989 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
990 -$(Verb) $(RM) -f *$(SHLIBEXT)
994 -$(Verb) $(RM) -rf Debug Release Profile
996 # Build tags database for Emacs/Xemacs:
1000 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
1001 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
1002 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1003 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1004 -name '*.cpp' -o -name '*.h' | \
1005 $(ETAGS) $(ETAGSFLAGS) -
1008 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
1009 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
1010 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1011 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1012 \( -name '*.cpp' -o -name '*.h' \) -print | \
1013 ctags -ImtT -o $(BUILD_OBJ_ROOT)/CTAGS -L -
1016 ###############################################################################
1017 # DEPENDENCIES: Include the dependency files if we should
1018 ###############################################################################
1019 ifndef DISABLE_AUTO_DEPENDENCIES
1021 # If its not one of the cleaning targets
1022 ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
1024 # Get the list of dependency files
1025 DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
1026 DependFiles := $(patsubst %,$(BUILD_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
1028 -include /dev/null $(DependFiles)
1034 ###############################################################################
1035 # DISTRIBUTION: Handle construction of a distribution tarball
1036 ###############################################################################
1038 #------------------------------------------------------------------------
1039 # Define distribution related variables
1040 #------------------------------------------------------------------------
1041 DistName := $(LLVM_TARBALL_NAME)
1042 DistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1043 TopDistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1044 DistTarGZip := $(BUILD_OBJ_ROOT)/$(DistName).tar.gz
1045 DistZip := $(BUILD_OBJ_ROOT)/$(DistName).zip
1046 DistTarBZ2 := $(BUILD_OBJ_ROOT)/$(DistName).tar.bz2
1047 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1048 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1049 Makefile.config.in configure autoconf
1050 DistOther := $(notdir $(wildcard \
1051 $(BUILD_SRC_DIR)/*.h \
1052 $(BUILD_SRC_DIR)/*.td \
1053 $(BUILD_SRC_DIR)/*.def \
1054 $(BUILD_SRC_DIR)/*.ll \
1055 $(BUILD_SRC_DIR)/*.in))
1056 DistSubDirs := $(SubDirs)
1057 DistSources = $(Sources) $(EXTRA_DIST)
1058 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
1060 #------------------------------------------------------------------------
1061 # We MUST build distribution with OBJ_DIR != SRC_DIR
1062 #------------------------------------------------------------------------
1063 ifeq ($(BUILD_SRC_DIR),$(BUILD_OBJ_DIR))
1064 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1065 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1070 DistCheckTop := check
1072 #------------------------------------------------------------------------
1073 # Prevent catastrophic remove
1074 #------------------------------------------------------------------------
1075 ifeq ($(LLVM_TARBALL_NAME),)
1076 $(error LLVM_TARBALL_NAME is empty. Please rerun configure)
1079 #------------------------------------------------------------------------
1080 # Prevent attempt to run dist targets from anywhere but the top level
1081 #------------------------------------------------------------------------
1084 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1085 $(Echo) ERROR: You must run $@ from $(BUILD_OBJ_ROOT)
1089 #------------------------------------------------------------------------
1090 # Provide the top level targets
1091 #------------------------------------------------------------------------
1093 dist-gzip:: $(DistTarGZip)
1095 $(DistTarGZip) : distdir
1096 $(Echo) Packing gzipped distribution tar file.
1097 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1098 $(GZIP) -c > "$(DistTarGZip)"
1100 dist-bzip2:: $(DistTarBZ2)
1102 $(DistTarBZ2) : distdir
1103 $(Echo) Packing bzipped distribution tar file.
1104 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1105 $(BZIP2) -c >$(DistTarBZ2)
1107 dist-zip:: $(DistZip)
1109 $(DistZip) : distdir
1110 $(Echo) Packing zipped distribution file.
1111 $(Verb) rm -f $(DistZip)
1112 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1114 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
1115 $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
1117 DistCheckDir := $(LLVM_OBJ_ROOT)/_distcheckdir
1119 dist-check:: $(DistCheckTop) $(DistTarGZip)
1120 $(Echo) Checking distribution tar file.
1121 $(Verb) if test -d $(DistCheckDir) ; then \
1122 $(RM) -rf $(DistCheckDir) ; \
1124 $(Verb) $(MKDIR) $(DistCheckDir)
1125 $(Verb) cd $(DistCheckDir) && \
1126 $(MKDIR) $(DistCheckDir)/build && \
1127 $(MKDIR) $(DistCheckDir)/install && \
1128 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1130 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1131 --srcdir=../$(DistName) --with-llvmgccdir="$(LLVMGCCDIR)" && \
1133 $(MAKE) install && \
1134 $(MAKE) uninstall && \
1137 $(MAKE) dist-clean && \
1138 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1141 $(Echo) Cleaning distribution files
1142 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) $(DistCheckDir)
1146 #------------------------------------------------------------------------
1147 # Provide the recursive distdir target for building the distribution directory
1148 #------------------------------------------------------------------------
1149 distdir : $(DistSources)
1150 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1151 if test -d "$(DistDir)" ; then \
1152 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
1155 $(EchoCmd) Removing $(DistDir) ; \
1156 $(RM) -rf $(DistDir); \
1158 $(Echo) Building Distribution Directory $(DistDir)
1159 $(Verb) $(MKDIR) $(DistDir)
1160 $(Verb) srcdirstrip=`echo "$(BUILD_SRC_DIR)" | sed 's|.|.|g'`; \
1161 srcrootstrip=`echo "$(BUILD_SRC_ROOT)" | sed 's|.|.|g'`; \
1162 for file in $(DistFiles) ; do \
1164 $(BUILD_SRC_DIR)/*) file=`echo "$$file" | sed "s#^$$srcdirstrip/##"`;; \
1165 $(BUILD_SRC_ROOT)/*) file=`echo "$$file" | sed "s#^$$srcrootstrip/#$(BUILD_OBJ_ROOT)/#"`;; \
1167 if test -f "$$file" || test -d "$$file" ; then \
1170 from_dir=$(BUILD_SRC_DIR); \
1172 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'`; \
1173 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1174 to_dir="$(DistDir)/$$dir"; \
1175 $(MKDIR) "$$to_dir" ; \
1177 to_dir="$(DistDir)"; \
1179 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1180 if test -n "$$mid_dir" ; then \
1181 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1183 if test -d "$$from_dir/$$file"; then \
1184 if test -d "$(BUILD_SRC_DIR)/$$file" && \
1185 test "$$from_dir" != "$(BUILD_SRC_DIR)" ; then \
1186 cp -pR "$(BUILD_SRC_DIR)/$$file" "$$to_dir" || exit 1; \
1188 cp -pR $$from_dir/$$file $$to_dir || exit 1; \
1189 elif test -f "$$from_dir/$$file" ; then \
1190 cp -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1191 elif test -L "$$from_dir/$$file" ; then \
1192 cp -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
1193 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1194 $(EchoCmd) "===== WARNING: Distribution Source $$from_dir/$$file Not Found!" ; \
1195 elif test "$(Verb)" != '@' ; then \
1196 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
1199 $(Verb) for subdir in $(DistSubDirs) ; do \
1200 if test "$$subdir" \!= "." ; then \
1201 new_distdir="$(DistDir)/$$subdir" ; \
1202 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
1203 ( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || exit 1; \
1206 $(Verb) $(MAKE) DistDir="$(DistDir)" dist-hook || exit 1
1207 -$(Verb) find $(DistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
1208 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
1209 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
1210 ! -type d ! -perm -444 -exec $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1211 || chmod -R a+r $(DistDir)
1213 # This is invoked by distdir target, define it as a no-op to avoid errors if not
1219 ###############################################################################
1220 # TOP LEVEL - targets only to apply at the top level directory
1221 ###############################################################################
1225 #------------------------------------------------------------------------
1226 # Install support for project's include files:
1227 #------------------------------------------------------------------------
1229 $(Echo) Installing include files
1230 $(Verb) $(MKDIR) $(includedir)
1231 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1232 cd $(BUILD_SRC_ROOT)/include && \
1233 find . -path '*/Internal' -prune -o '(' -type f \
1234 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1235 -print ')' | grep -v CVS | pax -rwdvpe $(includedir) ; \
1239 $(Echo) Uninstalling include files
1240 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1241 cd $(BUILD_SRC_ROOT)/include && \
1242 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
1243 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1244 -print ')' | grep -v CVS | sed 's#^#$(includedir)/#'` ; \
1249 #------------------------------------------------------------------------
1250 # Print out the directories used for building
1251 #------------------------------------------------------------------------
1253 $(Echo) "BuildMode : " '$(BuildMode)'
1254 $(Echo) "BUILD_SRC_ROOT : " '$(BUILD_SRC_ROOT)'
1255 $(Echo) "BUILD_SRC_DIR : " '$(BUILD_SRC_DIR)'
1256 $(Echo) "BUILD_OBJ_ROOT : " '$(BUILD_OBJ_ROOT)'
1257 $(Echo) "BUILD_OBJ_DIR : " '$(BUILD_OBJ_DIR)'
1258 $(Echo) "LLVM_SRC_ROOT : " '$(LLVM_SRC_ROOT)'
1259 $(Echo) "LLVM_OBJ_ROOT : " '$(LLVM_OBJ_ROOT)'
1260 $(Echo) "libdir : " '$(libdir)'
1261 $(Echo) "bindir : " '$(bindir)'
1262 $(Echo) "sysconfdir : " '$(sysconfdir)'
1263 $(Echo) "bytecode_libdir: " '$(bytecode_libdir)'
1264 $(Echo) "UserTargets : " '$(UserTargets)'
1265 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1266 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1267 $(Echo) "ObjDir : " '$(ObjDir)'
1268 $(Echo) "LibDir : " '$(LibDir)'
1269 $(Echo) "ToolDir : " '$(ToolDir)'
1270 $(Echo) "ExmplDir : " '$(ExmplDir)'
1271 $(Echo) "TDFiles : " '$(TDFiles)'
1272 $(Echo) "INCFiles : " '$(INCFiles)'
1273 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
1274 $(Echo) "Compile.C : " '$(Compile.C)'
1275 $(Echo) "Archive : " '$(Archive)'
1276 $(Echo) "YaccFiles : " '$(YaccFiles)'
1277 $(Echo) "LexFiles : " '$(LexFiles)'