1 #===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===#
3 # The LLVM Compiler Infrastructure
5 # This file was developed by the LLVM research group and is distributed under
6 # the University of Illinois Open Source License. See LICENSE.TXT for details.
8 #===------------------------------------------------------------------------===#
10 # This file is included by all of the LLVM makefiles. For details on how to use
11 # it properly, please see the document MakefileGuide.html in the docs directory.
13 #===-----------------------------------------------------------------------====
15 ################################################################################
16 # TARGETS: Define standard targets that can be invoked
17 ################################################################################
19 #--------------------------------------------------------------------
20 # Define the various target sets
21 #--------------------------------------------------------------------
22 RecursiveTargets := all clean clean-all check install uninstall
23 LocalTargets := all-local clean-local clean-all-local check-local \
24 install-local printvars uninstall-local
25 TopLevelTargets := dist dist-check dist-clean tags dist-gzip dist-bzip2 \
27 UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
28 InternalTargets := preconditions distdir dist-hook
30 ################################################################################
31 # INITIALIZATION: Basic things the makefile needs
32 ################################################################################
34 #--------------------------------------------------------------------
35 # Set the VPATH so that we can find source files.
36 #--------------------------------------------------------------------
37 VPATH=$(BUILD_SRC_DIR)
39 #--------------------------------------------------------------------
40 # Reset the list of suffixes we know how to build
41 #--------------------------------------------------------------------
43 .SUFFIXES: .c .cpp .h .hpp .y .l .lo .o .a .bc .td .ps .dot
44 .SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
46 #--------------------------------------------------------------------
47 # Mark all of these targets as phony to avoid implicit rule search
48 #--------------------------------------------------------------------
49 .PHONY: $(UserTargets) $(InternalTargets)
51 #--------------------------------------------------------------------
52 # Make sure all the user-target rules are double colon rules and
53 # they are defined first.
54 #--------------------------------------------------------------------
58 ################################################################################
59 # PRECONDITIONS: that which must be built/checked first
60 ################################################################################
62 SrcMakefiles := $(filter %Makefile %Makefile.tests %Makefile.JIT,\
63 $(wildcard $(BUILD_SRC_DIR)/Makefile*))
64 ObjMakefiles := $(subst $(BUILD_SRC_DIR),$(BUILD_OBJ_DIR),$(SrcMakefiles))
65 ConfigureScript := $(LLVM_SRC_ROOT)/configure
66 ConfigStatusScript := $(LLVM_OBJ_ROOT)/config.status
67 MakefileConfigIn := $(LLVM_SRC_ROOT)/Makefile.config.in
68 MakefileConfig := $(LLVM_OBJ_ROOT)/Makefile.config
69 PreConditions := $(ConfigStatusScript) $(MakefileConfig) $(ObjMakefiles)
71 preconditions : $(PreConditions)
73 #------------------------------------------------------------------------
74 # Make sure the BUILT_SOURCES are built first
75 #------------------------------------------------------------------------
76 $(filter-out clean clean-local,UserTargets):: $(BUILT_SOURCES)
79 ifneq ($(strip $(BUILT_SOURCES)),)
80 -$(Verb) $(RM) -f $(BUILT_SOURCES)
83 $(BUILT_SOURCES) : $(ObjMakefiles)
85 #------------------------------------------------------------------------
86 # Make sure we're not using a stale configuration
87 #------------------------------------------------------------------------
88 .PRECIOUS: $(ConfigStatusScript)
89 $(ConfigStatusScript): $(ConfigureScript)
90 $(Echo) Reconfiguring with $<
91 $(Verb) cd $(BUILD_OBJ_ROOT) && \
92 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
95 #------------------------------------------------------------------------
96 # Make sure the configuration makefile is up to date
97 #------------------------------------------------------------------------
98 $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
99 $(Echo) Regenerating $@
100 $(Verb) cd $(LLVM_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
102 #------------------------------------------------------------------------
103 # If the Makefile in the source tree has been updated, copy it over into the
104 # build tree. But, only do this if the source and object makefiles differ
105 #------------------------------------------------------------------------
106 ifneq ($(BUILD_OBJ_DIR),$(BUILD_SRC_DIR))
108 Makefile: $(BUILD_SRC_DIR)/Makefile
109 $(Echo) "Updating Makefile"
110 $(Verb) $(MKDIR) $(@D)
113 # Copy the Makefile.* files unless we're in the root directory which avoids
114 # the copying of Makefile.config.in or other things that should be explicitly
116 $(BUILD_OBJ_DIR)/Makefile% : $(BUILD_SRC_DIR)/Makefile%
118 *Makefile.rules) ;; \
120 *) $(Echo) "Updating $(@F)" ; \
127 #------------------------------------------------------------------------
128 # Set up the basic dependencies
129 #------------------------------------------------------------------------
130 $(UserTargets):: $(PreConditions)
135 clean-all:: clean-local clean-all-local
136 install:: install-local
137 uninstall:: uninstall-local
138 check-local:: all-local
139 install-local:: all-local
141 ###############################################################################
142 # VARIABLES: Set up various variables based on configuration data
143 ###############################################################################
145 #--------------------------------------------------------------------
146 # Variables derived from configuration we are building
147 #--------------------------------------------------------------------
149 ifdef ENABLE_PROFILING
151 CXX.Flags := -O3 -DNDEBUG -felide-constructors -finline-functions -pg
152 C.Flags := -O3 -DNDEBUG -pg
153 LD.Flags := -O3 -DNDEBUG -pg
155 ifdef ENABLE_OPTIMIZED
157 CXX.Flags := -O3 -DNDEBUG -finline-functions -felide-constructors -fomit-frame-pointer
158 C.Flags := -O3 -DNDEBUG -fomit-frame-pointer
159 LD.Flags := -O3 -DNDEBUG
162 CXX.Flags := -g -D_DEBUG
163 C.Flags := -g -D_DEBUG
164 LD.Flags := -g -D_DEBUG
169 CXX.Flags += $(CXXFLAGS)
171 CPP.Flags += $(CPPFLAGS)
172 LD.Flags += $(LDFLAGS)
174 LibTool.Flags := --tag=CXX
176 #--------------------------------------------------------------------
177 # Directory locations
178 #--------------------------------------------------------------------
179 ObjDir := $(BUILD_OBJ_DIR)/$(BuildMode)
180 LibDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/lib
181 ToolDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/bin
182 ExmplDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/examples
183 LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
184 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
185 LExmplDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
187 #--------------------------------------------------------------------
188 # Full Paths To Compiled Tools and Utilities
189 #--------------------------------------------------------------------
190 EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
193 LIBTOOL := $(LLVM_OBJ_ROOT)/mklib
196 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
199 BURG := $(LLVMToolDir)/burg$(EXEEXT)
202 TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT)
205 GCCLD := $(LLVMToolDir)/gccld$(EXEEXT)
208 LLVMGCC := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/gcc
211 LLVMGXX := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/g++
214 # Need a better way to compute this.
215 LLVMGCCLibDir := $(dir $(shell $(LLVMGCC) -print-file-name=libgcc.a))/
217 #--------------------------------------------------------------------
218 # Adjust to user's request
219 #--------------------------------------------------------------------
221 # Adjust LIBTOOL flags for shared libraries, or not.
222 ifndef SHARED_LIBRARY
223 LibTool.Flags += --tag=disable-shared
225 LD.Flags += -rpath $(LibDir)
232 BCLinkLib.Flags += -v
236 # Adjust settings for verbose mode
239 LibTool.Flags += --silent
240 AR.Flags += >/dev/null 2>/dev/null
241 ConfigureScriptFLAGS += >$(BUILD_OBJ_DIR)/configure.out 2>&1
243 ConfigureScriptFLAGS :=
246 # By default, strip symbol information from executable
248 Strip := $(PLATFORMSTRIPOPTS)
249 StripWarnMsg := "(without symbols)"
252 # Adjust linker flags for building an executable
255 LD.Flags += -rpath $(ExmplDir) -export-dynamic
257 LD.Flags += -rpath $(ToolDir) -export-dynamic
261 #----------------------------------------------------------
262 # Options To Invoke Tools
263 #----------------------------------------------------------
265 CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
267 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
268 CPP.Flags += -I$(BUILD_OBJ_DIR) \
270 -I$(BUILD_SRC_ROOT)/include \
271 -I$(BUILD_OBJ_ROOT)/include \
272 -I$(LLVM_OBJ_ROOT)/include \
273 -I$(LLVM_SRC_ROOT)/include \
274 -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
276 Compile.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags)
277 LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
278 BCCompile.C = $(LLVMGCC) $(CPP.Flags) $(CompileCommonOpts) $(C.Flags) -c
279 Compile.CXX = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
280 LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
281 BCCompile.CXX = $(LLVMGXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
282 Link = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
283 $(CompileCommonOpts) $(LD.Flags) $(Strip)
284 Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
286 BCLinkLib = $(LLVMGCC) -shared -nostdlib $(BCLinkLib.Flags)
287 LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL)
288 Burg = $(BURG) -I $(BUILD_SRC_DIR)
289 TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR)
290 Archive = $(AR) $(AR.Flags)
291 LArchive = $(ToolDir)/llvm-ar rcsf
298 #----------------------------------------------------------
299 # Get the list of source files
300 #----------------------------------------------------------
302 Sources := $(notdir $(wildcard $(BUILD_SRC_DIR)/*.cpp \
303 $(BUILD_SRC_DIR)/*.cc $(BUILD_SRC_DIR)/*.c $(BUILD_SRC_DIR)/*.y \
304 $(BUILD_SRC_DIR)/*.l))
306 Sources := $(SOURCES)
310 Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
313 #----------------------------------------------------------
314 # Types of objects that can be built from sources
315 #----------------------------------------------------------
316 BaseNameSources := $(sort $(basename $(Sources)))
317 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
318 ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
319 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
321 ###############################################################################
322 # DIRECTORIES: Handle recursive descent of directory structure
323 ###############################################################################
325 #---------------------------------------------------------
326 # Provide rules to make install dirs. This must be early
327 # in the file so they get built before dependencies
328 #---------------------------------------------------------
331 $(Verb) $(MKDIR) $(bindir)
334 $(Verb) $(MKDIR) $(libdir)
337 $(Verb) $(MKDIR) $(bytecode_libdir)
340 $(Verb) $(MKDIR) $(sysconfdir)
342 # To create other directories, as needed, and timestamp their creation
344 $(Verb) $(MKDIR) $* > /dev/null
347 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
348 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
350 #---------------------------------------------------------
351 # Handle the DIRS options for sequential construction
352 #---------------------------------------------------------
357 $(RecursiveTargets)::
358 $(Verb) for dir in $(DIRS); do \
359 if [ ! -f $$dir/Makefile ]; then \
361 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
363 ($(MAKE) -C $$dir $@ ) || exit 1; \
367 #---------------------------------------------------------
368 # Handle the EXPERIMENTAL_DIRS options ensuring success
369 # after each directory is built.
370 #---------------------------------------------------------
371 ifdef EXPERIMENTAL_DIRS
372 $(RecursiveTargets)::
373 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
374 if [ ! -f $$dir/Makefile ]; then \
376 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
378 ($(MAKE) -C $$dir $@ ) || exit 0; \
382 #---------------------------------------------------------
383 # Handle the PARALLEL_DIRS options for parallel construction
384 #---------------------------------------------------------
387 SubDirs += $(PARALLEL_DIRS)
389 # Unfortunately, this list must be maintained if new
390 # recursive targets are added.
391 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
392 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
393 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
394 check :: $(addsuffix /.makecheck ,$(PARALLEL_DIRS))
395 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
396 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
398 Parallel_Targets := $(foreach T,$(RecursiveTargets),%/.make$(T))
400 $(Parallel_Targets) :
401 $(Verb) if [ ! -f $(@D)/Makefile ]; then \
403 cp $(BUILD_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
405 $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
408 #---------------------------------------------------------
409 # Handle the OPTIONAL_DIRS options for directores that may
411 #---------------------------------------------------------
414 SubDirs += $(OPTIONAL_DIRS)
416 $(RecursiveTargets)::
417 $(Verb) for dir in $(OPTIONAL_DIRS); do \
418 if [ -d $(BUILD_SRC_DIR)/$$dir ]; then\
419 if [ ! -f $$dir/Makefile ]; then \
421 cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
423 ($(MAKE) -C$$dir $@ ) || exit 1; \
428 #---------------------------------------------------------
429 # Handle the CONFIG_FILES options
430 #---------------------------------------------------------
433 install-local:: $(sysconfdir) $(CONFIG_FILES)
434 $(Echo) Installing Configuration Files To $(sysconfdir)
435 $(Verb)for file in $(CONFIG_FILES); do \
436 if test -f $(BUILD_OBJ_DIR)/$${file} ; then \
437 $(INSTALL) $(BUILD_OBJ_DIR)/$${file} $(sysconfdir) ; \
438 elif test -f $(BUILD_SRC_DIR)/$${file} ; then \
439 $(INSTALL) $(BUILD_SRC_DIR)/$${file} $(sysconfdir) ; \
441 $(ECHO) Error: cannot find config file $${file}. ; \
446 $(Echo) Uninstalling Configuration Files From $(sysconfdir)
447 $(Verb)for file in $(CONFIG_FILES); do \
448 $(RM) -f $(sysconfdir)/$${file} ; \
453 ###############################################################################
454 # Library Build Rules: Four ways to build a library
455 ###############################################################################
458 # if we're building a library ...
461 # Make sure there isn't any extranous whitespace on the LIBRARYNAME option
462 LIBRARYNAME := $(strip $(LIBRARYNAME))
463 LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
464 LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
465 LibName.O := $(LibDir)/$(LIBRARYNAME).o
466 LibName.BC := $(LibDir)/lib$(LIBRARYNAME).bc
468 #---------------------------------------------------------
469 # Shared Library Targets:
470 # If the user asked for a shared library to be built
471 # with the SHARED_LIBRARY variable, then we provide
472 # targets for building them.
473 #---------------------------------------------------------
476 all-local:: $(LibName.LA)
478 $(LibName.LA): $(BUILT_SOURCES) $(ObjectsLO) $(LibDir)/.dir
479 $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
480 $(Verb) $(Link) -o $@ $(ObjectsLO)
481 $(Verb) $(LTInstall) $@ $(LibDir)
484 ifneq ($(strip $(LibName.LA)),)
485 -$(Verb) $(RM) -f $(LibName.LA)
488 DestSharedLib = $(libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
490 install-local:: $(DestSharedLib)
492 $(DestSharedLib): $(libdir) $(LibName.LA)
493 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
494 $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
495 $(Verb) $(LIBTOOL) --finish $(libdir)
498 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
499 -$(Verb) $(RM) -f $(libdir)/lib$(LIBRARYNAME).*
503 #---------------------------------------------------------
504 # Bytecode Library Targets:
505 # If the user asked for a bytecode library to be built
506 # with the BYTECODE_LIBRARY variable, then we provide
507 # targets for building them.
508 #---------------------------------------------------------
509 ifdef BYTECODE_LIBRARY
511 ifdef EXPORTED_SYMBOL_LIST
512 BCLinkLib += -Xlinker -internalize-public-api-list=$(EXPORTED_SYMBOL_LIST)
514 ifdef EXPORTED_SYMBOL_FILE
515 BCLinkLib += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
517 BCLinkLib += -Xlinker -disable-internalize
521 all-local:: $(LibName.BC)
523 $(LibName.BC): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir
524 $(Echo) Linking $(BuildMode) Bytecode Library $(notdir $@)
525 $(Verb) $(BCLinkLib) -o $@ $(ObjectsBC)
528 ifneq ($(strip $(LibName.BC)),)
529 -$(Verb) $(RM) -f $(LibName.BC)
532 DestBytecodeLib = $(bytecode_libdir)/lib$(LIBRARYNAME).bc
534 install-local:: $(DestBytecodeLib)
536 $(DestBytecodeLib): $(bytecode_libdir) $(LibName.BC)
537 $(Echo) Installing $(BuildMode) Bytecode Library $(DestBytecodeLib)
538 $(Verb) $(INSTALL) $(LibName.BC) $@
541 $(Echo) Uninstalling $(BuildMode) Bytecode Library $(DestBytecodeLib)
542 -$(Verb) $(RM) -f $(DestBytecodeLib)
546 #---------------------------------------------------------
547 # ReLinked Library Targets:
548 # If the user didn't explicitly forbid building a
549 # relinked then we provide targets for building them.
550 #---------------------------------------------------------
551 ifndef DONT_BUILD_RELINKED
553 all-local:: $(LibName.O)
555 $(LibName.O): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
556 $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
557 $(Verb) $(Relink) -o $@ $(ObjectsO)
560 ifneq ($(strip $(LibName.O)),)
561 -$(Verb) $(RM) -f $(LibName.O)
564 DestRelinkedLib = $(libdir)/$(LIBRARYNAME).o
566 install-local:: $(DestRelinkedLib)
568 $(DestRelinkedLib): $(libdir) $(LibName.O)
569 $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
570 $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
573 $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
574 -$(Verb) $(RM) -f $(DestRelinkedLib)
578 #---------------------------------------------------------
579 # Archive Library Targets:
580 # If the user wanted a regular archive library built,
581 # then we provide targets for building them.
582 #---------------------------------------------------------
585 all-local:: $(LibName.A)
587 $(LibName.A): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
588 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
590 $(Verb) $(Archive) $@ $(ObjectsO)
594 ifneq ($(strip $(LibName.A)),)
595 -$(Verb) $(RM) -f $(LibName.A)
598 DestArchiveLib := $(libdir)/lib$(LIBRARYNAME).a
600 install-local:: $(DestArchiveLib)
602 $(DestArchiveLib): $(libdir) $(LibName.A)
603 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
604 $(Verb) $(MKDIR) $(libdir)
605 $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
608 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
609 -$(Verb) $(RM) -f $(DestArchiveLib)
616 ###############################################################################
617 # Tool Build Rules: Build executable tool based on TOOLNAME option
618 ###############################################################################
622 #---------------------------------------------------------
623 # Handle the special "JIT" value for LLVM_LIBS which is a
624 # shorthand for a bunch of libraries that get the correct
625 # JIT support for a tool that runs JIT.
626 #---------------------------------------------------------
627 ifeq ($(LLVMLIBS),JIT)
629 # Make sure we can get our own symbols in the tool
632 # Generic JIT libraries
633 JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
635 # You can enable the X86 JIT on a non-X86 host by setting the flag
636 # ENABLE_X86_JIT on the make command line. If not, it will still be
637 # enabled automagically on an X86 host.
642 # What the X86 JIT requires
644 JIT_LIBS += LLVMX86 LLVMSelectionDAG
647 # You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
648 # ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
649 # enabled automagically on an SparcV9 host.
650 ifeq ($(ARCH), Sparc)
651 ENABLE_SPARCV9_JIT = 1
654 # What the Sparc JIT requires
655 ifdef ENABLE_SPARCV9_JIT
656 JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
657 LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \
658 LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
659 LLVMDataStructure.a LLVMSparcV9RegAlloc
662 # You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
663 # ENABLE_PPC_JIT on the make command line. If not, it will still be
664 # enabled automagically on an PowerPC host.
665 ifeq ($(ARCH), PowerPC)
669 # What the PowerPC JIT requires
671 JIT_LIBS += LLVMPowerPC
674 LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \
675 LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
676 LLVMSystem.a $(PLATFORMLIBDL)
679 #---------------------------------------------------------
680 # Set up variables for building a tool.
681 #---------------------------------------------------------
683 ToolBuildPath := $(ExmplDir)/$(TOOLNAME)$(EXEEXT)
685 ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
687 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
688 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
689 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
690 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
691 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
692 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
693 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
694 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
696 #---------------------------------------------------------
697 # Tell make that we need to rebuild subdirectories before
698 # we can link the tool. This affects things like LLI which
699 # has library subdirectories.
700 #---------------------------------------------------------
701 $(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
703 #---------------------------------------------------------
704 # Provide targets for building the tools
705 #---------------------------------------------------------
706 all-local:: $(ToolBuildPath)
709 ifneq ($(strip $(ToolBuildPath)),)
710 -$(Verb) $(RM) -f $(ToolBuildPath)
714 $(ToolBuildPath): $(ExmplDir)/.dir
716 $(ToolBuildPath): $(ToolDir)/.dir
719 $(ToolBuildPath): $(BUILT_SOURCES) $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
720 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
721 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
722 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB)
723 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg)
725 DestTool = $(bindir)/$(TOOLNAME)
727 install-local:: $(DestTool)
729 $(DestTool): $(bindir) $(ToolBuildPath)
730 $(Echo) Installing $(BuildMode) $(DestTool)
731 $(Verb) $(INSTALL) $(ToolBuildPath) $(DestTool)
734 $(Echo) Uninstalling $(BuildMode) $(DestTool)
735 -$(Verb) $(RM) -f $(DestTool)
739 ###############################################################################
740 # Object Build Rules: Build object files based on sources
741 ###############################################################################
743 # Provide rule sets for when dependency generation is enabled
744 ifndef DISABLE_AUTO_DEPENDENCIES
746 #---------------------------------------------------------
747 # Create .lo files in the ObjDir directory from the .cpp and .c files...
748 #---------------------------------------------------------
751 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
752 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
753 $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
754 then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
755 else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
757 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
758 $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
759 $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
760 then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
761 else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
763 #---------------------------------------------------------
764 # Create .o files in the ObjDir directory from the .cpp and .c files...
765 #---------------------------------------------------------
768 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
769 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
770 $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
771 then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
772 else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
774 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
775 $(Echo) "Compiling $*.c for $(BuildMode) build"
776 $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
777 then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
778 else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
782 #---------------------------------------------------------
783 # Create .bc files in the ObjDir directory from .cpp and .c files...
784 #---------------------------------------------------------
785 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir
786 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
787 $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
788 then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
789 else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
791 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir
792 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
793 $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
794 then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
795 else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
797 # Provide alternate rule sets if dependencies are disabled
802 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
803 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
804 $(LTCompile.CXX) $< -o $@
806 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
807 $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
808 $(LTCompile.C) $< -o $@
812 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
813 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
814 $(Compile.CXX) $< -o $@
816 $(ObjDir)/%.o: %.c $(ObjDir)/.dir
817 $(Echo) "Compiling $*.cpp for $(BuildMode) build"
818 $(Compile.C) $< -o $@
821 $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir
822 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
823 $(BCCompile.CXX) $< -o $@
825 $(ObjDir)/%.bc: %.c $(ObjDir)/.dir
826 $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
827 $(BCCompile.C) $< -o $@
831 #---------------------------------------------------------
832 # Provide rule to build .bc files from .ll sources,
833 # regardless of dependencies
834 #---------------------------------------------------------
835 $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
836 $(Echo) "Compiling $*.ll for $(BuildMode) build"
837 $(Verb) $(LLVMAS) $< -f -o $@
839 ###############################################################################
840 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
841 ###############################################################################
845 TDFiles := $(strip $(wildcard $(BUILD_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
846 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
848 $(INCFiles) : $(TBLGEN) $(TDFiles)
850 %GenRegisterNames.inc : %.td
851 $(Echo) "Building $(<F) register names with tblgen"
852 $(Verb) $(TableGen) -gen-register-enums -o $@ $<
854 %GenRegisterInfo.h.inc : %.td
855 $(Echo) "Building $(<F) register information header with tblgen"
856 $(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
858 %GenRegisterInfo.inc : %.td
859 $(Echo) "Building $(<F) register info implementation with tblgen"
860 $(Verb) $(TableGen) -gen-register-desc -o $@ $<
862 %GenInstrNames.inc : %.td
863 $(Echo) "Building $(<F) instruction names with tblgen"
864 $(Verb) $(TableGen) -gen-instr-enums -o $@ $<
866 %GenInstrInfo.inc : %.td
867 $(Echo) "Building $(<F) instruction information with tblgen"
868 $(Verb) $(TableGen) -gen-instr-desc -o $@ $<
870 %GenAsmWriter.inc : %.td
871 $(Echo) "Building $(<F) assembly writer with tblgen"
872 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
874 %GenATTAsmWriter.inc : %.td
875 $(Echo) "Building $(<F) AT&T assembly writer with tblgen"
876 $(Verb) $(TableGen) -gen-asm-writer -o $@ $<
878 %GenIntelAsmWriter.inc : %.td
879 $(Echo) "Building $(<F) Intel assembly writer with tblgen"
880 $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
882 %GenInstrSelector.inc: %.td
883 $(Echo) "Building $(<F) instruction selector with tblgen"
884 $(Verb) $(TableGen) -gen-instr-selector -o $@ $<
886 %GenCodeEmitter.inc:: %.td
887 $(Echo) "Building $(<F) code emitter with tblgen"
888 $(Verb) $(TableGen) -gen-emitter -o $@ $<
891 -$(Verb) $(RM) -f $(INCFiles)
895 ###############################################################################
896 # LEX AND YACC: Provide rules for generating sources with lex and yacc
897 ###############################################################################
899 #---------------------------------------------------------
900 # Provide rules for generating a .cpp source file from
901 # (f)lex input sources.
902 #---------------------------------------------------------
904 LexFiles := $(filter %.l,$(Sources))
908 LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
910 .PRECIOUS: $(LexOutput)
912 # Note the extra sed filtering here, used to cut down on the warnings emited
913 # by GCC. The last line is a gross hack to work around flex aparently not
914 # being able to resize the buffer on a large token input. Currently, for
915 # uninitialized string buffers in LLVM we can generate very long tokens, so
916 # this is a hack around it.
917 # FIXME. (f.e. char Buffer[10000] )
920 $(Verb) $(FLEX) -t $< | \
921 $(SED) 's/void yyunput/inline void yyunput/' | \
922 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
923 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
927 -$(Verb) $(RM) -f $(LexOutput)
928 $(Verb) $(RM) -f $(LexOutput)
932 #---------------------------------------------------------
933 # Provide rules for generating a .cpp and .h source files
934 # from yacc (bison) input sources.
935 #---------------------------------------------------------
937 YaccFiles := $(filter %.y,$(Sources))
938 ifneq ($(YaccFiles),)
939 YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
941 .PRECIOUS: $(YaccOutput)
943 # Cancel built-in rules for yacc
948 # Rule for building the bison parsers...
950 $(Echo) "Bisoning $*.y"
951 $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
952 $(Verb) $(MV) -f $*.tab.c $*.cpp
953 $(Verb) $(MV) -f $*.tab.h $*.h
956 -$(Verb) $(RM) -f $(YaccOutput)
957 $(Verb) $(RM) -f $(YaccOutput)
960 ###############################################################################
961 # OTHER RULES: Other rules needed
962 ###############################################################################
964 # To create postscript files from dot files...
967 $(DOT) -Tps < $< > $@
970 $(Echo) "Cannot build $@: The program dot is not installed"
973 # This rules ensures that header files that are removed still have a rule for
974 # which they can be "generated." This allows make to ignore them and
975 # reproduce the dependency lists.
978 # Define clean-local to clean the current directory. Note that this uses a
979 # very conservative approach ensuring that empty variables do not cause
980 # errors or disastrous removal.
982 ifneq ($(strip $(ObjDir)),)
983 -$(Verb) $(RM) -rf $(ObjDir)
985 -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
986 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
987 -$(Verb) $(RM) -f *$(SHLIBEXT)
991 -$(Verb) $(RM) -rf Debug Release Profile
993 # Build tags database for Emacs/Xemacs:
997 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
998 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
999 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1000 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1001 -name '*.cpp' -o -name '*.h' | \
1002 $(ETAGS) $(ETAGSFLAGS) -
1005 find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
1006 $(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
1007 $(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
1008 $(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
1009 \( -name '*.cpp' -o -name '*.h' \) -print | \
1010 ctags -ImtT -o $(BUILD_OBJ_ROOT)/CTAGS -L -
1013 ###############################################################################
1014 # DEPENDENCIES: Include the dependency files if we should
1015 ###############################################################################
1016 ifndef DISABLE_AUTO_DEPENDENCIES
1018 # If its not one of the cleaning targets
1019 ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
1021 # Get the list of dependency files
1022 DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
1023 DependFiles := $(patsubst %,$(BUILD_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
1025 -include /dev/null $(DependFiles)
1031 ###############################################################################
1032 # DISTRIBUTION: Handle construction of a distribution tarball
1033 ###############################################################################
1035 #------------------------------------------------------------------------
1036 # Define distribution related variables
1037 #------------------------------------------------------------------------
1038 DistName := $(LLVM_TARBALL_NAME)
1039 DistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1040 TopDistDir := $(BUILD_OBJ_ROOT)/$(DistName)
1041 DistTarGZip := $(BUILD_OBJ_ROOT)/$(DistName).tar.gz
1042 DistZip := $(BUILD_OBJ_ROOT)/$(DistName).zip
1043 DistTarBZ2 := $(BUILD_OBJ_ROOT)/$(DistName).tar.bz2
1044 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1045 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1046 Makefile.config.in configure autoconf
1047 DistOther := $(notdir $(wildcard \
1048 $(BUILD_SRC_DIR)/*.h \
1049 $(BUILD_SRC_DIR)/*.td \
1050 $(BUILD_SRC_DIR)/*.def \
1051 $(BUILD_SRC_DIR)/*.ll \
1052 $(BUILD_SRC_DIR)/*.in))
1053 DistSubDirs := $(SubDirs)
1054 DistSources = $(Sources) $(EXTRA_DIST)
1055 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
1057 #------------------------------------------------------------------------
1058 # We MUST build distribution with OBJ_DIR != SRC_DIR
1059 #------------------------------------------------------------------------
1060 ifeq ($(BUILD_SRC_DIR),$(BUILD_OBJ_DIR))
1061 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1062 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1067 DistCheckTop := check
1069 #------------------------------------------------------------------------
1070 # Prevent catastrophic remove
1071 #------------------------------------------------------------------------
1072 ifeq ($(LLVM_TARBALL_NAME),)
1073 $(error LLVM_TARBALL_NAME is empty. Please rerun configure)
1076 #------------------------------------------------------------------------
1077 # Prevent attempt to run dist targets from anywhere but the top level
1078 #------------------------------------------------------------------------
1081 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1082 $(Echo) ERROR: You must run $@ from $(BUILD_OBJ_ROOT)
1086 #------------------------------------------------------------------------
1087 # Provide the top level targets
1088 #------------------------------------------------------------------------
1090 dist-gzip:: $(DistTarGZip)
1092 $(DistTarGZip) : distdir
1093 $(Echo) Packing gzipped distribution tar file.
1094 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1095 $(GZIP) -c > "$(DistTarGZip)"
1097 dist-bzip2:: $(DistTarBZ2)
1099 $(DistTarBZ2) : distdir
1100 $(Echo) Packing bzipped distribution tar file.
1101 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1102 $(BZIP2) -c >$(DistTarBZ2)
1104 dist-zip:: $(DistZip)
1106 $(DistZip) : distdir
1107 $(Echo) Packing zipped distribution file.
1108 $(Verb) rm -f $(DistZip)
1109 $(Verb) cd $(BUILD_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1111 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
1112 $(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
1114 DistCheckDir := $(LLVM_OBJ_ROOT)/_distcheckdir
1116 dist-check:: $(DistCheckTop) $(DistTarGZip)
1117 $(Echo) Checking distribution tar file.
1118 $(Verb) if test -d $(DistCheckDir) ; then \
1119 $(RM) -rf $(DistCheckDir) ; \
1121 $(Verb) $(MKDIR) $(DistCheckDir)
1122 $(Verb) cd $(DistCheckDir) && \
1123 $(MKDIR) $(DistCheckDir)/build && \
1124 $(MKDIR) $(DistCheckDir)/install && \
1125 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1127 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1128 --srcdir=../$(DistName) --with-llvmgccdir="$(LLVMGCCDIR)" && \
1130 $(MAKE) install && \
1131 $(MAKE) uninstall && \
1134 $(MAKE) dist-clean && \
1135 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1138 $(Echo) Cleaning distribution files
1139 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) $(DistCheckDir)
1143 #------------------------------------------------------------------------
1144 # Provide the recursive distdir target for building the distribution directory
1145 #------------------------------------------------------------------------
1146 distdir : $(DistSources)
1147 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1148 if test -d "$(DistDir)" ; then \
1149 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
1152 $(EchoCmd) Removing $(DistDir) ; \
1153 $(RM) -rf $(DistDir); \
1155 $(Echo) Building Distribution Directory $(DistDir)
1156 $(Verb) $(MKDIR) $(DistDir)
1157 $(Verb) srcdirstrip=`echo "$(BUILD_SRC_DIR)" | sed 's|.|.|g'`; \
1158 srcrootstrip=`echo "$(BUILD_SRC_ROOT)" | sed 's|.|.|g'`; \
1159 for file in $(DistFiles) ; do \
1161 $(BUILD_SRC_DIR)/*) file=`echo "$$file" | sed "s#^$$srcdirstrip/##"`;; \
1162 $(BUILD_SRC_ROOT)/*) file=`echo "$$file" | sed "s#^$$srcrootstrip/#$(BUILD_OBJ_ROOT)/#"`;; \
1164 if test -f "$$file" || test -d "$$file" ; then \
1167 from_dir=$(BUILD_SRC_DIR); \
1169 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'`; \
1170 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1171 to_dir="$(DistDir)/$$dir"; \
1172 $(MKDIR) "$$to_dir" ; \
1174 to_dir="$(DistDir)"; \
1176 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1177 if test -n "$$mid_dir" ; then \
1178 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1180 if test -d "$$from_dir/$$file"; then \
1181 if test -d "$(BUILD_SRC_DIR)/$$file" && \
1182 test "$$from_dir" != "$(BUILD_SRC_DIR)" ; then \
1183 cp -pR "$(BUILD_SRC_DIR)/$$file" "$$to_dir" || exit 1; \
1185 cp -pR $$from_dir/$$file $$to_dir || exit 1; \
1186 elif test -f "$$from_dir/$$file" ; then \
1187 cp -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1188 elif test -L "$$from_dir/$$file" ; then \
1189 cp -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
1190 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1191 $(EchoCmd) "===== WARNING: Distribution Source $$from_dir/$$file Not Found!" ; \
1192 elif test "$(Verb)" != '@' ; then \
1193 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
1196 $(Verb) for subdir in $(DistSubDirs) ; do \
1197 if test "$$subdir" \!= "." ; then \
1198 new_distdir="$(DistDir)/$$subdir" ; \
1199 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
1200 ( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || exit 1; \
1203 $(Verb) $(MAKE) DistDir="$(DistDir)" dist-hook || exit 1
1204 -$(Verb) find $(DistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
1205 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
1206 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
1207 ! -type d ! -perm -444 -exec $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1208 || chmod -R a+r $(DistDir)
1210 # This is invoked by distdir target, define it as a no-op to avoid errors if not
1216 ###############################################################################
1217 # TOP LEVEL - targets only to apply at the top level directory
1218 ###############################################################################
1222 #------------------------------------------------------------------------
1223 # Install support for project's include files:
1224 #------------------------------------------------------------------------
1226 $(Echo) Installing include files
1227 $(Verb) $(MKDIR) $(includedir)
1228 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1229 cd $(BUILD_SRC_ROOT)/include && \
1230 find . -path '*/Internal' -prune -o '(' -type f \
1231 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1232 -print ')' | grep -v CVS | pax -rwdvpe $(includedir) ; \
1236 $(Echo) Uninstalling include files
1237 $(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
1238 cd $(BUILD_SRC_ROOT)/include && \
1239 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
1240 '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
1241 -print ')' | grep -v CVS | sed 's#^#$(includedir)/#'` ; \
1246 #------------------------------------------------------------------------
1247 # Print out the directories used for building
1248 #------------------------------------------------------------------------
1250 $(Echo) "BuildMode : " '$(BuildMode)'
1251 $(Echo) "BUILD_SRC_ROOT : " '$(BUILD_SRC_ROOT)'
1252 $(Echo) "BUILD_SRC_DIR : " '$(BUILD_SRC_DIR)'
1253 $(Echo) "BUILD_OBJ_ROOT : " '$(BUILD_OBJ_ROOT)'
1254 $(Echo) "BUILD_OBJ_DIR : " '$(BUILD_OBJ_DIR)'
1255 $(Echo) "LLVM_SRC_ROOT : " '$(LLVM_SRC_ROOT)'
1256 $(Echo) "LLVM_OBJ_ROOT : " '$(LLVM_OBJ_ROOT)'
1257 $(Echo) "libdir : " '$(libdir)'
1258 $(Echo) "bindir : " '$(bindir)'
1259 $(Echo) "sysconfdir : " '$(sysconfdir)'
1260 $(Echo) "bytecode_libdir: " '$(bytecode_libdir)'
1261 $(Echo) "UserTargets : " '$(UserTargets)'
1262 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1263 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1264 $(Echo) "ObjDir : " '$(ObjDir)'
1265 $(Echo) "LibDir : " '$(LibDir)'
1266 $(Echo) "ToolDir : " '$(ToolDir)'
1267 $(Echo) "ExmplDir : " '$(ExmplDir)'
1268 $(Echo) "TDFiles : " '$(TDFiles)'
1269 $(Echo) "INCFiles : " '$(INCFiles)'
1270 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
1271 $(Echo) "Compile.C : " '$(Compile.C)'
1272 $(Echo) "Archive : " '$(Archive)'
1273 $(Echo) "YaccFiles : " '$(YaccFiles)'
1274 $(Echo) "LexFiles : " '$(LexFiles)'