# Reset the list of suffixes we know how to build
#--------------------------------------------------------------------
.SUFFIXES:
-.SUFFIXES: .c .cpp .h .hpp .y .l .lo .o .a .bc .td .ps .dot
+.SUFFIXES: .c .cpp .cc .h .hpp .y .l .lo .o .a .bc .td .ps .dot
.SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
#--------------------------------------------------------------------
PreConditions += $(MakefileConfig)
endif
-preconditions : $(PreConditions)
+preconditions: $(PreConditions)
#------------------------------------------------------------------------
# Make sure the BUILT_SOURCES are built first
AR.Flags := cru
LibTool.Flags := --tag=CXX
+#Make Floating point ieee complient on alpha
+ifeq ($(ARCH),Alpha)
+ CXX.Flags += -mieee
+ CPP.Flags += -mieee
+endif
+
#--------------------------------------------------------------------
# Directory locations
#--------------------------------------------------------------------
ifndef LLI
LLI := $(LLVMToolDir)/lli$(EXEEXT)
endif
+ifndef LLC
+LLC := $(LLVMToolDir)/llc$(EXEEXT)
+endif
ifndef LOPT
LOPT := $(LLVMToolDir)/opt$(EXEEXT)
endif
+ifndef LBUGPOINT
+LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
+endif
+
LLVMGCCWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGCC)
LLVMGXXWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGXX)
ifndef KEEP_SYMBOLS
Strip := $(PLATFORMSTRIPOPTS)
StripWarnMsg := "(without symbols)"
+ Install.StripFlag += -s
endif
# Adjust linker flags for building an executable
CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
-LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
+ifeq ($(OS),HP-UX)
+ CompileCommonOpts += -D_REENTRANT -D_HPUX_SOURCE
+endif
+
+LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
CPP.Flags += -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
-I$(PROJ_OBJ_ROOT)/include \
-I$(PROJ_SRC_ROOT)/include \
LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
$(C.Flags) -c
+Preprocess.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -E $(C.Flags)
+
Compile.CXX = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
$(CXX.Flags) -c
+Preprocess.CXX= $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -E
Link = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
$(CompileCommonOpts) $(LD.Flags) $(Strip)
Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
$(CompileCommonOpts)
-LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL)
+LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \
+ $(Install.Flags)
+ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
+DataInstall = $(INSTALL) -m 0644
Burg = $(BURG) -I $(PROJ_SRC_DIR)
TableGen = $(TBLGEN) -I $(PROJ_SRC_DIR)
Archive = $(AR) $(AR.Flags)
# in the file so they get built before dependencies
#---------------------------------------------------------
-$(PROJ_bindir):
- $(Verb) $(MKDIR) $(PROJ_bindir)
-
-$(PROJ_libdir):
- $(Verb) $(MKDIR) $(PROJ_libdir)
-
-$(PROJ_includedir):
- $(Verb) $(MKDIR) $(PROJ_includedir)
-
-$(PROJ_etcdir):
- $(Verb) $(MKDIR) $(PROJ_etcdir)
+$(PROJ_bindir): $(PROJ_bindir)/.dir
+$(PROJ_libdir): $(PROJ_libdir)/.dir
+$(PROJ_includedir): $(PROJ_includedir)/.dir
+$(PROJ_etcdir): $(PROJ_etcdir)/.dir
# To create other directories, as needed, and timestamp their creation
%/.dir:
$(Echo) Installing Configuration Files To $(PROJ_etcdir)
$(Verb)for file in $(CONFIG_FILES); do \
if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
- $(INSTALL) $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \
+ $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \
elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
- $(INSTALL) $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \
+ $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \
else \
$(ECHO) Error: cannot find config file $${file}. ; \
fi \
endif
+###############################################################################
+# Set up variables for building libararies
+###############################################################################
+
+#---------------------------------------------------------
+# Handle the special "JIT" value for LLVM_LIBS which is a
+# shorthand for a bunch of libraries that get the correct
+# JIT support for a library or a tool that runs JIT.
+#---------------------------------------------------------
+ifeq ($(LLVMLIBS),JIT)
+
+# Make sure we can get our own symbols in the tool
+Link += -dlopen self
+
+# Generic JIT libraries
+JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
+
+# You can enable the X86 JIT on a non-X86 host by setting the flag
+# ENABLE_X86_JIT on the make command line. If not, it will still be
+# enabled automagically on an X86 host.
+ifeq ($(ARCH), x86)
+ ENABLE_X86_JIT = 1
+endif
+
+# What the X86 JIT requires
+ifdef ENABLE_X86_JIT
+ JIT_LIBS += LLVMX86 LLVMSelectionDAG
+endif
+
+# You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
+# ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
+# enabled automagically on an SparcV9 host.
+ifeq ($(ARCH), Sparc)
+ ENABLE_SPARCV9_JIT = 1
+endif
+
+# What the Sparc JIT requires
+ifdef ENABLE_SPARCV9_JIT
+ JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
+ LLVMSparcV9LiveVar LLVMInstrumentation.a \
+ LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
+ LLVMDataStructure LLVMSparcV9RegAlloc
+endif
+
+# You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
+# ENABLE_PPC_JIT on the make command line. If not, it will still be
+# enabled automagically on an PowerPC host.
+ifeq ($(ARCH), PowerPC)
+ ENABLE_PPC_JIT = 1
+endif
+
+# What the PowerPC JIT requires
+ifdef ENABLE_PPC_JIT
+ JIT_LIBS += LLVMPowerPC LLVMSelectionDAG
+endif
+
+# You can enable the Alpha JIT on a non-Alpha host by setting the flag
+# ENABLE_ALPHA_JIT on the make command line. If not, it will still be
+# enabled automagically on an Alpha host.
+ifeq ($(ARCH), Alpha)
+ ENABLE_ALPHA_JIT = 1
+endif
+
+# What the Alpha JIT requires
+ifdef ENABLE_ALPHA_JIT
+ JIT_LIBS += LLVMAlpha LLVMSelectionDAG
+endif
+
+LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts.a LLVMTransformUtils.a LLVMAnalysis.a \
+ LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
+ LLVMSystem.a $(PLATFORMLIBDL)
+endif
+
+#---------------------------------------------------------
+# Define various command line options pertaining to the
+# libraries needed when linking. There are "Proj" libs
+# (defined by the user's project) and "LLVM" libs (defined
+# by the # LLVM project).
+#---------------------------------------------------------
+# Some versions of gcc on Alpha produce too many symbols, so use a .a file
+ifeq ($(ARCH),Alpha)
+USEDLIBS := $(subst LLVMCore, LLVMCore.a, $(USEDLIBS))
+LLVMLIBS := $(subst LLVMCore, LLVMCore.a, $(LLVMLIBS))
+endif
+
+ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
+ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
+LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
+LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
+ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
+LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
+ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
+LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
+
###############################################################################
# Library Build Rules: Four ways to build a library
###############################################################################
#---------------------------------------------------------
ifdef MODULE_NAME
+ifeq ($(strip $(LLVMGCC)),)
+$(warning Modules require llvm-gcc but no llvm-gcc is available ****)
+else
Module := $(LibDir)/$(MODULE_NAME).bc
LinkModule := $(LLVMGCCWITHPATH) -shared -nostdlib
ifdef EXPORTED_SYMBOL_FILE
-LinkMOdule += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
+LinkModule += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
endif
$(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
- $(Echo) Building $(BuildMOde) Bytecode Module $(notdir $@)
+ $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
$(Verb) $(LinkModule) -o $@ $(ObjectsBC)
all-local:: $(Module)
$(DestModule): $(ModuleDestDir) $(Module)
$(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
- $(Verb) $(INSTALL) $(Module) $@
+ $(Verb) $(DataInstall) $(Module) $(DestModule)
uninstall-local::
$(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
-$(Verb) $(RM) -f $(DestModule)
endif
+endif
# if we're building a library ...
ifdef LIBRARYNAME
all-local:: $(LibName.LA)
+ifdef LINK_LIBS_IN_SHARED
+$(LibName.LA): $(ObjectsLO) $(LibDir)/.dir
+ $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
+ $(Verb) $(Link) -o $@ $(ObjectsLO) \
+ $(ProjLibsOptions) $(LLVMLibsOptions)
+ $(Verb) $(LTInstall) $@ $(LibDir)
+else
$(LibName.LA): $(ObjectsLO) $(LibDir)/.dir
$(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
$(Verb) $(Link) -o $@ $(ObjectsLO)
$(Verb) $(LTInstall) $@ $(LibDir)
+endif
clean-local::
ifneq ($(strip $(LibName.LA)),)
# targets for building them.
#---------------------------------------------------------
ifdef BYTECODE_LIBRARY
+ifeq ($(strip $(LLVMGCC)),)
+$(warning Bytecode libraries require llvm-gcc which could not be found ****)
+else
# make the C and C++ compilers strip debug info out of bytecode libraries.
BCCompile.C += -Wa,-strip-debug
$(DestBytecodeLib): $(BytecodeDestDir) $(LibName.BCA)
$(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
- $(Verb) $(INSTALL) $(LibName.BCA) $@
+ $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
uninstall-local::
$(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
-$(Verb) $(RM) -f $(DestBytecodeLib)
endif
+endif
#---------------------------------------------------------
# ReLinked Library Targets:
-# If the user didn't explicitly forbid building a
-# relinked then we provide targets for building them.
+# If the user explicitly requests a relinked library with
+# BUILD_RELINKED, provide it. Otherwise, if they specify
+# neither of BUILD_ARCHIVE or DONT_BUILD_RELINKED, give
+# them one.
#---------------------------------------------------------
+ifndef BUILD_ARCHIVE
ifndef DONT_BUILD_RELINKED
+BUILD_RELINKED = 1
+endif
+endif
+
+ifdef BUILD_RELINKED
all-local:: $(LibName.O)
ifdef TOOLNAME
-#---------------------------------------------------------
-# Handle the special "JIT" value for LLVM_LIBS which is a
-# shorthand for a bunch of libraries that get the correct
-# JIT support for a tool that runs JIT.
-#---------------------------------------------------------
-ifeq ($(LLVMLIBS),JIT)
-
-# Make sure we can get our own symbols in the tool
-Link += -dlopen self
-
-# Generic JIT libraries
-JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen LLVMExecutionEngine
-
-# You can enable the X86 JIT on a non-X86 host by setting the flag
-# ENABLE_X86_JIT on the make command line. If not, it will still be
-# enabled automagically on an X86 host.
-ifeq ($(ARCH), x86)
- ENABLE_X86_JIT = 1
-endif
-
-# What the X86 JIT requires
-ifdef ENABLE_X86_JIT
- JIT_LIBS += LLVMX86 LLVMSelectionDAG
-endif
-
-# You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag
-# ENABLE_SPARCV9_JIT on the make command line. If not, it will still be
-# enabled automagically on an SparcV9 host.
-ifeq ($(ARCH), Sparc)
- ENABLE_SPARCV9_JIT = 1
-endif
-
-# What the Sparc JIT requires
-ifdef ENABLE_SPARCV9_JIT
- JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \
- LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \
- LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \
- LLVMDataStructure.a LLVMSparcV9RegAlloc
-endif
-
-# You can enable the PowerPC JIT on a non-PowerPC host by setting the flag
-# ENABLE_PPC_JIT on the make command line. If not, it will still be
-# enabled automagically on an PowerPC host.
-ifeq ($(ARCH), PowerPC)
- ENABLE_PPC_JIT = 1
-endif
-
-# What the PowerPC JIT requires
-ifdef ENABLE_PPC_JIT
- JIT_LIBS += LLVMPowerPC
-endif
-
-LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \
- LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \
- LLVMSystem.a $(PLATFORMLIBDL)
-endif
-
#---------------------------------------------------------
# Set up variables for building a tool.
#---------------------------------------------------------
ifdef EXAMPLE_TOOL
-ToolBuildPath := $(ExmplDir)/$(TOOLNAME)$(EXEEXT)
+ToolBuildPath := $(ExmplDir)/$(strip $(TOOLNAME))$(EXEEXT)
else
-ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
+ToolBuildPath := $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT)
endif
-ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
-ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
-LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
-LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
-ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
-LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
-ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
-LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
#---------------------------------------------------------
# Tell make that we need to rebuild subdirectories before
$(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
$(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
$(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
- $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB)
+ $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
$(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg)
DestTool = $(PROJ_bindir)/$(TOOLNAME)
$(DestTool): $(PROJ_bindir) $(ToolBuildPath)
$(Echo) Installing $(BuildMode) $(DestTool)
- $(Verb) $(INSTALL) $(ToolBuildPath) $(DestTool)
+ $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
uninstall-local::
$(Echo) Uninstalling $(BuildMode) $(DestTool)
then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
+$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
+ $(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)"
+ $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \
+ then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
+ else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
+
$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
$(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
+$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
+ $(Echo) "Compiling $*.cc for $(BuildMode) build"
+ $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \
+ then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \
+ else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi
+
$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.c for $(BuildMode) build"
$(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
endif
+## Rules for building preprocessed (.i/.ii) outputs.
+$(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
+ $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
+ $(Verb) $(Preprocess.CXX) $< -o $@
+
+$(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
+ $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
+ $(Verb) $(Preprocess.CXX) $< -o $@
+
+ $(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
+ $(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
+ $(Verb) $(Preprocess.C) $< -o $@
+
+
#---------------------------------------------------------
-# Create .bc files in the ObjDir directory from .cpp and .c files...
+# Create .bc files in the ObjDir directory from .cpp .cc and .c files...
#---------------------------------------------------------
$(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
+$(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
+ $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
+ $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \
+ then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
+ else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
+
$(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
$(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
$(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
$(LTCompile.CXX) $< -o $@
+$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
+ $(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)"
+ $(LTCompile.CXX) $< -o $@
+
$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
$(LTCompile.C) $< -o $@
$(Echo) "Compiling $*.cpp for $(BuildMode) build"
$(Compile.CXX) $< -o $@
+$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
+ $(Echo) "Compiling $*.cc for $(BuildMode) build"
+ $(Compile.CXX) $< -o $@
+
$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.c for $(BuildMode) build"
$(Compile.C) $< -o $@
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
$(BCCompile.CXX) $< -o $@
+$(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
+ $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
+ $(BCCompile.CXX) $< -o $@
+
$(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES)
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
$(BCCompile.C) $< -o $@
ifdef TARGET
-TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
+TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td $(LLVM_SRC_ROOT)/lib/Target/TargetSelectionDAG.td)
INCFiles := $(filter %.inc,$(BUILT_SOURCES))
INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
.PRECIOUS: $(INCTMPFiles) $(INCFiles)
$(Echo) "Building $(<F) code emitter with tblgen"
$(Verb) $(TableGen) -gen-emitter -o $@ $<
+$(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
+$(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir
+ $(Echo) "Building $(<F) instruction selector implementation with tblgen"
+ $(Verb) $(TableGen) -gen-dag-isel -o $@ $<
+
+$(TARGET:%=$(ObjDir)/%GenSubtarget.inc.tmp): \
+$(ObjDir)/%GenSubtarget.inc.tmp : %.td $(ObjDir)/.dir
+ $(Echo) "Building $(<F) subtarget information with tblgen"
+ $(Verb) $(TableGen) -gen-subtarget -o $@ $<
+
clean-local::
-$(Verb) $(RM) -f $(INCFiles)
ifneq ($(LexFiles),)
-LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
-
-.PRECIOUS: $(LexOutput)
+# Cancel built-in rules for lex
+%.c: %.l
+%.cpp: %.l
# Note the extra sed filtering here, used to cut down on the warnings emited
# by GCC. The last line is a gross hack to work around flex aparently not
# uninitialized string buffers in LLVM we can generate very long tokens, so
# this is a hack around it.
# FIXME. (f.e. char Buffer[10000] )
-%.cpp: %.l
+$(PROJ_SRC_DIR)/%.cpp: $(PROJ_SRC_DIR)/%.l
$(Echo) Flexing $*.l
- $(Verb) $(FLEX) -t $< | \
+ $(Verb) $(FLEX) -t $(PROJ_SRC_DIR)/$*.l | \
$(SED) 's/void yyunput/inline void yyunput/' | \
$(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
$(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
- > $@
+ > $(PROJ_SRC_DIR)/$*.cpp
+ $(Echo) "*** DON'T FORGET TO CHECK IN $*.cpp (generated file)"
+
+LexObjs := $(patsubst %.l,$(ObjDir)/%.o,$(LexFiles))
+$(LexObjs): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
clean-local::
-$(Verb) $(RM) -f $(LexOutput)
YaccFiles := $(filter %.y,$(Sources))
ifneq ($(YaccFiles),)
-YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
+YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.output)
.PRECIOUS: $(YaccOutput)
%.h: %.y
# Rule for building the bison parsers...
-%.cpp %.h : %.y
+$(PROJ_SRC_DIR)/%.cpp $(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.y
$(Echo) "Bisoning $*.y"
- $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
- $(Verb) $(MV) -f $*.tab.c $*.cpp
- $(Verb) $(MV) -f $*.tab.h $*.h
+ $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
+ $(Verb) $(MV) -f $*.tab.c $(PROJ_SRC_DIR)/$*.cpp
+ $(Verb) $(MV) -f $*.tab.h $(PROJ_SRC_DIR)/$*.h
+ $(Echo) "*** DON'T FORGET TO CHECK IN $*.cpp and $*.h (generated files)"
clean-local::
- -$(Verb) $(RM) -f $(YaccOutput)
$(Verb) $(RM) -f $(YaccOutput)
endif
# which they can be "generated." This allows make to ignore them and
# reproduce the dependency lists.
%.h:: ;
+%.hpp:: ;
# Define clean-local to clean the current directory. Note that this uses a
# very conservative approach ensuring that empty variables do not cause
dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
$(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
-DistCheckDir := $(LLVM_OBJ_ROOT)/_distcheckdir
+DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
dist-check:: $(DistTarGZip)
$(Echo) Checking distribution tar file.
gunzip -c $(DistTarGZip) | $(TAR) xf - && \
cd build && \
../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
- --srcdir=../$(DistName) && \
+ --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
$(MAKE) all && \
$(MAKE) check && \
$(MAKE) install && \
if test -d "$$from_dir/$$file"; then \
if test -d "$(PROJ_SRC_DIR)/$$file" && \
test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
- $(CP) -pR "$(PROJ_SRC_DIR)/$$file" "$$to_dir" || exit 1; \
+ cd $(PROJ_SRC_DIR) ; \
+ $(TAR) cf - $$file --exclude .svn --exclude CVS | \
+ ( cd $$to_dir ; $(TAR) xf - ) ; \
+ cd $(PROJ_OBJ_DIR) ; \
+ else \
+ cd $$from_dir ; \
+ $(TAR) cf - $$file --exclude .svn --exclude CVS | \
+ ( cd $$to_dir ; $(TAR) xf - ) ; \
+ cd $(PROJ_OBJ_DIR) ; \
fi; \
- $(CP) -pR $$from_dir/$$file $$to_dir || exit 1; \
elif test -f "$$from_dir/$$file" ; then \
$(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
elif test -L "$$from_dir/$$file" ; then \
fi; \
done
$(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
- $(EchoCmd) Eliminating CVS directories from distribution ; \
- $(RM) -rf `find $(TopDistDir) -type d -name CVS -print` ;\
+ $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
+ $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o -name .svn \) -print` ;\
$(MAKE) dist-hook ; \
$(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
-o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
install-local::
$(Echo) Installing include files
$(Verb) $(MKDIR) $(PROJ_includedir)
- $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
+ $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
cd $(PROJ_SRC_ROOT)/include && \
- find . -path '*/Internal' -prune -o '(' -type f \
- '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
- -print ')' | grep -v CVS | pax -rwdvpe $(PROJ_includedir) ; \
+ for hdr in `find . -type f '!' '(' -name '*~' -o -name '.cvsignore' \
+ -o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS ` ; do \
+ instdir=`dirname "$(PROJ_includedir)/$$hdr"` ; \
+ if test \! -d "$$instdir" ; then \
+ $(EchoCmd) Making install directory $$instdir ; \
+ $(MKDIR) $$instdir ;\
+ fi ; \
+ $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
+ done ; \
+ fi
+ $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
+ cd $(PROJ_OBJ_ROOT)/include && \
+ for hdr in `find . -type f -print` ; do \
+ $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
+ done ; \
fi
uninstall-local::
$(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
cd $(PROJ_SRC_ROOT)/include && \
$(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
- '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
+ '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' -o -name '*.in' ')' \
-print ')' | grep -v CVS | sed 's#^#$(PROJ_includedir)/#'` ; \
- fi
+ cd $(PROJ_SRC_ROOT)/include && \
+ $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' -print ')' \
+ | sed 's#\.in$$##;s#^#$(PROJ_includedir)/#'` ; \
+ fi
endif
$(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
$(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
$(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
+ $(Echo) "PROJ_includedir : " '$(PROJ_includedir)'
$(Echo) "UserTargets : " '$(UserTargets)'
$(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
$(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
$(Echo) "TDFiles : " '$(TDFiles)'
$(Echo) "INCFiles : " '$(INCFiles)'
$(Echo) "INCTMPFiles : " '$(INCTMPFiles)'
- $(Echo) "Preconditions: " '$(Preconditions)'
+ $(Echo) "PreConditions: " '$(PreConditions)'
$(Echo) "Compile.CXX : " '$(Compile.CXX)'
$(Echo) "Compile.C : " '$(Compile.C)'
$(Echo) "Archive : " '$(Archive)'
$(Echo) "YaccFiles : " '$(YaccFiles)'
$(Echo) "LexFiles : " '$(LexFiles)'
$(Echo) "Module : " '$(Module)'
+ $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'