1 #===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===#
3 # The LLVM Compiler Infrastructure
5 # This file was developed by the LLVM research group and is distributed under
6 # the University of Illinois Open Source License. See LICENSE.TXT for details.
8 #===------------------------------------------------------------------------===#
10 # This file is included by all of the LLVM makefiles. For details on how to use
11 # it properly, please see the document MakefileGuide.html in the docs directory.
13 #===-----------------------------------------------------------------------====
15 ################################################################################
16 # TARGETS: Define standard targets that can be invoked
17 ################################################################################
19 #--------------------------------------------------------------------
20 # Define the various target sets
21 #--------------------------------------------------------------------
22 RecursiveTargets := all clean clean-all install uninstall install-bytecode
23 LocalTargets := all-local clean-local clean-all-local check-local \
24 install-local printvars uninstall-local \
25 install-bytecode-local
26 TopLevelTargets := dist dist-check dist-clean tags dist-gzip dist-bzip2 \
28 UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
29 InternalTargets := preconditions distdir dist-hook
31 ################################################################################
32 # INITIALIZATION: Basic things the makefile needs
33 ################################################################################
35 #--------------------------------------------------------------------
36 # Set the VPATH so that we can find source files.
37 #--------------------------------------------------------------------
38 VPATH=$(BUILD_SRC_DIR)
40 #--------------------------------------------------------------------
41 # Reset the list of suffixes we know how to build
42 #--------------------------------------------------------------------
44 .SUFFIXES: .c .cpp .h .hpp .y .l .lo .o .a .bc .td .ps .dot
45 .SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
47 #--------------------------------------------------------------------
48 # Mark all of these targets as phony to avoid implicit rule search
49 #--------------------------------------------------------------------
50 .PHONY: $(UserTargets) $(InternalTargets)
52 #--------------------------------------------------------------------
53 # Make sure all the user-target rules are double colon rules and
54 # they are defined first.
55 #--------------------------------------------------------------------
59 ################################################################################
60 # PRECONDITIONS: that which must be built/checked first
61 ################################################################################
63 SrcMakefiles := $(filter %Makefile %Makefile.tests,\
64 $(wildcard $(BUILD_SRC_DIR)/Makefile*))
65 ObjMakefiles := $(subst $(BUILD_SRC_DIR),$(BUILD_OBJ_DIR),$(SrcMakefiles))
66 ConfigureScript := $(LLVM_SRC_ROOT)/configure
67 ConfigStatusScript := $(LLVM_OBJ_ROOT)/config.status
68 MakefileConfigIn := $(LLVM_SRC_ROOT)/Makefile.config.in
69 MakefileConfig := $(LLVM_OBJ_ROOT)/Makefile.config
70 PreConditions := $(ConfigStatusScript) $(MakefileConfig) $(ObjMakefiles)
72 preconditions : $(PreConditions)
74 #------------------------------------------------------------------------
75 # Make sure the BUILT_SOURCES are built first
76 #------------------------------------------------------------------------
77 $(filter-out clean clean-local,UserTargets):: $(BUILT_SOURCES)
80 ifneq ($(strip $(BUILT_SOURCES)),)
81 -$(Verb) $(RM) -f $(BUILT_SOURCES)
84 $(BUILT_SOURCES) : $(ObjMakefiles)
86 #------------------------------------------------------------------------
87 # Make sure we're not using a stale configuration
88 #------------------------------------------------------------------------
89 .PRECIOUS: $(ConfigStatusScript)
90 $(ConfigStatusScript): $(ConfigureScript)
91 $(Echo) Reconfiguring with $<
92 $(Verb) cd $(BUILD_OBJ_ROOT) && \
93 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
96 #------------------------------------------------------------------------
97 # Make sure the configuration makefile is up to date
98 #------------------------------------------------------------------------
99 $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
100 $(Echo) Regenerating $@
101 $(Verb) cd $(LLVM_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
103 #------------------------------------------------------------------------
104 # If the Makefile in the source tree has been updated, copy it over into the
105 # build tree. But, only do this if the source and object makefiles differ
106 #------------------------------------------------------------------------
107 ifneq ($(BUILD_OBJ_DIR),$(BUILD_SRC_DIR))
109 Makefile: $(BUILD_SRC_DIR)/Makefile
110 $(Echo) "Updating Makefile"
111 $(Verb) $(MKDIR) $(@D)
114 # Copy the Makefile.* files unless we're in the root directory which avoids
115 # the copying of Makefile.config.in or other things that should be explicitly
117 $(BUILD_OBJ_DIR)/Makefile% : $(BUILD_SRC_DIR)/Makefile%
119 *Makefile.rules) ;; \
121 *) $(Echo) "Updating $(@F)" ; \
128 #------------------------------------------------------------------------
129 # Set up the basic dependencies
130 #------------------------------------------------------------------------
131 $(UserTargets):: $(PreConditions)
136 clean-all:: clean-local clean-all-local
137 install:: install-local
138 uninstall:: uninstall-local
139 check-local:: all-local
140 install-local:: all-local
141 install-bytecode:: install-bytecode-local
143 ###############################################################################
144 # VARIABLES: Set up various variables based on configuration data
145 ###############################################################################
147 #--------------------------------------------------------------------
148 # Variables derived from configuration we are building
149 #--------------------------------------------------------------------
151 ifdef ENABLE_PROFILING
153 CXX.Flags := -O3 -DNDEBUG -felide-constructors -finline-functions -pg
154 C.Flags := -O3 -DNDEBUG -pg
155 LD.Flags := -O3 -DNDEBUG -pg
157 ifdef ENABLE_OPTIMIZED
159 CXX.Flags := -O3 -DNDEBUG -finline-functions -felide-constructors -fomit-frame-pointer
160 C.Flags := -O3 -DNDEBUG -fomit-frame-pointer
161 LD.Flags := -O3 -DNDEBUG
164 CXX.Flags := -g -D_DEBUG
165 C.Flags := -g -D_DEBUG
166 LD.Flags := -g -D_DEBUG
171 CXX.Flags += $(CXXFLAGS)
173 CPP.Flags += $(CPPFLAGS)
174 LD.Flags += $(LDFLAGS)
176 LibTool.Flags := --tag=CXX
178 #--------------------------------------------------------------------
179 # Directory locations
180 #--------------------------------------------------------------------
181 ObjDir := $(BUILD_OBJ_DIR)/$(BuildMode)
182 LibDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/lib
183 ToolDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/bin
184 ExmplDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/examples
185 LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
186 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
187 LExmplDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
189 #--------------------------------------------------------------------
190 # Full Paths To Compiled Tools and Utilities
191 #--------------------------------------------------------------------
192 EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
195 LIBTOOL := $(LLVM_OBJ_ROOT)/mklib
198 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
201 BURG := $(LLVMToolDir)/burg$(EXEEXT)
204 TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT)
207 GCCAS := $(LLVMToolDir)/gccas$(EXEEXT)
210 GCCLD := $(LLVMToolDir)/gccld$(EXEEXT)
213 LLVMGCC := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/gcc
216 LLVMGXX := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/g++
219 # Need a better way to compute this.
220 LLVMGCCLibDir := $(dir $(shell $(LLVMGCC) -print-file-name=libgcc.a))/
222 #--------------------------------------------------------------------
223 # Adjust to user's request
224 #--------------------------------------------------------------------
226 # Adjust LIBTOOL flags for shared libraries, or not.
227 ifndef SHARED_LIBRARY
228 LibTool.Flags += --tag=disable-shared
230 LD.Flags += -rpath $(LibDir)
241 # Adjust settings for verbose mode
244 LibTool.Flags += --silent
245 AR.Flags += >/dev/null 2>/dev/null
246 ConfigureScriptFLAGS += >$(BUILD_OBJ_DIR)/configure.out 2>&1
248 ConfigureScriptFLAGS :=
251 # By default, strip symbol information from executable
253 Strip := $(PLATFORMSTRIPOPTS)
254 StripWarnMsg := "(without symbols)"
257 # Adjust linker flags for building an executable
260 LD.Flags += -rpath $(ExmplDir) -export-dynamic
262 LD.Flags += -rpath $(ToolDir) -export-dynamic
266 #----------------------------------------------------------
267 # Options To Invoke Tools
268 #----------------------------------------------------------
270 CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
272 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
273 CPP.Flags += -I$(BUILD_OBJ_DIR) \
275 -I$(BUILD_SRC_ROOT)/include \
276 -I$(BUILD_OBJ_ROOT)/include \
277 -I$(LLVM_OBJ_ROOT)/include \
278 -I$(LLVM_SRC_ROOT)/include \
279 -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
281 Compile.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags)
282 LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
283 BCCompile.C = $(LLVMGCC) $(CPP.Flags) $(CompileCommonOpts) $(C.Flags) -c
284 Compile.CXX = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
285 LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
286 BCCompile.CXX = $(LLVMGXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
287 Link = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
288 $(CompileCommonOpts) $(LD.Flags) $(Strip)
289 Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
291 LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL)
292 Burg = $(BURG) -I $(BUILD_SRC_DIR)
293 TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR)
294 Archive = $(AR) $(AR.Flags)
295 LArchive = $(LLVMToolDir)/llvm-ar rcsf
302 #----------------------------------------------------------
303 # Get the list of source files
304 #----------------------------------------------------------
306 Sources := $(notdir $(wildcard $(BUILD_SRC_DIR)/*.cpp \
307 $(BUILD_SRC_DIR)/*.cc $(BUILD_SRC_DIR)/*.c $(BUILD_SRC_DIR)/*.y \
308 $(BUILD_SRC_DIR)/*.l))
310 Sources := $(SOURCES)
314 Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
317 #----------------------------------------------------------
318 # Types of objects that can be built from sources
319 #----------------------------------------------------------
320 BaseNameSources := $(sort $(basename $(Sources)))
321 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
322 ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
323 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
325 ###############################################################################
326 # DIRECTORIES: Handle recursive descent of directory structure
327 ###############################################################################
329 #---------------------------------------------------------
330 # Provide rules to make install dirs. This must be early
331 # in the file so they get built before dependencies
332 #---------------------------------------------------------
335 $(Verb) $(MKDIR) $(bindir)
338 $(Verb) $(MKDIR) $(libdir)
341 $(Verb) $(MKDIR) $(bytecode_libdir)
344 $(Verb) $(MKDIR) $(sysconfdir)
346 # To create other directories, as needed, and timestamp their creation
348 $(Verb) $(MKDIR) $* > /dev/null
351 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
352 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
354 #---------------------------------------------------------
355 # Handle the DIRS options for sequential construction
356 #---------------------------------------------------------
361 $(RecursiveTargets)::
362 $(Verb) for dir in $(DIRS); do \
363 if [ ! -f $$dir/Makefile ]; then \
365 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
367 ($(MAKE) -C $$dir $@ ) || exit 1; \
371 #---------------------------------------------------------
372 # Handle the EXPERIMENTAL_DIRS options ensuring success
373 # after each directory is built.
374 #---------------------------------------------------------
375 ifdef EXPERIMENTAL_DIRS
376 $(RecursiveTargets)::
377 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
378 if [ ! -f $$dir/Makefile ]; then \
380 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
382 ($(MAKE) -C $$dir $@ ) || exit 0; \
386 #---------------------------------------------------------
387 # Handle the PARALLEL_DIRS options for parallel construction
388 #---------------------------------------------------------
391 SubDirs += $(PARALLEL_DIRS)
393 # Unfortunately, this list must be maintained if new recursive targets are added
394 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
395 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
396 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
397 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
398 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
399 install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(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.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
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 # make the C and C++ compilers strip debug info out of bytecode libraries.
515 BCCompile.C += -Wa,-strip-debug
516 BCCompile.CXX += -Wa,-strip-debug
518 all-local:: $(LibName.BCA)
520 ifdef EXPORTED_SYMBOL_FILE
521 BCLinkLib = $(LLVMGCC) -shared -nostdlib -Xlinker \
522 -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
524 $(LibName.BCA): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
525 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
527 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC)
528 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o
530 $(LibName.BCA): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
531 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
532 $(Verb) $(LArchive) $@ $(ObjectsBC)
537 ifneq ($(strip $(LibName.BCA)),)
538 -$(Verb) $(RM) -f $(LibName.BCA)
541 DestBytecodeLib = $(bytecode_libdir)/lib$(LIBRARYNAME).a
543 install-bytecode-local:: $(DestBytecodeLib)
545 install-local:: $(DestBytecodeLib)
547 $(DestBytecodeLib): $(bytecode_libdir) $(LibName.BCA)
548 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
549 $(Verb) $(INSTALL) $(LibName.BCA) $@
552 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
553 -$(Verb) $(RM) -f $(DestBytecodeLib)
557 #---------------------------------------------------------
558 # ReLinked Library Targets:
559 # If the user didn't explicitly forbid building a
560 # relinked then we provide targets for building them.
561 #---------------------------------------------------------
562 ifndef DONT_BUILD_RELINKED
564 all-local:: $(LibName.O)
566 $(LibName.O): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
567 $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
568 $(Verb) $(Relink) -o $@ $(ObjectsO)
571 ifneq ($(strip $(LibName.O)),)
572 -$(Verb) $(RM) -f $(LibName.O)
575 DestRelinkedLib = $(libdir)/$(LIBRARYNAME).o
577 install-local:: $(DestRelinkedLib)
579 $(DestRelinkedLib): $(libdir) $(LibName.O)
580 $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
581 $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
584 $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
585 -$(Verb) $(RM) -f $(DestRelinkedLib)
589 #---------------------------------------------------------
590 # Archive Library Targets:
591 # If the user wanted a regular archive library built,
592 # then we provide targets for building them.
593 #---------------------------------------------------------
596 all-local:: $(LibName.A)
598 $(LibName.A): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
599 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
601 $(Verb) $(Archive) $@ $(ObjectsO)
605 ifneq ($(strip $(LibName.A)),)
606 -$(Verb) $(RM) -f $(LibName.A)
609 DestArchiveLib := $(libdir)/lib$(LIBRARYNAME).a
611 install-local:: $(DestArchiveLib)
613 $(DestArchiveLib): $(libdir) $(LibName.A)
614 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
615 $(Verb) $(MKDIR) $(libdir)
616 $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
619 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
620 -$(Verb) $(RM) -f $(DestArchiveLib)
627 ###############################################################################
628 # Tool Build Rules: Build executable tool based on TOOLNAME option
629 ###############################################################################
633 #---------------------------------------------------------
634 # Handle the special "JIT" value for LLVM_LIBS which is a
635 # shorthand for a bunch of libraries that get the correct
636 # JIT support for a tool that runs JIT.
637 #---------------------------------------------------------
638 ifeq ($(LLVMLIBS),JIT)
640 # Make sure we can get our own symbols in the tool
643 # Generic JIT libraries
644 JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
646 # You can enable the X86 JIT on a non-X86 host by setting the flag
647 # ENABLE_X86_JIT on the make command line. If not, it will still be
648 # enabled automagically on an X86 host.
653 # What the X86 JIT requires
655 JIT_LIBS += LLVMX86 LLVMSelectionDAG
658 # You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
659 # ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
660 # enabled automagically on an SparcV9 host.
661 ifeq ($(ARCH), Sparc)
662 ENABLE_SPARCV9_JIT = 1
665 # What the Sparc JIT requires
666 ifdef ENABLE_SPARCV9_JIT
667 JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
668 LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \
669 LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
670 LLVMDataStructure.a LLVMSparcV9RegAlloc
673 # You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
674 # ENABLE_PPC_JIT on the make command line. If not, it will still be
675 # enabled automagically on an PowerPC host.
676 ifeq ($(ARCH), PowerPC)
680 # What the PowerPC JIT requires
682 JIT_LIBS += LLVMPowerPC
685 LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \
686 LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
687 LLVMSystem.a $(PLATFORMLIBDL)
690 #---------------------------------------------------------
691 # Set up variables for building a tool.
692 #---------------------------------------------------------
694 ToolBuildPath := $(ExmplDir)/$(TOOLNAME)$(EXEEXT)
696 ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
698 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
699 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
700 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
701 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
702 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
703 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
704 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
705 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
707 #---------------------------------------------------------
708 # Tell make that we need to rebuild subdirectories before
709 # we can link the tool. This affects things like LLI which
710 # has library subdirectories.
711 #---------------------------------------------------------
712 $(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
714 #---------------------------------------------------------
715 # Provide targets for building the tools
716 #---------------------------------------------------------
717 all-local:: $(ToolBuildPath)
720 ifneq ($(strip $(ToolBuildPath)),)
721 -$(Verb) $(RM) -f $(ToolBuildPath)
725 $(ToolBuildPath): $(ExmplDir)/.dir
727 $(ToolBuildPath): $(ToolDir)/.dir
730 $(ToolBuildPath): $(BUILT_SOURCES) $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
731 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
732 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
733 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB)
734 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg)
736 DestTool = $(bindir)/$(TOOLNAME)
738 install-local:: $(DestTool)
740 $(DestTool): $(bindir) $(ToolBuildPath)
741 $(Echo) Installing $(BuildMode) $(DestTool)
742 $(Verb) $(INSTALL) $(ToolBuildPath) $(DestTool)
745 $(Echo) Uninstalling $(BuildMode) $(DestTool)
746 -$(Verb) $(RM) -f $(DestTool)
750 ###############################################################################
751 # Object Build Rules: Build object files based on sources
752 ###############################################################################
754 # Provide rule sets for when dependency generation is enabled
755 ifndef DISABLE_AUTO_DEPENDENCIES
757 #---------------------------------------------------------
758 # Create .lo files in the ObjDir directory from the .cpp and .c files...
759 #---------------------------------------------------------
762 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
763 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
764 $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
765 then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
766 else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
768 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
769 $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
770 $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
771 then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
772 else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
774 #---------------------------------------------------------
775 # Create .o files in the ObjDir directory from the .cpp and .c files...
776 #---------------------------------------------------------
779 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
780 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
781 $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
782 then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
783 else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
785 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
786 $(Echo) "Compiling $*.c for $(BuildMode) build"
787 $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
788 then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
789 else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
793 #---------------------------------------------------------
794 # Create .bc files in the ObjDir directory from .cpp and .c files...
795 #---------------------------------------------------------
796 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS)
797 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
798 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
799 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
800 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
802 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS)
803 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
804 $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
805 then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
806 else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
808 # Provide alternate rule sets if dependencies are disabled
813 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
814 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
815 $(LTCompile.CXX) $< -o $@
817 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
818 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
819 $(LTCompile.C) $< -o $@
823 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
824 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
825 $(Compile.CXX) $< -o $@
827 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
828 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
829 $(Compile.C) $< -o $@
832 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS)
833 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
834 $(BCCompile.CXX) $< -o $@
836 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS)
837 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
838 $(BCCompile.C) $< -o $@
842 #---------------------------------------------------------
843 # Provide rule to build .bc files from .ll sources,
844 # regardless of dependencies
845 #---------------------------------------------------------
846 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
847 $(Echo) "Compiling $*.ll for $(BuildMode) build"
848 $(Verb) $(LLVMAS) $< -f -o $@
850 ###############################################################################
851 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
852 ###############################################################################
856 TDFiles := $(strip $(wildcard $(BUILD_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
857 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
859 $(INCFiles) : $(TBLGEN) $(TDFiles)
861 %GenRegisterNames.inc : %.td
862 $(Echo) "Building $(<F) register names with tblgen"
863 $(Verb) $(TableGen) -gen-register-enums -o $@ $<
865 %GenRegisterInfo.h.inc : %.td
866 $(Echo) "Building $(<F) register information header with tblgen"
867 $(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
869 %GenRegisterInfo.inc : %.td
870 $(Echo) "Building $(<F) register info implementation with tblgen"
871 $(Verb) $(TableGen) -gen-register-desc -o $@ $<
873 %GenInstrNames.inc : %.td
874 $(Echo) "Building $(<F) instruction names with tblgen"
875 $(Verb) $(TableGen) -gen-instr-enums -o $@ $<
877 %GenInstrInfo.inc : %.td
878 $(Echo) "Building $(<F) instruction information with tblgen"
879 $(Verb) $(TableGen) -gen-instr-desc -o $@ $<
881 %GenAsmWriter.inc : %.td
882 $(Echo) "Building $(<F) assembly writer with tblgen"
883 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
885 %GenATTAsmWriter.inc : %.td
886 $(Echo) "Building $(<F) AT&T assembly writer with tblgen"
887 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
889 %GenIntelAsmWriter.inc : %.td
890 $(Echo) "Building $(<F) Intel assembly writer with tblgen"
891 $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
893 %GenInstrSelector.inc: %.td
894 $(Echo) "Building $(<F) instruction selector with tblgen"
895 $(Verb) $(TableGen) -gen-instr-selector -o $@ $<
897 %GenCodeEmitter.inc:: %.td
898 $(Echo) "Building $(<F) code emitter with tblgen"
899 $(Verb) $(TableGen) -gen-emitter -o $@ $<
902 -$(Verb) $(RM) -f $(INCFiles)
906 ###############################################################################
907 # LEX AND YACC: Provide rules for generating sources with lex and yacc
908 ###############################################################################
910 #---------------------------------------------------------
911 # Provide rules for generating a .cpp source file from
912 # (f)lex input sources.
913 #---------------------------------------------------------
915 LexFiles := $(filter %.l,$(Sources))
919 LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
921 .PRECIOUS: $(LexOutput)
923 # Note the extra sed filtering here, used to cut down on the warnings emited
924 # by GCC. The last line is a gross hack to work around flex aparently not
925 # being able to resize the buffer on a large token input. Currently, for
926 # uninitialized string buffers in LLVM we can generate very long tokens, so
927 # this is a hack around it.
928 # FIXME. (f.e. char Buffer[10000] )
931 $(Verb) $(FLEX) -t $< | \
932 $(SED) 's/void yyunput/inline void yyunput/' | \
933 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
934 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
938 -$(Verb) $(RM) -f $(LexOutput)
939 $(Verb) $(RM) -f $(LexOutput)
943 #---------------------------------------------------------
944 # Provide rules for generating a .cpp and .h source files
945 # from yacc (bison) input sources.
946 #---------------------------------------------------------
948 YaccFiles := $(filter %.y,$(Sources))
949 ifneq ($(YaccFiles),)
950 YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
952 .PRECIOUS: $(YaccOutput)
954 # Cancel built-in rules for yacc
959 # Rule for building the bison parsers...
961 $(Echo) "Bisoning $*.y"
962 $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
963 $(Verb) $(MV) -f $*.tab.c $*.cpp
964 $(Verb) $(MV) -f $*.tab.h $*.h
967 -$(Verb) $(RM) -f $(YaccOutput)
968 $(Verb) $(RM) -f $(YaccOutput)
971 ###############################################################################
972 # OTHER RULES: Other rules needed
973 ###############################################################################
975 # To create postscript files from dot files...
978 $(DOT) -Tps < $< > $@
981 $(Echo) "Cannot build $@: The program dot is not installed"
984 # This rules ensures that header files that are removed still have a rule for
985 # which they can be "generated." This allows make to ignore them and
986 # reproduce the dependency lists.
989 # Define clean-local to clean the current directory. Note that this uses a
990 # very conservative approach ensuring that empty variables do not cause
991 # errors or disastrous removal.
993 ifneq ($(strip $(ObjDir)),)
994 -$(Verb) $(RM) -rf $(ObjDir)
996 -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
997 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
998 -$(Verb) $(RM) -f *$(SHLIBEXT)
1002 -$(Verb) $(RM) -rf Debug Release Profile
1004 # Build tags database for Emacs/Xemacs:
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' | \
1013 $(ETAGS) $(ETAGSFLAGS) -
1016 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
1017 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
1018 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1019 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1020 \( -name '*.cpp' -o -name '*.h' \) -print | \
1021 ctags -ImtT -o $(BUILD_OBJ_ROOT)/CTAGS -L -
1024 ###############################################################################
1025 # DEPENDENCIES: Include the dependency files if we should
1026 ###############################################################################
1027 ifndef DISABLE_AUTO_DEPENDENCIES
1029 # If its not one of the cleaning targets
1030 ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
1032 # Get the list of dependency files
1033 DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
1034 DependFiles := $(patsubst %,$(BUILD_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
1036 -include /dev/null $(DependFiles)
1042 ###############################################################################
1043 # DISTRIBUTION: Handle construction of a distribution tarball
1044 ###############################################################################
1046 #------------------------------------------------------------------------
1047 # Define distribution related variables
1048 #------------------------------------------------------------------------
1049 DistName := $(LLVM_TARBALL_NAME)
1050 DistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1051 TopDistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1052 DistTarGZip := $(BUILD_OBJ_ROOT)/$(DistName).tar.gz
1053 DistZip := $(BUILD_OBJ_ROOT)/$(DistName).zip
1054 DistTarBZ2 := $(BUILD_OBJ_ROOT)/$(DistName).tar.bz2
1055 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1056 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1057 Makefile.config.in configure autoconf
1058 DistOther := $(notdir $(wildcard \
1059 $(BUILD_SRC_DIR)/*.h \
1060 $(BUILD_SRC_DIR)/*.td \
1061 $(BUILD_SRC_DIR)/*.def \
1062 $(BUILD_SRC_DIR)/*.ll \
1063 $(BUILD_SRC_DIR)/*.in))
1064 DistSubDirs := $(SubDirs)
1065 DistSources = $(Sources) $(EXTRA_DIST)
1066 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
1068 #------------------------------------------------------------------------
1069 # We MUST build distribution with OBJ_DIR != SRC_DIR
1070 #------------------------------------------------------------------------
1071 ifeq ($(BUILD_SRC_DIR),$(BUILD_OBJ_DIR))
1072 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1073 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1078 DistCheckTop := check
1080 #------------------------------------------------------------------------
1081 # Prevent catastrophic remove
1082 #------------------------------------------------------------------------
1083 ifeq ($(LLVM_TARBALL_NAME),)
1084 $(error LLVM_TARBALL_NAME is empty. Please rerun configure)
1087 #------------------------------------------------------------------------
1088 # Prevent attempt to run dist targets from anywhere but the top level
1089 #------------------------------------------------------------------------
1092 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1093 $(Echo) ERROR: You must run $@ from $(BUILD_OBJ_ROOT)
1097 #------------------------------------------------------------------------
1098 # Provide the top level targets
1099 #------------------------------------------------------------------------
1101 dist-gzip:: $(DistTarGZip)
1103 $(DistTarGZip) : distdir
1104 $(Echo) Packing gzipped distribution tar file.
1105 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1106 $(GZIP) -c > "$(DistTarGZip)"
1108 dist-bzip2:: $(DistTarBZ2)
1110 $(DistTarBZ2) : distdir
1111 $(Echo) Packing bzipped distribution tar file.
1112 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1113 $(BZIP2) -c >$(DistTarBZ2)
1115 dist-zip:: $(DistZip)
1117 $(DistZip) : distdir
1118 $(Echo) Packing zipped distribution file.
1119 $(Verb) rm -f $(DistZip)
1120 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1122 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
1123 $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
1125 DistCheckDir := $(LLVM_OBJ_ROOT)/_distcheckdir
1127 dist-check:: $(DistCheckTop) $(DistTarGZip)
1128 $(Echo) Checking distribution tar file.
1129 $(Verb) if test -d $(DistCheckDir) ; then \
1130 $(RM) -rf $(DistCheckDir) ; \
1132 $(Verb) $(MKDIR) $(DistCheckDir)
1133 $(Verb) cd $(DistCheckDir) && \
1134 $(MKDIR) $(DistCheckDir)/build && \
1135 $(MKDIR) $(DistCheckDir)/install && \
1136 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1138 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1139 --srcdir=../$(DistName) --with-llvmgccdir="$(LLVMGCCDIR)" && \
1141 $(MAKE) install && \
1142 $(MAKE) uninstall && \
1145 $(MAKE) dist-clean && \
1146 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1149 $(Echo) Cleaning distribution files
1150 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) $(DistCheckDir)
1154 #------------------------------------------------------------------------
1155 # Provide the recursive distdir target for building the distribution directory
1156 #------------------------------------------------------------------------
1157 distdir : $(DistSources)
1158 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1159 if test -d "$(DistDir)" ; then \
1160 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
1163 $(EchoCmd) Removing $(DistDir) ; \
1164 $(RM) -rf $(DistDir); \
1166 $(Echo) Building Distribution Directory $(DistDir)
1167 $(Verb) $(MKDIR) $(DistDir)
1168 $(Verb) srcdirstrip=`echo "$(BUILD_SRC_DIR)" | sed 's|.|.|g'`; \
1169 srcrootstrip=`echo "$(BUILD_SRC_ROOT)" | sed 's|.|.|g'`; \
1170 for file in $(DistFiles) ; do \
1172 $(BUILD_SRC_DIR)/*) file=`echo "$$file" | sed "s#^$$srcdirstrip/##"`;; \
1173 $(BUILD_SRC_ROOT)/*) file=`echo "$$file" | sed "s#^$$srcrootstrip/#$(BUILD_OBJ_ROOT)/#"`;; \
1175 if test -f "$$file" || test -d "$$file" ; then \
1178 from_dir=$(BUILD_SRC_DIR); \
1180 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'`; \
1181 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1182 to_dir="$(DistDir)/$$dir"; \
1183 $(MKDIR) "$$to_dir" ; \
1185 to_dir="$(DistDir)"; \
1187 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1188 if test -n "$$mid_dir" ; then \
1189 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1191 if test -d "$$from_dir/$$file"; then \
1192 if test -d "$(BUILD_SRC_DIR)/$$file" && \
1193 test "$$from_dir" != "$(BUILD_SRC_DIR)" ; then \
1194 cp -pR "$(BUILD_SRC_DIR)/$$file" "$$to_dir" || exit 1; \
1196 cp -pR $$from_dir/$$file $$to_dir || exit 1; \
1197 elif test -f "$$from_dir/$$file" ; then \
1198 cp -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1199 elif test -L "$$from_dir/$$file" ; then \
1200 cp -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
1201 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1202 $(EchoCmd) "===== WARNING: Distribution Source $$from_dir/$$file Not Found!" ; \
1203 elif test "$(Verb)" != '@' ; then \
1204 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
1207 $(Verb) for subdir in $(DistSubDirs) ; do \
1208 if test "$$subdir" \!= "." ; then \
1209 new_distdir="$(DistDir)/$$subdir" ; \
1210 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
1211 ( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || exit 1; \
1214 $(Verb) $(MAKE) DistDir="$(DistDir)" dist-hook || exit 1
1215 -$(Verb) find $(DistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
1216 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
1217 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
1218 ! -type d ! -perm -444 -exec $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1219 || chmod -R a+r $(DistDir)
1221 # This is invoked by distdir target, define it as a no-op to avoid errors if not
1227 ###############################################################################
1228 # TOP LEVEL - targets only to apply at the top level directory
1229 ###############################################################################
1233 #------------------------------------------------------------------------
1234 # Install support for project's include files:
1235 #------------------------------------------------------------------------
1237 $(Echo) Installing include files
1238 $(Verb) $(MKDIR) $(includedir)
1239 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1240 cd $(BUILD_SRC_ROOT)/include && \
1241 find . -path '*/Internal' -prune -o '(' -type f \
1242 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1243 -print ')' | grep -v CVS | pax -rwdvpe $(includedir) ; \
1247 $(Echo) Uninstalling include files
1248 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1249 cd $(BUILD_SRC_ROOT)/include && \
1250 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
1251 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1252 -print ')' | grep -v CVS | sed 's#^#$(includedir)/#'` ; \
1257 #------------------------------------------------------------------------
1258 # Print out the directories used for building
1259 #------------------------------------------------------------------------
1261 $(Echo) "BuildMode : " '$(BuildMode)'
1262 $(Echo) "BUILD_SRC_ROOT : " '$(BUILD_SRC_ROOT)'
1263 $(Echo) "BUILD_SRC_DIR : " '$(BUILD_SRC_DIR)'
1264 $(Echo) "BUILD_OBJ_ROOT : " '$(BUILD_OBJ_ROOT)'
1265 $(Echo) "BUILD_OBJ_DIR : " '$(BUILD_OBJ_DIR)'
1266 $(Echo) "LLVM_SRC_ROOT : " '$(LLVM_SRC_ROOT)'
1267 $(Echo) "LLVM_OBJ_ROOT : " '$(LLVM_OBJ_ROOT)'
1268 $(Echo) "libdir : " '$(libdir)'
1269 $(Echo) "bindir : " '$(bindir)'
1270 $(Echo) "sysconfdir : " '$(sysconfdir)'
1271 $(Echo) "bytecode_libdir: " '$(bytecode_libdir)'
1272 $(Echo) "UserTargets : " '$(UserTargets)'
1273 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1274 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1275 $(Echo) "ObjDir : " '$(ObjDir)'
1276 $(Echo) "LibDir : " '$(LibDir)'
1277 $(Echo) "ToolDir : " '$(ToolDir)'
1278 $(Echo) "ExmplDir : " '$(ExmplDir)'
1279 $(Echo) "TDFiles : " '$(TDFiles)'
1280 $(Echo) "INCFiles : " '$(INCFiles)'
1281 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
1282 $(Echo) "Compile.C : " '$(Compile.C)'
1283 $(Echo) "Archive : " '$(Archive)'
1284 $(Echo) "YaccFiles : " '$(YaccFiles)'
1285 $(Echo) "LexFiles : " '$(LexFiles)'