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 := check 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)
135 clean-all:: clean-local clean-all-local
136 install:: install-local
137 uninstall:: uninstall-local
138 install-local:: all-local
139 install-bytecode:: install-bytecode-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 \
158 -felide-constructors -fomit-frame-pointer
159 C.Flags := -O3 -DNDEBUG -fomit-frame-pointer
160 LD.Flags := -O3 -DNDEBUG
163 CXX.Flags := -g -D_DEBUG
164 C.Flags := -g -D_DEBUG
165 LD.Flags := -g -D_DEBUG
170 CXX.Flags += $(CXXFLAGS)
172 CPP.Flags += $(CPPFLAGS)
173 LD.Flags += $(LDFLAGS)
175 LibTool.Flags := --tag=CXX
177 #--------------------------------------------------------------------
178 # Directory locations
179 #--------------------------------------------------------------------
180 ObjDir := $(BUILD_OBJ_DIR)/$(BuildMode)
181 LibDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/lib
182 ToolDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/bin
183 ExmplDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/examples
184 LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
185 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
186 LExmplDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
188 #--------------------------------------------------------------------
189 # Full Paths To Compiled Tools and Utilities
190 #--------------------------------------------------------------------
191 EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
194 LIBTOOL := $(LLVM_OBJ_ROOT)/mklib
197 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
200 BURG := $(LLVMToolDir)/burg$(EXEEXT)
203 TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT)
206 GCCAS := $(LLVMToolDir)/gccas$(EXEEXT)
209 GCCLD := $(LLVMToolDir)/gccld$(EXEEXT)
212 LLVMGCC := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/gcc
215 LLVMGXX := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/g++
218 LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
221 LLI := $(LLVMToolDir)/lli$(EXEEXT)
224 LOPT := $(LLVMToolDir)/opt$(EXEEXT)
227 #--------------------------------------------------------------------
228 # Adjust to user's request
229 #--------------------------------------------------------------------
231 # Adjust LIBTOOL flags for shared libraries, or not.
232 ifndef SHARED_LIBRARY
233 LibTool.Flags += --tag=disable-shared
235 LD.Flags += -rpath $(LibDir)
245 # Adjust settings for verbose mode
248 LibTool.Flags += --silent
249 AR.Flags += >/dev/null 2>/dev/null
250 ConfigureScriptFLAGS += >$(BUILD_OBJ_DIR)/configure.out 2>&1
252 ConfigureScriptFLAGS :=
255 # By default, strip symbol information from executable
257 Strip := $(PLATFORMSTRIPOPTS)
258 StripWarnMsg := "(without symbols)"
261 # Adjust linker flags for building an executable
264 LD.Flags += -rpath $(ExmplDir) -export-dynamic
266 LD.Flags += -rpath $(ToolDir) -export-dynamic
270 #----------------------------------------------------------
271 # Options To Invoke Tools
272 #----------------------------------------------------------
274 CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
276 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
277 CPP.Flags += -I$(BUILD_OBJ_DIR) \
279 -I$(BUILD_SRC_ROOT)/include \
280 -I$(BUILD_OBJ_ROOT)/include \
281 -I$(LLVM_OBJ_ROOT)/include \
282 -I$(LLVM_SRC_ROOT)/include \
283 -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
285 Compile.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags)
286 LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
287 BCCompile.C = $(LLVMGCC) $(CPP.Flags) $(CompileCommonOpts) $(C.Flags) -c
288 Compile.CXX = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
289 LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
290 BCCompile.CXX = $(LLVMGXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
291 Link = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
292 $(CompileCommonOpts) $(LD.Flags) $(Strip)
293 Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
295 LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL)
296 Burg = $(BURG) -I $(BUILD_SRC_DIR)
297 TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR)
298 Archive = $(AR) $(AR.Flags)
299 LArchive = $(LLVMToolDir)/llvm-ar rcsf
306 #----------------------------------------------------------
307 # Get the list of source files and compute object file
309 #----------------------------------------------------------
312 FakeSources := $(FAKE_SOURCES)
314 FakeSources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
316 BaseNameSources := $(sort $(basename $(FakeSources)))
317 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
318 ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
319 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
322 Sources := $(notdir $(wildcard $(BUILD_SRC_DIR)/*.cpp \
323 $(BUILD_SRC_DIR)/*.cc $(BUILD_SRC_DIR)/*.c $(BUILD_SRC_DIR)/*.y \
324 $(BUILD_SRC_DIR)/*.l))
326 Sources := $(SOURCES)
330 Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
333 BaseNameSources := $(sort $(basename $(Sources)))
334 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
335 ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
336 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
339 ###############################################################################
340 # DIRECTORIES: Handle recursive descent of directory structure
341 ###############################################################################
343 #---------------------------------------------------------
344 # Provide rules to make install dirs. This must be early
345 # in the file so they get built before dependencies
346 #---------------------------------------------------------
349 $(Verb) $(MKDIR) $(bindir)
352 $(Verb) $(MKDIR) $(libdir)
355 $(Verb) $(MKDIR) $(includedir)
358 $(Verb) $(MKDIR) $(sysconfdir)
360 # To create other directories, as needed, and timestamp their creation
362 $(Verb) $(MKDIR) $* > /dev/null
365 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
366 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
368 #---------------------------------------------------------
369 # Handle the DIRS options for sequential construction
370 #---------------------------------------------------------
375 $(RecursiveTargets)::
376 $(Verb) for dir in $(DIRS); do \
377 if [ ! -f $$dir/Makefile ]; then \
379 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
381 if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
382 ($(MAKE) -C $$dir $@ ) || exit 1; \
387 #---------------------------------------------------------
388 # Handle the EXPERIMENTAL_DIRS options ensuring success
389 # after each directory is built.
390 #---------------------------------------------------------
391 ifdef EXPERIMENTAL_DIRS
392 $(RecursiveTargets)::
393 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
394 if [ ! -f $$dir/Makefile ]; then \
396 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
398 if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
399 ($(MAKE) -C $$dir $@ ) || exit 0; \
404 #---------------------------------------------------------
405 # Handle the PARALLEL_DIRS options for parallel construction
406 #---------------------------------------------------------
409 SubDirs += $(PARALLEL_DIRS)
411 # Unfortunately, this list must be maintained if new recursive targets are added
412 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
413 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
414 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
415 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
416 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
417 install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
419 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
422 $(Verb) if [ ! -f $(@D)/Makefile ]; then \
424 cp $(BUILD_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
426 if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
427 $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@) ; \
431 #---------------------------------------------------------
432 # Handle the OPTIONAL_DIRS options for directores that may
434 #---------------------------------------------------------
437 SubDirs += $(OPTIONAL_DIRS)
439 $(RecursiveTargets)::
440 $(Verb) for dir in $(OPTIONAL_DIRS); do \
441 if [ -d $(BUILD_SRC_DIR)/$$dir ]; then\
442 if [ ! -f $$dir/Makefile ]; then \
444 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
446 if [ ! -f $$dir/LLVM_DO_NOT_BUILD ]; then \
447 ($(MAKE) -C$$dir $@ ) || exit 1; \
453 #---------------------------------------------------------
454 # Handle the CONFIG_FILES options
455 #---------------------------------------------------------
458 install-local:: $(sysconfdir) $(CONFIG_FILES)
459 $(Echo) Installing Configuration Files To $(sysconfdir)
460 $(Verb)for file in $(CONFIG_FILES); do \
461 if test -f $(BUILD_OBJ_DIR)/$${file} ; then \
462 $(INSTALL) $(BUILD_OBJ_DIR)/$${file} $(sysconfdir) ; \
463 elif test -f $(BUILD_SRC_DIR)/$${file} ; then \
464 $(INSTALL) $(BUILD_SRC_DIR)/$${file} $(sysconfdir) ; \
466 $(ECHO) Error: cannot find config file $${file}. ; \
471 $(Echo) Uninstalling Configuration Files From $(sysconfdir)
472 $(Verb)for file in $(CONFIG_FILES); do \
473 $(RM) -f $(sysconfdir)/$${file} ; \
478 ###############################################################################
479 # Library Build Rules: Four ways to build a library
480 ###############################################################################
482 #---------------------------------------------------------
483 # Bytecode Module Targets:
484 # If the user set MODULE_NAME then they want to build a
485 # bytecode module from the sources. We compile all the
486 # sources and link it together into a single bytecode
488 #---------------------------------------------------------
492 Module := $(LibDir)/$(MODULE_NAME).bc
493 LinkModule := $(LLVMGCC) -shared -nostdlib
495 ifdef EXPORTED_SYMBOL_FILE
496 LinkMOdule += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
499 $(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
500 $(Echo) Building $(BuildMOde) Bytecode Module $(notdir $@)
501 $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
503 all-local:: $(Module)
506 ifneq ($(strip $(Module)),)
507 -$(Verb) $(RM) -f $(Module)
510 ifdef BYTECODE_DESTINATION
511 ModuleDestDir := $(BYTECODE_DESTINATION)
513 ModuleDestDir := $(libdir)
516 DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc
518 install-module:: $(DestModule)
519 install-local:: $(DestModule)
521 $(DestModule): $(ModuleDestDir) $(Module)
522 $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
523 $(Verb) $(INSTALL) $(Module) $@
526 $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
527 -$(Verb) $(RM) -f $(DestModule)
531 # if we're building a library ...
534 # Make sure there isn't any extranous whitespace on the LIBRARYNAME option
535 LIBRARYNAME := $(strip $(LIBRARYNAME))
536 LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
537 LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
538 LibName.O := $(LibDir)/$(LIBRARYNAME).o
539 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
541 #---------------------------------------------------------
542 # Shared Library Targets:
543 # If the user asked for a shared library to be built
544 # with the SHARED_LIBRARY variable, then we provide
545 # targets for building them.
546 #---------------------------------------------------------
549 all-local:: $(LibName.LA)
551 $(LibName.LA): $(BUILT_SOURCES) $(ObjectsLO) $(LibDir)/.dir
552 $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
553 $(Verb) $(Link) -o $@ $(ObjectsLO)
554 $(Verb) $(LTInstall) $@ $(LibDir)
557 ifneq ($(strip $(LibName.LA)),)
558 -$(Verb) $(RM) -f $(LibName.LA)
561 DestSharedLib = $(libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
563 install-local:: $(DestSharedLib)
565 $(DestSharedLib): $(libdir) $(LibName.LA)
566 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
567 $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
568 $(Verb) $(LIBTOOL) --finish $(libdir)
571 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
572 -$(Verb) $(RM) -f $(libdir)/lib$(LIBRARYNAME).*
576 #---------------------------------------------------------
577 # Bytecode Library Targets:
578 # If the user asked for a bytecode library to be built
579 # with the BYTECODE_LIBRARY variable, then we provide
580 # targets for building them.
581 #---------------------------------------------------------
582 ifdef BYTECODE_LIBRARY
584 # make the C and C++ compilers strip debug info out of bytecode libraries.
585 BCCompile.C += -Wa,-strip-debug
586 BCCompile.CXX += -Wa,-strip-debug
588 all-local:: $(LibName.BCA)
590 ifdef EXPORTED_SYMBOL_FILE
591 BCLinkLib = $(LLVMGCC) -shared -nostdlib -Xlinker \
592 -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
594 $(LibName.BCA): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
595 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
597 $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC)
599 $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o
601 $(LibName.BCA): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir
602 $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
604 $(Verb) $(LArchive) $@ $(ObjectsBC)
609 ifneq ($(strip $(LibName.BCA)),)
610 -$(Verb) $(RM) -f $(LibName.BCA)
613 ifdef BYTECODE_DESTINATION
614 BytecodeDestDir := $(BYTECODE_DESTINATION)
616 BytecodeDestDir := $(libdir)
619 DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).a
621 install-bytecode-local:: $(DestBytecodeLib)
623 install-local:: $(DestBytecodeLib)
625 $(DestBytecodeLib): $(BytecodeDestDir) $(LibName.BCA)
626 $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
627 $(Verb) $(INSTALL) $(LibName.BCA) $@
630 $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
631 -$(Verb) $(RM) -f $(DestBytecodeLib)
635 #---------------------------------------------------------
636 # ReLinked Library Targets:
637 # If the user didn't explicitly forbid building a
638 # relinked then we provide targets for building them.
639 #---------------------------------------------------------
640 ifndef DONT_BUILD_RELINKED
642 all-local:: $(LibName.O)
644 $(LibName.O): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
645 $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
646 $(Verb) $(Relink) -o $@ $(ObjectsO)
649 ifneq ($(strip $(LibName.O)),)
650 -$(Verb) $(RM) -f $(LibName.O)
653 DestRelinkedLib = $(libdir)/$(LIBRARYNAME).o
655 install-local:: $(DestRelinkedLib)
657 $(DestRelinkedLib): $(libdir) $(LibName.O)
658 $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
659 $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
662 $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
663 -$(Verb) $(RM) -f $(DestRelinkedLib)
667 #---------------------------------------------------------
668 # Archive Library Targets:
669 # If the user wanted a regular archive library built,
670 # then we provide targets for building them.
671 #---------------------------------------------------------
674 all-local:: $(LibName.A)
676 $(LibName.A): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
677 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
679 $(Verb) $(Archive) $@ $(ObjectsO)
683 ifneq ($(strip $(LibName.A)),)
684 -$(Verb) $(RM) -f $(LibName.A)
687 DestArchiveLib := $(libdir)/lib$(LIBRARYNAME).a
689 install-local:: $(DestArchiveLib)
691 $(DestArchiveLib): $(libdir) $(LibName.A)
692 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
693 $(Verb) $(MKDIR) $(libdir)
694 $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
697 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
698 -$(Verb) $(RM) -f $(DestArchiveLib)
705 ###############################################################################
706 # Tool Build Rules: Build executable tool based on TOOLNAME option
707 ###############################################################################
711 #---------------------------------------------------------
712 # Handle the special "JIT" value for LLVM_LIBS which is a
713 # shorthand for a bunch of libraries that get the correct
714 # JIT support for a tool that runs JIT.
715 #---------------------------------------------------------
716 ifeq ($(LLVMLIBS),JIT)
718 # Make sure we can get our own symbols in the tool
721 # Generic JIT libraries
722 JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
724 # You can enable the X86 JIT on a non-X86 host by setting the flag
725 # ENABLE_X86_JIT on the make command line. If not, it will still be
726 # enabled automagically on an X86 host.
731 # What the X86 JIT requires
733 JIT_LIBS += LLVMX86 LLVMSelectionDAG
736 # You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
737 # ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
738 # enabled automagically on an SparcV9 host.
739 ifeq ($(ARCH), Sparc)
740 ENABLE_SPARCV9_JIT = 1
743 # What the Sparc JIT requires
744 ifdef ENABLE_SPARCV9_JIT
745 JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
746 LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \
747 LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
748 LLVMDataStructure.a LLVMSparcV9RegAlloc
751 # You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
752 # ENABLE_PPC_JIT on the make command line. If not, it will still be
753 # enabled automagically on an PowerPC host.
754 ifeq ($(ARCH), PowerPC)
758 # What the PowerPC JIT requires
760 JIT_LIBS += LLVMPowerPC
763 LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \
764 LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
765 LLVMSystem.a $(PLATFORMLIBDL)
768 #---------------------------------------------------------
769 # Set up variables for building a tool.
770 #---------------------------------------------------------
772 ToolBuildPath := $(ExmplDir)/$(TOOLNAME)$(EXEEXT)
774 ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
776 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
777 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
778 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
779 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
780 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
781 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
782 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
783 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
785 #---------------------------------------------------------
786 # Tell make that we need to rebuild subdirectories before
787 # we can link the tool. This affects things like LLI which
788 # has library subdirectories.
789 #---------------------------------------------------------
790 $(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
792 #---------------------------------------------------------
793 # Provide targets for building the tools
794 #---------------------------------------------------------
795 all-local:: $(ToolBuildPath)
798 ifneq ($(strip $(ToolBuildPath)),)
799 -$(Verb) $(RM) -f $(ToolBuildPath)
803 $(ToolBuildPath): $(ExmplDir)/.dir
805 $(ToolBuildPath): $(ToolDir)/.dir
808 $(ToolBuildPath): $(BUILT_SOURCES) $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
809 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
810 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
811 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB)
812 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg)
814 DestTool = $(bindir)/$(TOOLNAME)
816 install-local:: $(DestTool)
818 $(DestTool): $(bindir) $(ToolBuildPath)
819 $(Echo) Installing $(BuildMode) $(DestTool)
820 $(Verb) $(INSTALL) $(ToolBuildPath) $(DestTool)
823 $(Echo) Uninstalling $(BuildMode) $(DestTool)
824 -$(Verb) $(RM) -f $(DestTool)
828 ###############################################################################
829 # Object Build Rules: Build object files based on sources
830 ###############################################################################
832 # Provide rule sets for when dependency generation is enabled
833 ifndef DISABLE_AUTO_DEPENDENCIES
835 #---------------------------------------------------------
836 # Create .lo files in the ObjDir directory from the .cpp and .c files...
837 #---------------------------------------------------------
840 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
841 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
842 $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
843 then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
844 else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
846 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
847 $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
848 $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
849 then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
850 else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
852 #---------------------------------------------------------
853 # Create .o files in the ObjDir directory from the .cpp and .c files...
854 #---------------------------------------------------------
857 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
858 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
859 $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
860 then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
861 else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
863 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
864 $(Echo) "Compiling $*.c for $(BuildMode) build"
865 $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
866 then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
867 else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
871 #---------------------------------------------------------
872 # Create .bc files in the ObjDir directory from .cpp and .c files...
873 #---------------------------------------------------------
874 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS)
875 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
876 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
877 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
878 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
880 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS)
881 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
882 $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
883 then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
884 else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
886 # Provide alternate rule sets if dependencies are disabled
891 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
892 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
893 $(LTCompile.CXX) $< -o $@
895 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
896 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
897 $(LTCompile.C) $< -o $@
901 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
902 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
903 $(Compile.CXX) $< -o $@
905 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
906 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
907 $(Compile.C) $< -o $@
910 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS)
911 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
912 $(BCCompile.CXX) $< -o $@
914 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS)
915 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
916 $(BCCompile.C) $< -o $@
920 #---------------------------------------------------------
921 # Provide rule to build .bc files from .ll sources,
922 # regardless of dependencies
923 #---------------------------------------------------------
924 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
925 $(Echo) "Compiling $*.ll for $(BuildMode) build"
926 $(Verb) $(LLVMAS) $< -f -o $@
928 ###############################################################################
929 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
930 ###############################################################################
934 TDFiles := $(strip $(wildcard $(BUILD_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
935 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
937 $(INCFiles) : $(TBLGEN) $(TDFiles)
939 %GenRegisterNames.inc : %.td
940 $(Echo) "Building $(<F) register names with tblgen"
941 $(Verb) $(TableGen) -gen-register-enums -o $@ $<
943 %GenRegisterInfo.h.inc : %.td
944 $(Echo) "Building $(<F) register information header with tblgen"
945 $(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
947 %GenRegisterInfo.inc : %.td
948 $(Echo) "Building $(<F) register info implementation with tblgen"
949 $(Verb) $(TableGen) -gen-register-desc -o $@ $<
951 %GenInstrNames.inc : %.td
952 $(Echo) "Building $(<F) instruction names with tblgen"
953 $(Verb) $(TableGen) -gen-instr-enums -o $@ $<
955 %GenInstrInfo.inc : %.td
956 $(Echo) "Building $(<F) instruction information with tblgen"
957 $(Verb) $(TableGen) -gen-instr-desc -o $@ $<
959 %GenAsmWriter.inc : %.td
960 $(Echo) "Building $(<F) assembly writer with tblgen"
961 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
963 %GenATTAsmWriter.inc : %.td
964 $(Echo) "Building $(<F) AT&T assembly writer with tblgen"
965 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
967 %GenIntelAsmWriter.inc : %.td
968 $(Echo) "Building $(<F) Intel assembly writer with tblgen"
969 $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
971 %GenInstrSelector.inc: %.td
972 $(Echo) "Building $(<F) instruction selector with tblgen"
973 $(Verb) $(TableGen) -gen-instr-selector -o $@ $<
975 %GenCodeEmitter.inc:: %.td
976 $(Echo) "Building $(<F) code emitter with tblgen"
977 $(Verb) $(TableGen) -gen-emitter -o $@ $<
980 -$(Verb) $(RM) -f $(INCFiles)
984 ###############################################################################
985 # LEX AND YACC: Provide rules for generating sources with lex and yacc
986 ###############################################################################
988 #---------------------------------------------------------
989 # Provide rules for generating a .cpp source file from
990 # (f)lex input sources.
991 #---------------------------------------------------------
993 LexFiles := $(filter %.l,$(Sources))
997 LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
999 .PRECIOUS: $(LexOutput)
1001 # Note the extra sed filtering here, used to cut down on the warnings emited
1002 # by GCC. The last line is a gross hack to work around flex aparently not
1003 # being able to resize the buffer on a large token input. Currently, for
1004 # uninitialized string buffers in LLVM we can generate very long tokens, so
1005 # this is a hack around it.
1006 # FIXME. (f.e. char Buffer[10000] )
1008 $(Echo) Flexing $*.l
1009 $(Verb) $(FLEX) -t $< | \
1010 $(SED) 's/void yyunput/inline void yyunput/' | \
1011 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
1012 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
1016 -$(Verb) $(RM) -f $(LexOutput)
1017 $(Verb) $(RM) -f $(LexOutput)
1021 #---------------------------------------------------------
1022 # Provide rules for generating a .cpp and .h source files
1023 # from yacc (bison) input sources.
1024 #---------------------------------------------------------
1026 YaccFiles := $(filter %.y,$(Sources))
1027 ifneq ($(YaccFiles),)
1028 YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
1030 .PRECIOUS: $(YaccOutput)
1032 # Cancel built-in rules for yacc
1037 # Rule for building the bison parsers...
1039 $(Echo) "Bisoning $*.y"
1040 $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
1041 $(Verb) $(MV) -f $*.tab.c $*.cpp
1042 $(Verb) $(MV) -f $*.tab.h $*.h
1045 -$(Verb) $(RM) -f $(YaccOutput)
1046 $(Verb) $(RM) -f $(YaccOutput)
1049 ###############################################################################
1050 # OTHER RULES: Other rules needed
1051 ###############################################################################
1053 # To create postscript files from dot files...
1054 ifneq ($(DOT),false)
1056 $(DOT) -Tps < $< > $@
1059 $(Echo) "Cannot build $@: The program dot is not installed"
1062 # This rules ensures that header files that are removed still have a rule for
1063 # which they can be "generated." This allows make to ignore them and
1064 # reproduce the dependency lists.
1067 # Define clean-local to clean the current directory. Note that this uses a
1068 # very conservative approach ensuring that empty variables do not cause
1069 # errors or disastrous removal.
1071 ifneq ($(strip $(ObjDir)),)
1072 -$(Verb) $(RM) -rf $(ObjDir)
1074 -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
1075 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1076 -$(Verb) $(RM) -f *$(SHLIBEXT)
1080 -$(Verb) $(RM) -rf Debug Release Profile
1082 # Build tags database for Emacs/Xemacs:
1086 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
1087 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
1088 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1089 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1090 -name '*.cpp' -o -name '*.h' | \
1091 $(ETAGS) $(ETAGSFLAGS) -
1094 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
1095 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
1096 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1097 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1098 \( -name '*.cpp' -o -name '*.h' \) -print | \
1099 ctags -ImtT -o $(BUILD_OBJ_ROOT)/CTAGS -L -
1102 ###############################################################################
1103 # DEPENDENCIES: Include the dependency files if we should
1104 ###############################################################################
1105 ifndef DISABLE_AUTO_DEPENDENCIES
1107 # If its not one of the cleaning targets
1108 ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
1110 # Get the list of dependency files
1111 DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
1112 DependFiles := $(patsubst %,$(BUILD_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
1114 -include /dev/null $(DependFiles)
1120 ###############################################################################
1121 # CHECK: Running the test suite
1122 ###############################################################################
1125 $(Verb) if test -d "$(BUILD_OBJ_ROOT)/test" ; then \
1126 if test -f "$(BUILD_OBJ_ROOT)/test/Makefile" ; then \
1127 $(EchoCmd) Running test suite ; \
1128 $(MAKE) -C $(BUILD_OBJ_ROOT)/test check-local \
1129 TESTSUITE=$(TESTSUITE) ; \
1131 $(EchoCmd) No Makefile in test directory ; \
1134 $(EchoCmd) No test directory ; \
1137 ###############################################################################
1138 # DISTRIBUTION: Handle construction of a distribution tarball
1139 ###############################################################################
1141 #------------------------------------------------------------------------
1142 # Define distribution related variables
1143 #------------------------------------------------------------------------
1144 DistName := $(LLVM_TARBALL_NAME)
1145 DistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1146 TopDistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1147 DistTarGZip := $(BUILD_OBJ_ROOT)/$(DistName).tar.gz
1148 DistZip := $(BUILD_OBJ_ROOT)/$(DistName).zip
1149 DistTarBZ2 := $(BUILD_OBJ_ROOT)/$(DistName).tar.bz2
1150 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1151 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1152 Makefile.config.in configure autoconf
1153 DistOther := $(notdir $(wildcard \
1154 $(BUILD_SRC_DIR)/*.h \
1155 $(BUILD_SRC_DIR)/*.td \
1156 $(BUILD_SRC_DIR)/*.def \
1157 $(BUILD_SRC_DIR)/*.ll \
1158 $(BUILD_SRC_DIR)/*.in))
1159 DistSubDirs := $(SubDirs)
1160 DistSources = $(Sources) $(EXTRA_DIST)
1161 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
1163 #------------------------------------------------------------------------
1164 # We MUST build distribution with OBJ_DIR != SRC_DIR
1165 #------------------------------------------------------------------------
1166 ifeq ($(BUILD_SRC_DIR),$(BUILD_OBJ_DIR))
1167 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1168 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1172 #------------------------------------------------------------------------
1173 # Prevent catastrophic remove
1174 #------------------------------------------------------------------------
1175 ifeq ($(LLVM_TARBALL_NAME),)
1176 $(error LLVM_TARBALL_NAME is empty. Please rerun configure)
1179 #------------------------------------------------------------------------
1180 # Prevent attempt to run dist targets from anywhere but the top level
1181 #------------------------------------------------------------------------
1184 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1185 $(Echo) ERROR: You must run $@ from $(BUILD_OBJ_ROOT)
1189 #------------------------------------------------------------------------
1190 # Provide the top level targets
1191 #------------------------------------------------------------------------
1193 dist-gzip:: $(DistTarGZip)
1195 $(DistTarGZip) : $(TopDistDir)/.makedistdir
1196 $(Echo) Packing gzipped distribution tar file.
1197 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1198 $(GZIP) -c > "$(DistTarGZip)"
1200 dist-bzip2:: $(DistTarBZ2)
1202 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
1203 $(Echo) Packing bzipped distribution tar file.
1204 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1205 $(BZIP2) -c >$(DistTarBZ2)
1207 dist-zip:: $(DistZip)
1209 $(DistZip) : $(TopDistDir)/.makedistdir
1210 $(Echo) Packing zipped distribution file.
1211 $(Verb) rm -f $(DistZip)
1212 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1214 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
1215 $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
1217 DistCheckDir := $(LLVM_OBJ_ROOT)/_distcheckdir
1219 dist-check:: $(DistTarGZip)
1220 $(Echo) Checking distribution tar file.
1221 $(Verb) if test -d $(DistCheckDir) ; then \
1222 $(RM) -rf $(DistCheckDir) ; \
1224 $(Verb) $(MKDIR) $(DistCheckDir)
1225 $(Verb) cd $(DistCheckDir) && \
1226 $(MKDIR) $(DistCheckDir)/build && \
1227 $(MKDIR) $(DistCheckDir)/install && \
1228 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1230 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1231 --srcdir=../$(DistName) --with-llvmgccdir="$(LLVMGCCDIR)" && \
1234 $(MAKE) install && \
1235 $(MAKE) uninstall && \
1238 $(MAKE) dist-clean && \
1239 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1242 $(Echo) Cleaning distribution files
1243 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
1248 #------------------------------------------------------------------------
1249 # Provide the recursive distdir target for building the distribution directory
1250 #------------------------------------------------------------------------
1251 distdir: $(DistDir)/.makedistdir
1252 $(DistDir)/.makedistdir: $(DistSources)
1253 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1254 if test -d "$(DistDir)" ; then \
1255 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
1258 $(EchoCmd) Removing old $(DistDir) ; \
1259 $(RM) -rf $(DistDir); \
1260 $(EchoCmd) Making 'all' to verify build ; \
1263 $(Echo) Building Distribution Directory $(DistDir)
1264 $(Verb) $(MKDIR) $(DistDir)
1265 $(Verb) srcdirstrip=`echo "$(BUILD_SRC_DIR)" | sed 's|.|.|g'`; \
1266 srcrootstrip=`echo "$(BUILD_SRC_ROOT)" | sed 's|.|.|g'`; \
1267 for file in $(DistFiles) ; do \
1269 $(BUILD_SRC_DIR)/*) \
1270 file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
1272 $(BUILD_SRC_ROOT)/*) \
1273 file=`echo "$$file" | \
1274 sed "s#^$$srcrootstrip/##"` \
1277 if test -f "$(BUILD_SRC_DIR)/$$file" || \
1278 test -d "$(BUILD_SRC_DIR)/$$file" ; then \
1279 from_dir="$(BUILD_SRC_DIR)" ; \
1280 elif test -f "$$file" || test -d "$$file" ; then \
1283 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
1284 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1285 to_dir="$(DistDir)/$$dir"; \
1286 $(MKDIR) "$$to_dir" ; \
1288 to_dir="$(DistDir)"; \
1290 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1291 if test -n "$$mid_dir" ; then \
1292 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1294 if test -d "$$from_dir/$$file"; then \
1295 if test -d "$(BUILD_SRC_DIR)/$$file" && \
1296 test "$$from_dir" != "$(BUILD_SRC_DIR)" ; then \
1297 cp -pR "$(BUILD_SRC_DIR)/$$file" "$$to_dir" || exit 1; \
1299 cp -pR $$from_dir/$$file $$to_dir || exit 1; \
1300 elif test -f "$$from_dir/$$file" ; then \
1301 cp -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1302 elif test -L "$$from_dir/$$file" ; then \
1303 cp -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
1304 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1305 $(EchoCmd) "===== WARNING: Distribution Source " \
1306 "$$from_dir/$$file Not Found!" ; \
1307 elif test "$(Verb)" != '@' ; then \
1308 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
1311 $(Verb) for subdir in $(DistSubDirs) ; do \
1312 if test "$$subdir" \!= "." ; then \
1313 new_distdir="$(DistDir)/$$subdir" ; \
1314 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
1315 ( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || \
1319 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1320 $(EchoCmd) Eliminating CVS directories from distribution ; \
1321 $(RM) -rf `find $(TopDistDir) -type d -name CVS -print` ;\
1322 $(MAKE) dist-hook ; \
1323 $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
1324 -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
1325 -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
1326 -o ! -type d ! -perm -444 -exec \
1327 $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1328 || chmod -R a+r $(DistDir) ; \
1331 # This is invoked by distdir target, define it as a no-op to avoid errors if not
1337 ###############################################################################
1338 # TOP LEVEL - targets only to apply at the top level directory
1339 ###############################################################################
1343 #------------------------------------------------------------------------
1344 # Install support for the project's include files:
1345 #------------------------------------------------------------------------
1347 $(Echo) Installing include files
1348 $(Verb) $(MKDIR) $(includedir)
1349 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1350 cd $(BUILD_SRC_ROOT)/include && \
1351 find . -path '*/Internal' -prune -o '(' -type f \
1352 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1353 -print ')' | grep -v CVS | pax -rwdvpe $(includedir) ; \
1357 $(Echo) Uninstalling include files
1358 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1359 cd $(BUILD_SRC_ROOT)/include && \
1360 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
1361 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1362 -print ')' | grep -v CVS | sed 's#^#$(includedir)/#'` ; \
1367 #------------------------------------------------------------------------
1368 # Print out the directories used for building
1369 #------------------------------------------------------------------------
1371 $(Echo) "BuildMode : " '$(BuildMode)'
1372 $(Echo) "BUILD_SRC_ROOT : " '$(BUILD_SRC_ROOT)'
1373 $(Echo) "BUILD_SRC_DIR : " '$(BUILD_SRC_DIR)'
1374 $(Echo) "BUILD_OBJ_ROOT : " '$(BUILD_OBJ_ROOT)'
1375 $(Echo) "BUILD_OBJ_DIR : " '$(BUILD_OBJ_DIR)'
1376 $(Echo) "LLVM_SRC_ROOT : " '$(LLVM_SRC_ROOT)'
1377 $(Echo) "LLVM_OBJ_ROOT : " '$(LLVM_OBJ_ROOT)'
1378 $(Echo) "libdir : " '$(libdir)'
1379 $(Echo) "bindir : " '$(bindir)'
1380 $(Echo) "sysconfdir : " '$(sysconfdir)'
1381 $(Echo) "UserTargets : " '$(UserTargets)'
1382 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1383 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1384 $(Echo) "ObjDir : " '$(ObjDir)'
1385 $(Echo) "LibDir : " '$(LibDir)'
1386 $(Echo) "ToolDir : " '$(ToolDir)'
1387 $(Echo) "ExmplDir : " '$(ExmplDir)'
1388 $(Echo) "Sources : " '$(Sources)'
1389 $(Echo) "TDFiles : " '$(TDFiles)'
1390 $(Echo) "INCFiles : " '$(INCFiles)'
1391 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
1392 $(Echo) "Compile.C : " '$(Compile.C)'
1393 $(Echo) "Archive : " '$(Archive)'
1394 $(Echo) "YaccFiles : " '$(YaccFiles)'
1395 $(Echo) "LexFiles : " '$(LexFiles)'
1396 $(Echo) "Module : " '$(Module)'