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) $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS)
92 $(Verb) $(ConfigStatusScript)
94 #------------------------------------------------------------------------
95 # Make sure the configuration makefile is up to date
96 #------------------------------------------------------------------------
97 $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
98 $(Echo) Regenerating $@
99 $(Verb) cd $(LLVM_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
101 #------------------------------------------------------------------------
102 # If the Makefile in the source tree has been updated, copy it over into the
103 # build tree. But, only do this if the source and object makefiles differ
104 #------------------------------------------------------------------------
105 ifneq ($(BUILD_OBJ_DIR),$(BUILD_SRC_DIR))
107 Makefile: $(BUILD_SRC_DIR)/Makefile
108 $(Echo) "Updating Makefile"
109 $(Verb) $(MKDIR) $(@D)
112 # Copy the Makefile.* files unless we're in the root directory which avoids
113 # the copying of Makefile.config.in or other things that should be explicitly
115 $(BUILD_OBJ_DIR)/Makefile% : $(BUILD_SRC_DIR)/Makefile%
117 *Makefile.rules) ;; \
119 *) $(Echo) "Updating $(@F)" ; \
126 #------------------------------------------------------------------------
127 # Set up the basic dependencies
128 #------------------------------------------------------------------------
129 $(UserTargets):: $(PreConditions)
134 clean-all:: clean-local clean-all-local
135 install:: install-local
136 uninstall:: uninstall-local
137 check-local:: all-local
138 install-local:: all-local
140 ###############################################################################
141 # VARIABLES: Set up various variables based on configuration data
142 ###############################################################################
144 #--------------------------------------------------------------------
145 # Variables derived from configuration we are building
146 #--------------------------------------------------------------------
148 ifdef ENABLE_PROFILING
150 CXX.Flags := -O3 -DNDEBUG -felide-constructors -finline-functions -pg
151 C.Flags := -O3 -DNDEBUG -pg
152 LD.Flags := -O3 -DNDEBUG -pg
154 ifdef ENABLE_OPTIMIZED
156 CXX.Flags := -O3 -DNDEBUG -finline-functions -felide-constructors -fomit-frame-pointer
157 C.Flags := -O3 -DNDEBUG -fomit-frame-pointer
158 LD.Flags := -O3 -DNDEBUG
161 CXX.Flags := -g -D_DEBUG
162 C.Flags := -g -D_DEBUG
163 LD.Flags := -g -D_DEBUG
168 CXX.Flags += $(CXXFLAGS)
170 CPP.Flags += $(CPPFLAGS)
171 LD.Flags += $(LDFLAGS)
173 LibTool.Flags := --tag=CXX
175 #--------------------------------------------------------------------
176 # Directory locations
177 #--------------------------------------------------------------------
178 ObjDir := $(BUILD_OBJ_DIR)/$(BuildMode)
179 LibDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/lib
180 ToolDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/bin
181 ExmplDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/examples
182 LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
183 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
184 LExmplDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
186 #--------------------------------------------------------------------
187 # Full Paths To Compiled Tools and Utilities
188 #--------------------------------------------------------------------
189 EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
192 LIBTOOL := $(LLVM_OBJ_ROOT)/mklib
195 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
198 BURG := $(LLVMToolDir)/burg$(EXEEXT)
201 TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT)
204 GCCLD := $(LLVMToolDir)/gccld$(EXEEXT)
207 LLVMGCC := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/gcc
210 LLVMGXX := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/g++
213 # Need a better way to compute this.
214 LLVMGCCLibDir := $(dir $(shell $(LLVMGCC) -print-file-name=libgcc.a))/
216 #--------------------------------------------------------------------
217 # Adjust to user's request
218 #--------------------------------------------------------------------
220 # Adjust LIBTOOL flags for shared libraries, or not.
221 ifndef SHARED_LIBRARY
222 LibTool.Flags += --tag=disable-shared
224 LD.Flags += -rpath $(LibDir)
231 BCLinkLib.Flags += -v
235 # Adjust settings for verbose mode
238 LibTool.Flags += --silent
239 AR.Flags += >/dev/null 2>/dev/null
240 ConfigureScriptFLAGS += >$(BUILD_OBJ_DIR)/configure.out 2>&1
242 ConfigureScriptFLAGS :=
245 # By default, strip symbol information from executable
247 Strip := $(PLATFORMSTRIPOPTS)
248 StripWarnMsg := "(without symbols)"
251 # Adjust linker flags for building an executable
254 LD.Flags += -rpath $(ExmplDir) -export-dynamic
256 LD.Flags += -rpath $(ToolDir) -export-dynamic
260 #----------------------------------------------------------
261 # Options To Invoke Tools
262 #----------------------------------------------------------
264 CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
266 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
267 CPP.Flags += -I$(BUILD_OBJ_DIR) \
269 -I$(BUILD_SRC_ROOT)/include \
270 -I$(BUILD_OBJ_ROOT)/include \
271 -I$(LLVM_OBJ_ROOT)/include \
272 -I$(LLVM_SRC_ROOT)/include \
273 -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
275 Compile.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags)
276 LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
277 BCCompile.C = $(LLVMGCC) $(CPP.Flags) $(CompileCommonOpts) $(C.Flags) -c
278 Compile.CXX = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
279 LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
280 BCCompile.CXX = $(LLVMGXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
281 Link = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
282 $(CompileCommonOpts) $(LD.Flags) $(Strip)
283 Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
285 BCLinkLib = $(LLVMGCC) -shared -nostdlib $(BCLinkLib.Flags)
286 LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL)
287 Burg = $(BURG) -I $(BUILD_SRC_DIR)
288 TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR)
289 Archive = $(AR) $(AR.Flags)
290 LArchive = $(ToolDir)/llvm-ar rcsf
297 #----------------------------------------------------------
298 # Get the list of source files
299 #----------------------------------------------------------
301 Sources := $(notdir $(wildcard $(BUILD_SRC_DIR)/*.cpp \
302 $(BUILD_SRC_DIR)/*.cc $(BUILD_SRC_DIR)/*.c $(BUILD_SRC_DIR)/*.y \
303 $(BUILD_SRC_DIR)/*.l))
305 Sources := $(SOURCES)
309 Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
312 #----------------------------------------------------------
313 # Types of objects that can be built from sources
314 #----------------------------------------------------------
315 BaseNameSources := $(sort $(basename $(Sources)))
316 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
317 ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
318 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
320 ###############################################################################
321 # DIRECTORIES: Handle recursive descent of directory structure
322 ###############################################################################
324 #---------------------------------------------------------
325 # Provide rules to make install dirs. This must be early
326 # in the file so they get built before dependencies
327 #---------------------------------------------------------
330 $(Verb) $(MKDIR) $(bindir)
333 $(Verb) $(MKDIR) $(libdir)
336 $(Verb) $(MKDIR) $(bytecode_libdir)
339 $(Verb) $(MKDIR) $(sysconfdir)
341 # To create other directories, as needed, and timestamp their creation
343 $(Verb) $(MKDIR) $* > /dev/null
346 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
347 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
349 #---------------------------------------------------------
350 # Handle the DIRS options for sequential construction
351 #---------------------------------------------------------
356 $(RecursiveTargets)::
357 $(Verb) for dir in $(DIRS); do \
358 if [ ! -f $$dir/Makefile ]; then \
360 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
362 ($(MAKE) -C $$dir $@ ) || exit 1; \
366 #---------------------------------------------------------
367 # Handle the EXPERIMENTAL_DIRS options ensuring success
368 # after each directory is built.
369 #---------------------------------------------------------
370 ifdef EXPERIMENTAL_DIRS
371 $(RecursiveTargets)::
372 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
373 if [ ! -f $$dir/Makefile ]; then \
375 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
377 ($(MAKE) -C $$dir $@ ) || exit 0; \
381 #---------------------------------------------------------
382 # Handle the PARALLEL_DIRS options for parallel construction
383 #---------------------------------------------------------
386 SubDirs += $(PARALLEL_DIRS)
388 # Unfortunately, this list must be maintained if new
389 # recursive targets are added.
390 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
391 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
392 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
393 check :: $(addsuffix /.makecheck ,$(PARALLEL_DIRS))
394 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
395 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
397 Parallel_Targets := $(foreach T,$(RecursiveTargets),%/.make$(T))
399 $(Parallel_Targets) :
400 $(Verb) if [ ! -f $(@D)/Makefile ]; then \
402 cp $(BUILD_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
404 $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
407 #---------------------------------------------------------
408 # Handle the OPTIONAL_DIRS options for directores that may
410 #---------------------------------------------------------
413 SubDirs += $(OPTIONAL_DIRS)
415 $(RecursiveTargets)::
416 $(Verb) for dir in $(OPTIONAL_DIRS); do \
417 if [ -d $(BUILD_SRC_DIR)/$$dir ]; then\
418 if [ ! -f $$dir/Makefile ]; then \
420 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
422 ($(MAKE) -C$$dir $@ ) || exit 1; \
427 #---------------------------------------------------------
428 # Handle the CONFIG_FILES options
429 #---------------------------------------------------------
432 install-local:: $(sysconfdir) $(CONFIG_FILES)
433 $(Echo) Installing Configuration Files To $(sysconfdir)
434 $(Verb)for file in $(CONFIG_FILES); do \
435 if test -f $(BUILD_OBJ_DIR)/$${file} ; then \
436 $(INSTALL) $(BUILD_OBJ_DIR)/$${file} $(sysconfdir) ; \
437 elif test -f $(BUILD_SRC_DIR)/$${file} ; then \
438 $(INSTALL) $(BUILD_SRC_DIR)/$${file} $(sysconfdir) ; \
440 $(ECHO) Error: cannot find config file $${file}. ; \
445 $(Echo) Uninstalling Configuration Files From $(sysconfdir)
446 $(Verb)for file in $(CONFIG_FILES); do \
447 $(RM) -f $(sysconfdir)/$${file} ; \
452 ###############################################################################
453 # Library Build Rules: Four ways to build a library
454 ###############################################################################
457 # if we're building a library ...
460 # Make sure there isn't any extranous whitespace on the LIBRARYNAME option
461 LIBRARYNAME := $(strip $(LIBRARYNAME))
462 LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
463 LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
464 LibName.O := $(LibDir)/$(LIBRARYNAME).o
465 LibName.BC := $(LibDir)/lib$(LIBRARYNAME).bc
467 #---------------------------------------------------------
468 # Shared Library Targets:
469 # If the user asked for a shared library to be built
470 # with the SHARED_LIBRARY variable, then we provide
471 # targets for building them.
472 #---------------------------------------------------------
475 all-local:: $(LibName.LA)
477 $(LibName.LA): $(BUILT_SOURCES) $(ObjectsLO) $(LibDir)/.dir
478 $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
479 $(Verb) $(Link) -o $@ $(ObjectsLO)
480 $(Verb) $(LTInstall) $@ $(LibDir)
483 ifneq ($(strip $(LibName.LA)),)
484 -$(Verb) $(RM) -f $(LibName.LA)
487 DestSharedLib = $(libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
489 install-local:: $(DestSharedLib)
491 $(DestSharedLib): $(libdir) $(LibName.LA)
492 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
493 $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
494 $(Verb) $(LIBTOOL) --finish $(libdir)
497 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
498 -$(Verb) $(RM) -f $(libdir)/lib$(LIBRARYNAME).*
502 #---------------------------------------------------------
503 # Bytecode Library Targets:
504 # If the user asked for a bytecode library to be built
505 # with the BYTECODE_LIBRARY variable, then we provide
506 # targets for building them.
507 #---------------------------------------------------------
508 ifdef BYTECODE_LIBRARY
510 ifdef EXPORTED_SYMBOL_LIST
511 BCLinkLib += -Xlinker -internalize-public-api-list=$(EXPORTED_SYMBOL_LIST)
513 ifdef EXPORTED_SYMBOL_FILE
514 BCLinkLib += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
516 BCLinkLib += -Xlinker -disable-internalize
520 all-local:: $(LibName.BC)
522 $(LibName.BC): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir
523 $(Echo) Linking $(BuildMode) Bytecode Library $(notdir $@)
524 $(Verb) $(BCLinkLib) -o $@ $(ObjectsBC)
527 ifneq ($(strip $(LibName.BC)),)
528 -$(Verb) $(RM) -f $(LibName.BC)
531 DestBytecodeLib = $(bytecode_libdir)/lib$(LIBRARYNAME).bc
533 install-local:: $(DestBytecodeLib)
535 $(DestBytecodeLib): $(bytecode_libdir) $(LibName.BC)
536 $(Echo) Installing $(BuildMode) Bytecode Library $(DestBytecodeLib)
537 $(Verb) $(INSTALL) $(LibName.BC) $@
540 $(Echo) Uninstalling $(BuildMode) Bytecode Library $(DestBytecodeLib)
541 -$(Verb) $(RM) -f $(DestBytecodeLib)
545 #---------------------------------------------------------
546 # ReLinked Library Targets:
547 # If the user didn't explicitly forbid building a
548 # relinked then we provide targets for building them.
549 #---------------------------------------------------------
550 ifndef DONT_BUILD_RELINKED
552 all-local:: $(LibName.O)
554 $(LibName.O): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
555 $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
556 $(Verb) $(Relink) -o $@ $(ObjectsO)
559 ifneq ($(strip $(LibName.O)),)
560 -$(Verb) $(RM) -f $(LibName.O)
563 DestRelinkedLib = $(libdir)/$(LIBRARYNAME).o
565 install-local:: $(DestRelinkedLib)
567 $(DestRelinkedLib): $(libdir) $(LibName.O)
568 $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
569 $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
572 $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
573 -$(Verb) $(RM) -f $(DestRelinkedLib)
577 #---------------------------------------------------------
578 # Archive Library Targets:
579 # If the user wanted a regular archive library built,
580 # then we provide targets for building them.
581 #---------------------------------------------------------
584 all-local:: $(LibName.A)
586 $(LibName.A): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
587 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
589 $(Verb) $(Archive) $@ $(ObjectsO)
593 ifneq ($(strip $(LibName.A)),)
594 -$(Verb) $(RM) -f $(LibName.A)
597 DestArchiveLib := $(libdir)/lib$(LIBRARYNAME).a
599 install-local:: $(DestArchiveLib)
601 $(DestArchiveLib): $(libdir) $(LibName.A)
602 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
603 $(Verb) $(MKDIR) $(libdir)
604 $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
607 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
608 -$(Verb) $(RM) -f $(DestArchiveLib)
615 ###############################################################################
616 # Tool Build Rules: Build executable tool based on TOOLNAME option
617 ###############################################################################
621 #---------------------------------------------------------
622 # Handle the special "JIT" value for LLVM_LIBS which is a
623 # shorthand for a bunch of libraries that get the correct
624 # JIT support for a tool that runs JIT.
625 #---------------------------------------------------------
626 ifeq ($(LLVMLIBS),JIT)
628 # Make sure we can get our own symbols in the tool
631 # Generic JIT libraries
632 JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
634 # You can enable the X86 JIT on a non-X86 host by setting the flag
635 # ENABLE_X86_JIT on the make command line. If not, it will still be
636 # enabled automagically on an X86 host.
641 # What the X86 JIT requires
643 JIT_LIBS += LLVMX86 LLVMSelectionDAG
646 # You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
647 # ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
648 # enabled automagically on an SparcV9 host.
649 ifeq ($(ARCH), Sparc)
650 ENABLE_SPARCV9_JIT = 1
653 # What the Sparc JIT requires
654 ifdef ENABLE_SPARCV9_JIT
655 JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
656 LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \
657 LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
658 LLVMDataStructure.a LLVMSparcV9RegAlloc
661 # You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
662 # ENABLE_PPC_JIT on the make command line. If not, it will still be
663 # enabled automagically on an PowerPC host.
664 ifeq ($(ARCH), PowerPC)
668 # What the PowerPC JIT requires
670 JIT_LIBS += LLVMPowerPC
673 LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \
674 LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
675 LLVMSystem.a $(PLATFORMLIBDL)
678 #---------------------------------------------------------
679 # Set up variables for building a tool.
680 #---------------------------------------------------------
682 ToolBuildPath := $(ExmplDir)/$(TOOLNAME)$(EXEEXT)
684 ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
686 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
687 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
688 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
689 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
690 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
691 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
692 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
693 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
695 #---------------------------------------------------------
696 # Tell make that we need to rebuild subdirectories before
697 # we can link the tool. This affects things like LLI which
698 # has library subdirectories.
699 #---------------------------------------------------------
700 $(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
702 #---------------------------------------------------------
703 # Provide targets for building the tools
704 #---------------------------------------------------------
705 all-local:: $(ToolBuildPath)
708 ifneq ($(strip $(ToolBuildPath)),)
709 -$(Verb) $(RM) -f $(ToolBuildPath)
713 $(ToolBuildPath): $(ExmplDir)/.dir
715 $(ToolBuildPath): $(ToolDir)/.dir
718 $(ToolBuildPath): $(BUILT_SOURCES) $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
719 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
720 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
721 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB)
722 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg)
724 DestTool = $(bindir)/$(TOOLNAME)
726 install-local:: $(DestTool)
728 $(DestTool): $(bindir) $(ToolBuildPath)
729 $(Echo) Installing $(BuildMode) $(DestTool)
730 $(Verb) $(INSTALL) $(ToolBuildPath) $(DestTool)
733 $(Echo) Uninstalling $(BuildMode) $(DestTool)
734 -$(Verb) $(RM) -f $(DestTool)
738 ###############################################################################
739 # Object Build Rules: Build object files based on sources
740 ###############################################################################
742 # Provide rule sets for when dependency generation is enabled
743 ifndef DISABLE_AUTO_DEPENDENCIES
745 #---------------------------------------------------------
746 # Create .lo files in the ObjDir directory from the .cpp and .c files...
747 #---------------------------------------------------------
750 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
751 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
752 $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
753 then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
754 else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
756 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
757 $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
758 $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
759 then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
760 else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
762 #---------------------------------------------------------
763 # Create .o files in the ObjDir directory from the .cpp and .c files...
764 #---------------------------------------------------------
767 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
768 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
769 $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
770 then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
771 else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
773 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
774 $(Echo) "Compiling $*.c for $(BuildMode) build"
775 $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
776 then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
777 else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
781 #---------------------------------------------------------
782 # Create .bc files in the ObjDir directory from .cpp and .c files...
783 #---------------------------------------------------------
784 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir
785 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
786 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
787 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
788 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
790 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir
791 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
792 $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
793 then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
794 else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
796 # Provide alternate rule sets if dependencies are disabled
801 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
802 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
803 $(LTCompile.CXX) $< -o $@
805 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
806 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
807 $(LTCompile.C) $< -o $@
811 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
812 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
813 $(Compile.CXX) $< -o $@
815 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
816 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
817 $(Compile.C) $< -o $@
820 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir
821 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
822 $(BCCompile.CXX) $< -o $@
824 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir
825 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
826 $(BCCompile.C) $< -o $@
830 #---------------------------------------------------------
831 # Provide rule to build .bc files from .ll sources,
832 # regardless of dependencies
833 #---------------------------------------------------------
834 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
835 $(Echo) "Compiling $*.ll for $(BuildMode) build"
836 $(Verb) $(LLVMAS) $< -f -o $@
838 ###############################################################################
839 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
840 ###############################################################################
844 TDFiles := $(strip $(wildcard $(BUILD_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
845 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
847 $(INCFiles) : $(TBLGEN) $(TDFiles)
849 %GenRegisterNames.inc : %.td
850 $(Echo) "Building $(<F) register names with tblgen"
851 $(Verb) $(TableGen) -gen-register-enums -o $@ $<
853 %GenRegisterInfo.h.inc : %.td
854 $(Echo) "Building $(<F) register information header with tblgen"
855 $(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
857 %GenRegisterInfo.inc : %.td
858 $(Echo) "Building $(<F) register info implementation with tblgen"
859 $(Verb) $(TableGen) -gen-register-desc -o $@ $<
861 %GenInstrNames.inc : %.td
862 $(Echo) "Building $(<F) instruction names with tblgen"
863 $(Verb) $(TableGen) -gen-instr-enums -o $@ $<
865 %GenInstrInfo.inc : %.td
866 $(Echo) "Building $(<F) instruction information with tblgen"
867 $(Verb) $(TableGen) -gen-instr-desc -o $@ $<
869 %GenAsmWriter.inc : %.td
870 $(Echo) "Building $(<F) assembly writer with tblgen"
871 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
873 %GenATTAsmWriter.inc : %.td
874 $(Echo) "Building $(<F) AT&T assembly writer with tblgen"
875 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
877 %GenIntelAsmWriter.inc : %.td
878 $(Echo) "Building $(<F) Intel assembly writer with tblgen"
879 $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
881 %GenInstrSelector.inc: %.td
882 $(Echo) "Building $(<F) instruction selector with tblgen"
883 $(Verb) $(TableGen) -gen-instr-selector -o $@ $<
885 %GenCodeEmitter.inc:: %.td
886 $(Echo) "Building $(<F) code emitter with tblgen"
887 $(Verb) $(TableGen) -gen-emitter -o $@ $<
890 -$(Verb) $(RM) -f $(INCFiles)
894 ###############################################################################
895 # LEX AND YACC: Provide rules for generating sources with lex and yacc
896 ###############################################################################
898 #---------------------------------------------------------
899 # Provide rules for generating a .cpp source file from
900 # (f)lex input sources.
901 #---------------------------------------------------------
903 LexFiles := $(filter %.l,$(Sources))
907 LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
909 .PRECIOUS: $(LexOutput)
911 # Note the extra sed filtering here, used to cut down on the warnings emited
912 # by GCC. The last line is a gross hack to work around flex aparently not
913 # being able to resize the buffer on a large token input. Currently, for
914 # uninitialized string buffers in LLVM we can generate very long tokens, so
915 # this is a hack around it.
916 # FIXME. (f.e. char Buffer[10000] )
919 $(Verb) $(FLEX) -t $< | \
920 $(SED) 's/void yyunput/inline void yyunput/' | \
921 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
922 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
926 -$(Verb) $(RM) -f $(LexOutput)
927 $(Verb) $(RM) -f $(LexOutput)
931 #---------------------------------------------------------
932 # Provide rules for generating a .cpp and .h source files
933 # from yacc (bison) input sources.
934 #---------------------------------------------------------
936 YaccFiles := $(filter %.y,$(Sources))
937 ifneq ($(YaccFiles),)
938 YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
940 .PRECIOUS: $(YaccOutput)
942 # Cancel built-in rules for yacc
947 # Rule for building the bison parsers...
949 $(Echo) "Bisoning $*.y"
950 $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
951 $(Verb) $(MV) -f $*.tab.c $*.cpp
952 $(Verb) $(MV) -f $*.tab.h $*.h
955 -$(Verb) $(RM) -f $(YaccOutput)
956 $(Verb) $(RM) -f $(YaccOutput)
959 ###############################################################################
960 # OTHER RULES: Other rules needed
961 ###############################################################################
963 # To create postscript files from dot files...
966 $(DOT) -Tps < $< > $@
969 $(Echo) "Cannot build $@: The program dot is not installed"
972 # This rules ensures that header files that are removed still have a rule for
973 # which they can be "generated." This allows make to ignore them and
974 # reproduce the dependency lists.
977 # Define clean-local to clean the current directory. Note that this uses a
978 # very conservative approach ensuring that empty variables do not cause
979 # errors or disastrous removal.
981 ifneq ($(strip $(ObjDir)),)
982 -$(Verb) $(RM) -rf $(ObjDir)
984 -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
985 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
986 -$(Verb) $(RM) -f *$(SHLIBEXT)
990 -$(Verb) $(RM) -rf Debug Release Profile
992 # Build tags database for Emacs/Xemacs:
996 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
997 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
998 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
999 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1000 -name '*.cpp' -o -name '*.h' | \
1001 $(ETAGS) $(ETAGSFLAGS) -
1004 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
1005 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
1006 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1007 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1008 \( -name '*.cpp' -o -name '*.h' \) -print | \
1009 ctags -ImtT -o $(BUILD_OBJ_ROOT)/CTAGS -L -
1012 ###############################################################################
1013 # DEPENDENCIES: Include the dependency files if we should
1014 ###############################################################################
1015 ifndef DISABLE_AUTO_DEPENDENCIES
1017 # If its not one of the cleaning targets
1018 ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
1020 # Get the list of dependency files
1021 DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
1022 DependFiles := $(patsubst %,$(BUILD_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
1024 -include /dev/null $(DependFiles)
1030 ###############################################################################
1031 # DISTRIBUTION: Handle construction of a distribution tarball
1032 ###############################################################################
1034 #------------------------------------------------------------------------
1035 # Define distribution related variables
1036 #------------------------------------------------------------------------
1037 DistName := $(LLVM_TARBALL_NAME)
1038 DistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1039 TopDistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1040 DistTarGZip := $(BUILD_OBJ_ROOT)/$(DistName).tar.gz
1041 DistZip := $(BUILD_OBJ_ROOT)/$(DistName).zip
1042 DistTarBZ2 := $(BUILD_OBJ_ROOT)/$(DistName).tar.bz2
1043 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1044 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1045 Makefile.config.in configure autoconf
1046 DistOther := $(notdir $(wildcard \
1047 $(BUILD_SRC_DIR)/*.h \
1048 $(BUILD_SRC_DIR)/*.td \
1049 $(BUILD_SRC_DIR)/*.def \
1050 $(BUILD_SRC_DIR)/*.ll \
1051 $(BUILD_SRC_DIR)/*.in))
1052 DistSubDirs := $(SubDirs)
1053 DistSources = $(Sources) $(EXTRA_DIST)
1054 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
1056 #------------------------------------------------------------------------
1057 # We MUST build distribution with OBJ_DIR != SRC_DIR
1058 #------------------------------------------------------------------------
1059 ifeq ($(BUILD_SRC_DIR),$(BUILD_OBJ_DIR))
1060 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1061 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1066 DistCheckTop := check
1068 #------------------------------------------------------------------------
1069 # Prevent catastrophic remove
1070 #------------------------------------------------------------------------
1071 ifeq ($(LLVM_TARBALL_NAME),)
1072 $(error LLVM_TARBALL_NAME is empty. Please rerun configure)
1075 #------------------------------------------------------------------------
1076 # Prevent attempt to run dist targets from anywhere but the top level
1077 #------------------------------------------------------------------------
1080 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1081 $(Echo) ERROR: You must run $@ from $(BUILD_OBJ_ROOT)
1085 #------------------------------------------------------------------------
1086 # Provide the top level targets
1087 #------------------------------------------------------------------------
1089 dist-gzip:: $(DistTarGZip)
1091 $(DistTarGZip) : distdir
1092 $(Echo) Packing gzipped distribution tar file.
1093 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1094 $(GZIP) -c > "$(DistTarGZip)"
1096 dist-bzip2:: $(DistTarBZ2)
1098 $(DistTarBZ2) : distdir
1099 $(Echo) Packing bzipped distribution tar file.
1100 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1101 $(BZIP2) -c >$(DistTarBZ2)
1103 dist-zip:: $(DistZip)
1105 $(DistZip) : distdir
1106 $(Echo) Packing zipped distribution file.
1107 $(Verb) rm -f $(DistZip)
1108 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1110 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
1111 $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
1113 DistCheckDir := $(LLVM_OBJ_ROOT)/_distcheckdir
1115 dist-check:: $(DistCheckTop) $(DistTarGZip)
1116 $(Echo) Checking distribution tar file.
1117 $(Verb) if test -d $(DistCheckDir) ; then \
1118 $(RM) -rf $(DistCheckDir) ; \
1120 $(Verb) $(MKDIR) $(DistCheckDir)
1121 $(Verb) cd $(DistCheckDir) && \
1122 $(MKDIR) $(DistCheckDir)/build && \
1123 $(MKDIR) $(DistCheckDir)/install && \
1124 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1126 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1127 --srcdir=../$(DistName) --with-llvmgccdir="$(LLVMGCCDIR)" && \
1129 $(MAKE) install && \
1130 $(MAKE) uninstall && \
1133 $(MAKE) dist-clean && \
1134 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1137 $(Echo) Cleaning distribution files
1138 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) $(DistCheckDir)
1142 #------------------------------------------------------------------------
1143 # Provide the recursive distdir target for building the distribution directory
1144 #------------------------------------------------------------------------
1145 distdir : $(DistSources)
1146 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1147 if test -d "$(DistDir)" ; then \
1148 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
1151 $(EchoCmd) Removing $(DistDir) ; \
1152 $(RM) -rf $(DistDir); \
1154 $(Echo) Building Distribution Directory $(DistDir)
1155 $(Verb) $(MKDIR) $(DistDir)
1156 $(Verb) srcdirstrip=`echo "$(BUILD_SRC_DIR)" | sed 's|.|.|g'`; \
1157 srcrootstrip=`echo "$(BUILD_SRC_ROOT)" | sed 's|.|.|g'`; \
1158 for file in $(DistFiles) ; do \
1160 $(BUILD_SRC_DIR)/*) file=`echo "$$file" | sed "s#^$$srcdirstrip/##"`;; \
1161 $(BUILD_SRC_ROOT)/*) file=`echo "$$file" | sed "s#^$$srcrootstrip/#$(BUILD_OBJ_ROOT)/#"`;; \
1163 if test -f "$$file" || test -d "$$file" ; then \
1166 from_dir=$(BUILD_SRC_DIR); \
1168 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'`; \
1169 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1170 to_dir="$(DistDir)/$$dir"; \
1171 $(MKDIR) "$$to_dir" ; \
1173 to_dir="$(DistDir)"; \
1175 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1176 if test -n "$$mid_dir" ; then \
1177 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1179 if test -d "$$from_dir/$$file"; then \
1180 if test -d "$(BUILD_SRC_DIR)/$$file" && \
1181 test "$$from_dir" != "$(BUILD_SRC_DIR)" ; then \
1182 cp -pR "$(BUILD_SRC_DIR)/$$file" "$$to_dir" || exit 1; \
1184 cp -pR $$from_dir/$$file $$to_dir || exit 1; \
1185 elif test -f "$$from_dir/$$file" ; then \
1186 cp -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1187 elif test -L "$$from_dir/$$file" ; then \
1188 cp -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
1189 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1190 $(EchoCmd) "===== WARNING: Distribution Source $$from_dir/$$file Not Found!" ; \
1191 elif test "$(Verb)" != '@' ; then \
1192 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
1195 $(Verb) for subdir in $(DistSubDirs) ; do \
1196 if test "$$subdir" \!= "." ; then \
1197 new_distdir="$(DistDir)/$$subdir" ; \
1198 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
1199 ( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || exit 1; \
1202 $(Verb) $(MAKE) DistDir="$(DistDir)" dist-hook || exit 1
1203 -$(Verb) find $(DistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
1204 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
1205 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
1206 ! -type d ! -perm -444 -exec $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1207 || chmod -R a+r $(DistDir)
1209 # This is invoked by distdir target, define it as a no-op to avoid errors if not
1215 ###############################################################################
1216 # TOP LEVEL - targets only to apply at the top level directory
1217 ###############################################################################
1221 #------------------------------------------------------------------------
1222 # Install support for project's include files:
1223 #------------------------------------------------------------------------
1225 $(Echo) Installing include files
1226 $(Verb) $(MKDIR) $(includedir)
1227 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1228 cd $(BUILD_SRC_ROOT)/include && \
1229 find . -path '*/Internal' -prune -o '(' -type f \
1230 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1231 -print ')' | grep -v CVS | pax -rwdvpe $(includedir) ; \
1235 $(Echo) Uninstalling include files
1236 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1237 cd $(BUILD_SRC_ROOT)/include && \
1238 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
1239 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1240 -print ')' | grep -v CVS | sed 's#^#$(includedir)/#'` ; \
1245 #------------------------------------------------------------------------
1246 # Print out the directories used for building
1247 #------------------------------------------------------------------------
1249 $(Echo) "BuildMode : " '$(BuildMode)'
1250 $(Echo) "BUILD_SRC_ROOT : " '$(BUILD_SRC_ROOT)'
1251 $(Echo) "BUILD_SRC_DIR : " '$(BUILD_SRC_DIR)'
1252 $(Echo) "BUILD_OBJ_ROOT : " '$(BUILD_OBJ_ROOT)'
1253 $(Echo) "BUILD_OBJ_DIR : " '$(BUILD_OBJ_DIR)'
1254 $(Echo) "LLVM_SRC_ROOT : " '$(LLVM_SRC_ROOT)'
1255 $(Echo) "LLVM_OBJ_ROOT : " '$(LLVM_OBJ_ROOT)'
1256 $(Echo) "libdir : " '$(libdir)'
1257 $(Echo) "bindir : " '$(bindir)'
1258 $(Echo) "sysconfdir : " '$(sysconfdir)'
1259 $(Echo) "bytecode_libdir: " '$(bytecode_libdir)'
1260 $(Echo) "UserTargets : " '$(UserTargets)'
1261 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1262 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1263 $(Echo) "ObjDir : " '$(ObjDir)'
1264 $(Echo) "LibDir : " '$(LibDir)'
1265 $(Echo) "ToolDir : " '$(ToolDir)'
1266 $(Echo) "ExmplDir : " '$(ExmplDir)'
1267 $(Echo) "TDFiles : " '$(TDFiles)'
1268 $(Echo) "INCFiles : " '$(INCFiles)'
1269 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
1270 $(Echo) "Compile.C : " '$(Compile.C)'
1271 $(Echo) "Archive : " '$(Archive)'
1272 $(Echo) "YaccFiles : " '$(YaccFiles)'
1273 $(Echo) "LexFiles : " '$(LexFiles)'