2004-04-24 00:10:56 +00:00
|
|
|
#===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===#
|
|
|
|
#
|
2003-10-21 14:33:46 +00:00
|
|
|
# The LLVM Compiler Infrastructure
|
|
|
|
#
|
|
|
|
# This file was developed by the LLVM research group and is distributed under
|
|
|
|
# the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
#
|
2004-04-24 00:10:56 +00:00
|
|
|
#===------------------------------------------------------------------------===#
|
2001-06-06 20:29:01 +00:00
|
|
|
#
|
2004-10-23 20:04:14 +00:00
|
|
|
# This file is included by all of the LLVM makefiles. For details on how to use
|
|
|
|
# it properly, please see the document MakefileGuide.html in the docs directory.
|
2003-08-15 03:02:52 +00:00
|
|
|
#
|
2002-07-09 12:04:21 +00:00
|
|
|
#===-----------------------------------------------------------------------====
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
################################################################################
|
2004-10-23 20:04:14 +00:00
|
|
|
# TARGETS: Define standard targets that can be invoked
|
2004-10-30 09:19:36 +00:00
|
|
|
################################################################################
|
2003-06-11 13:55:44 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Define the various target sets
|
|
|
|
#--------------------------------------------------------------------
|
2004-11-02 16:36:03 +00:00
|
|
|
RecursiveTargets := all clean clean-all check install uninstall
|
|
|
|
LocalTargets := all-local clean-local clean-all-local check-local \
|
|
|
|
install-local printvars uninstall-local
|
2004-10-30 09:19:36 +00:00
|
|
|
TopLevelTargets := dist dist-check dist-clean tags dist-gzip dist-bzip2 \
|
|
|
|
dist-zip
|
|
|
|
UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
|
|
|
|
InternalTargets := preconditions distdir dist-hook
|
2003-08-14 21:10:25 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
################################################################################
|
2004-10-26 22:26:33 +00:00
|
|
|
# INITIALIZATION: Basic things the makefile needs
|
2004-10-30 09:19:36 +00:00
|
|
|
################################################################################
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Set the VPATH so that we can find source files.
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
VPATH=$(BUILD_SRC_DIR)
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Reset the list of suffixes we know how to build
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
.SUFFIXES:
|
2004-10-30 09:19:36 +00:00
|
|
|
.SUFFIXES: .c .cpp .h .hpp .y .l .lo .o .a .bc .td .ps .dot
|
|
|
|
.SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
|
2004-10-26 22:26:33 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Mark all of these targets as phony to avoid implicit rule search
|
|
|
|
#--------------------------------------------------------------------
|
2004-10-30 09:19:36 +00:00
|
|
|
.PHONY: $(UserTargets) $(InternalTargets)
|
2003-05-29 16:18:20 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
2004-10-26 22:26:33 +00:00
|
|
|
# Make sure all the user-target rules are double colon rules and
|
|
|
|
# they are defined first.
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
2003-05-29 16:18:20 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(UserTargets)::
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# PRECONDITIONS: that which must be built/checked first
|
|
|
|
################################################################################
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
SrcMakefiles := $(filter %Makefile %Makefile.rules %Makefile.tests \
|
|
|
|
%Makefile.JIT,$(wildcard $(BUILD_SRC_DIR)/Makefile*))
|
|
|
|
ObjMakefiles := $(subst $(BUILD_SRC_DIR),$(BUILD_OBJ_DIR),$(SrcMakefiles))
|
|
|
|
ConfigureScript := $(LLVM_SRC_ROOT)/configure
|
|
|
|
ConfigStatusScript := $(LLVM_OBJ_ROOT)/config.status
|
|
|
|
MakefileConfigIn := $(LLVM_SRC_ROOT)/Makefile.config.in
|
|
|
|
MakefileConfig := $(LLVM_OBJ_ROOT)/Makefile.config
|
|
|
|
PreConditions := $(ConfigStatusScript) $(MakefileConfig) $(ObjMakefiles)
|
2004-10-26 22:26:33 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
preconditions : $(PreConditions)
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Make sure the BUILT_SOURCES are built first
|
|
|
|
#------------------------------------------------------------------------
|
2004-10-30 09:19:36 +00:00
|
|
|
$(filter-out clean clean-local,UserTargets):: $(BUILT_SOURCES)
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
clean-local::
|
|
|
|
ifneq ($(strip $(BUILT_SOURCES)),)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(BUILT_SOURCES)
|
2004-10-26 22:26:33 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(BUILT_SOURCES) : $(ObjMakefiles)
|
2004-10-28 00:41:43 +00:00
|
|
|
|
2004-10-26 22:26:33 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Make sure we're not using a stale configuration
|
|
|
|
#------------------------------------------------------------------------
|
2004-10-30 09:19:36 +00:00
|
|
|
.PRECIOUS: $(ConfigStatusScript)
|
|
|
|
$(ConfigStatusScript): $(ConfigureScript)
|
|
|
|
$(Echo) Reconfiguring with $<
|
|
|
|
$(Verb) $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS)
|
|
|
|
$(Verb) $(ConfigStatusScript)
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Make sure the configuration makefile is up to date
|
|
|
|
#------------------------------------------------------------------------
|
2004-10-30 09:19:36 +00:00
|
|
|
$(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
|
|
|
|
$(Echo) Regenerating $@
|
|
|
|
$(Verb) cd $(LLVM_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# If the Makefile in the source tree has been updated, copy it over into the
|
|
|
|
# build tree. But, only do this if the source and object makefiles differ
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
ifneq ($(BUILD_OBJ_DIR),$(BUILD_SRC_DIR))
|
|
|
|
|
|
|
|
$(BUILD_OBJ_DIR)/Makefile : $(BUILD_SRC_DIR)/Makefile
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Updating Makefile"
|
|
|
|
$(Verb) $(MKDIR) $(@D)
|
|
|
|
$(Verb) cp -f $< $@
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
# Copy the Makefile.* files unless we're in the root directory which avoids
|
|
|
|
# the copying of Makefile.config.in or other things that should be explicitly
|
|
|
|
# taken care of.
|
|
|
|
$(BUILD_OBJ_DIR)/Makefile% : $(BUILD_SRC_DIR)/Makefile%
|
2004-10-26 23:10:00 +00:00
|
|
|
@case '$?' in \
|
|
|
|
*Makefile.rules) ;; \
|
|
|
|
*.in) ;; \
|
2004-10-30 09:19:36 +00:00
|
|
|
*) $(Echo) "Updating $(@F)" ; \
|
2004-10-26 23:10:00 +00:00
|
|
|
$(MKDIR) $(@D) ; \
|
|
|
|
cp -f $< $@ ;; \
|
|
|
|
esac
|
|
|
|
|
2004-10-26 22:26:33 +00:00
|
|
|
endif
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2004-10-26 22:26:33 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Set up the basic dependencies
|
|
|
|
#------------------------------------------------------------------------
|
2004-10-30 09:19:36 +00:00
|
|
|
$(UserTargets):: $(PreConditions)
|
2004-10-26 22:26:33 +00:00
|
|
|
|
|
|
|
all:: all-local
|
2004-10-23 20:04:14 +00:00
|
|
|
check:: check-local
|
|
|
|
clean:: clean-local
|
2004-11-02 16:36:03 +00:00
|
|
|
clean-all:: clean-local clean-all-local
|
2004-10-26 22:26:33 +00:00
|
|
|
install:: install-local
|
|
|
|
uninstall:: uninstall-local
|
|
|
|
check-local:: all-local
|
|
|
|
install-local:: all-local
|
2004-10-23 20:04:14 +00:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# VARIABLES: Set up various variables based on configuration data
|
|
|
|
###############################################################################
|
2003-06-30 21:59:07 +00:00
|
|
|
|
2001-06-06 20:29:01 +00:00
|
|
|
#--------------------------------------------------------------------
|
2004-10-23 20:04:14 +00:00
|
|
|
# Variables derived from configuration we are building
|
2001-06-06 20:29:01 +00:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
2003-03-14 20:25:22 +00:00
|
|
|
ifdef ENABLE_PROFILING
|
2004-11-01 07:50:27 +00:00
|
|
|
BuildMode := Profile
|
2004-10-30 09:19:36 +00:00
|
|
|
CXX.Flags := -O3 -DNDEBUG -felide-constructors -finline-functions -pg
|
|
|
|
C.Flags := -O3 -DNDEBUG -pg
|
|
|
|
LD.Flags := -O3 -DNDEBUG -pg
|
2003-03-14 20:25:22 +00:00
|
|
|
else
|
|
|
|
ifdef ENABLE_OPTIMIZED
|
2004-11-01 07:50:27 +00:00
|
|
|
BuildMode := Release
|
2004-10-30 09:19:36 +00:00
|
|
|
CXX.Flags := -O3 -DNDEBUG -finline-functions -felide-constructors -fomit-frame-pointer
|
|
|
|
C.Flags := -O3 -DNDEBUG -fomit-frame-pointer
|
|
|
|
LD.Flags := -O3 -DNDEBUG
|
2003-03-14 20:25:22 +00:00
|
|
|
else
|
2004-11-01 07:50:27 +00:00
|
|
|
BuildMode := Debug
|
2004-10-30 09:19:36 +00:00
|
|
|
CXX.Flags := -g -D_DEBUG
|
|
|
|
C.Flags := -g -D_DEBUG
|
|
|
|
LD.Flags := -g -D_DEBUG
|
2004-10-22 21:01:56 +00:00
|
|
|
KEEP_SYMBOLS := 1
|
2003-03-14 20:25:22 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
CXX.Flags += $(CXXFLAGS)
|
|
|
|
C.Flags += $(CFLAGS)
|
|
|
|
CPP.Flags += $(CPPFLAGS)
|
|
|
|
LD.Flags += $(LDFLAGS)
|
|
|
|
AR.Flags := cru
|
|
|
|
LibTool.Flags := --tag=CXX
|
2004-10-23 20:04:14 +00:00
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
# Directory locations
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
2004-11-01 07:50:27 +00:00
|
|
|
ObjDir := $(BUILD_OBJ_DIR)/$(BuildMode)
|
|
|
|
LibDir := $(BUILD_OBJ_ROOT)/lib/$(BuildMode)
|
|
|
|
ToolDir := $(BUILD_OBJ_ROOT)/tools/$(BuildMode)
|
|
|
|
LLVMLibDir := $(LLVM_OBJ_ROOT)/lib/$(BuildMode)
|
|
|
|
LLVMToolDir := $(LLVM_OBJ_ROOT)/tools/$(BuildMode)
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
# Full Paths To Compiled Tools and Utilities
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
2004-10-30 09:19:36 +00:00
|
|
|
EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
|
|
|
|
Echo := @$(EchoCmd)
|
|
|
|
ifndef LIBTOOL
|
2004-10-22 21:01:56 +00:00
|
|
|
LIBTOOL := $(LLVM_OBJ_ROOT)/mklib
|
2004-10-30 09:19:36 +00:00
|
|
|
endif
|
|
|
|
ifndef LLVMAS
|
|
|
|
LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
|
|
|
|
endif
|
|
|
|
ifndef BURG
|
|
|
|
BURG := $(LLVMToolDir)/burg$(EXEEXT)
|
|
|
|
endif
|
|
|
|
ifndef TBLGEN
|
|
|
|
TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT)
|
|
|
|
endif
|
|
|
|
ifndef GCCLD
|
|
|
|
GCCLD := $(LLVMToolDir)/gccld$(EXEEXT)
|
|
|
|
endif
|
|
|
|
ifndef LLVMGCC
|
|
|
|
LLVMGCC := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/gcc
|
|
|
|
endif
|
|
|
|
ifndef LLVMGXX
|
|
|
|
LLVMGXX := PATH=$(LLVMToolDir):$(PATH) $(LLVMGCCDIR)/bin/g++
|
|
|
|
endif
|
2004-10-22 21:01:56 +00:00
|
|
|
|
|
|
|
# Need a better way to compute this.
|
2004-10-30 09:19:36 +00:00
|
|
|
LLVMGCCLibDir := $(dir $(shell $(LLVMGCC) -print-file-name=libgcc.a))/
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
# Adjust to user's request
|
2004-10-23 20:04:14 +00:00
|
|
|
#--------------------------------------------------------------------
|
2003-06-11 13:55:44 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
# Adjust LIBTOOL flags for shared libraries, or not.
|
2003-07-31 20:58:51 +00:00
|
|
|
ifndef SHARED_LIBRARY
|
2004-10-30 09:19:36 +00:00
|
|
|
LibTool.Flags += --tag=disable-shared
|
2004-10-22 21:01:56 +00:00
|
|
|
else
|
2004-10-30 09:19:36 +00:00
|
|
|
LD.Flags += -rpath $(LibDir)
|
2003-07-31 20:58:51 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
# Adjust settings for verbose mode
|
2003-03-14 20:25:22 +00:00
|
|
|
ifndef VERBOSE
|
2004-10-30 09:19:36 +00:00
|
|
|
Verb := @
|
|
|
|
LibTool.Flags += --silent
|
|
|
|
AR.Flags += >/dev/null 2>/dev/null
|
|
|
|
ConfigureScriptFLAGS += >$(BUILD_OBJ_DIR)/configure.out 2>&1
|
2004-10-25 08:27:37 +00:00
|
|
|
else
|
2004-10-30 09:19:36 +00:00
|
|
|
ConfigureScriptFLAGS :=
|
2002-09-12 16:05:39 +00:00
|
|
|
endif
|
|
|
|
|
2002-09-18 11:55:13 +00:00
|
|
|
# By default, strip symbol information from executable
|
2003-03-14 20:25:22 +00:00
|
|
|
ifndef KEEP_SYMBOLS
|
2004-10-30 09:19:36 +00:00
|
|
|
Strip := $(PLATFORMSTRIPOPTS)
|
|
|
|
StripWarnMsg := "(without symbols)"
|
2002-09-18 11:55:13 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
# Adjust linker flags for building an executable
|
2004-10-22 21:01:56 +00:00
|
|
|
ifdef TOOLNAME
|
2004-10-30 09:19:36 +00:00
|
|
|
LD.Flags += -rpath $(ToolDir) -export-dynamic
|
2003-10-29 14:28:35 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#----------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
# Options To Invoke Tools
|
2004-10-23 20:04:14 +00:00
|
|
|
#----------------------------------------------------------
|
2003-06-30 21:59:07 +00:00
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
|
|
|
|
CPP.Flags += -I$(BUILD_OBJ_DIR) \
|
2004-10-25 08:27:37 +00:00
|
|
|
-I$(BUILD_SRC_DIR) \
|
|
|
|
-I$(BUILD_SRC_ROOT)/include \
|
|
|
|
-I$(BUILD_OBJ_ROOT)/include \
|
|
|
|
-I$(LLVM_OBJ_ROOT)/include \
|
|
|
|
-I$(LLVM_SRC_ROOT)/include \
|
|
|
|
-D_GNU_SOURCE -D__STDC_LIMIT_MACROS
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
Compile.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags)
|
|
|
|
LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
|
|
|
|
BCCompile.C = $(LLVMGCC) $(CPP.Flags) $(CompileCommonOpts) $(C.Flags) -c
|
|
|
|
Compile.CXX = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
|
|
|
|
LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
|
|
|
|
BCCompile.CXX = $(LLVMGXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
|
|
|
|
Link = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
|
|
|
|
$(CompileCommonOpts) $(LD.Flags) $(Strip)
|
|
|
|
Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
|
2004-10-28 09:15:28 +00:00
|
|
|
$(CompileCommonOpts)
|
2004-10-23 20:04:14 +00:00
|
|
|
BCLinkLib = $(LLVMGCC) -shared -nostdlib
|
2004-10-30 09:19:36 +00:00
|
|
|
LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL)
|
2004-10-23 20:04:14 +00:00
|
|
|
Burg = $(BURG) -I $(BUILD_SRC_DIR)
|
|
|
|
TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR)
|
2004-10-30 09:19:36 +00:00
|
|
|
Archive = $(AR) $(AR.Flags)
|
2004-10-22 21:01:56 +00:00
|
|
|
ifdef RANLIB
|
2004-10-23 20:04:14 +00:00
|
|
|
Ranlib = $(RANLIB)
|
2004-10-22 21:01:56 +00:00
|
|
|
else
|
2004-10-23 20:04:14 +00:00
|
|
|
Ranlib = ranlib
|
2004-10-22 21:01:56 +00:00
|
|
|
endif
|
2001-06-06 20:29:01 +00:00
|
|
|
|
|
|
|
#----------------------------------------------------------
|
2004-10-23 20:04:14 +00:00
|
|
|
# Get the list of source files
|
|
|
|
#----------------------------------------------------------
|
|
|
|
ifndef SOURCES
|
2004-10-30 09:19:36 +00:00
|
|
|
Sources := $(notdir $(wildcard $(BUILD_SRC_DIR)/*.cpp \
|
|
|
|
$(BUILD_SRC_DIR)/*.cc $(BUILD_SRC_DIR)/*.c $(BUILD_SRC_DIR)/*.y \
|
|
|
|
$(BUILD_SRC_DIR)/*.l))
|
|
|
|
else
|
|
|
|
Sources := $(SOURCES)
|
2004-10-22 21:01:56 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef BUILT_SOURCES
|
2004-10-30 09:19:36 +00:00
|
|
|
Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
|
2002-10-14 16:40:04 +00:00
|
|
|
endif
|
2001-07-15 13:16:47 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#----------------------------------------------------------
|
|
|
|
# Types of objects that can be built from sources
|
|
|
|
#----------------------------------------------------------
|
2004-10-30 09:19:36 +00:00
|
|
|
BaseNameSources := $(sort $(basename $(Sources)))
|
|
|
|
ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
|
|
|
|
ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
|
|
|
|
ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
|
2004-10-23 20:04:14 +00:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# DIRECTORIES: Handle recursive descent of directory structure
|
|
|
|
###############################################################################
|
2003-07-31 20:58:51 +00:00
|
|
|
|
2004-10-28 09:15:28 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Provide rules to make install dirs. This must be early
|
|
|
|
# in the file so they get built before dependencies
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
|
|
|
$(bindir):
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(MKDIR) $(bindir)
|
2004-11-01 06:14:59 +00:00
|
|
|
|
2004-10-28 09:15:28 +00:00
|
|
|
$(libdir):
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(MKDIR) $(libdir)
|
2004-10-28 09:15:28 +00:00
|
|
|
|
|
|
|
$(bytecode_libdir):
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(MKDIR) $(bytecode_libdir)
|
2004-10-28 09:15:28 +00:00
|
|
|
|
|
|
|
$(sysconfdir):
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(MKDIR) $(sysconfdir)
|
2004-10-28 09:15:28 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
# To create other directories, as needed, and timestamp their creation
|
|
|
|
%/.dir:
|
|
|
|
$(Verb) $(MKDIR) $* > /dev/null
|
|
|
|
@$(DATE) > $@
|
|
|
|
|
|
|
|
.PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(LLVMLibDir)/.dir
|
|
|
|
.PRECIOUS: $(LLVMToolDir)/.dir
|
2004-10-28 09:15:28 +00:00
|
|
|
|
2001-06-06 20:29:01 +00:00
|
|
|
#---------------------------------------------------------
|
2004-10-23 20:04:14 +00:00
|
|
|
# Handle the DIRS options for sequential construction
|
2001-06-06 20:29:01 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
SubDirs :=
|
2002-09-18 04:29:30 +00:00
|
|
|
ifdef DIRS
|
2004-10-30 09:19:36 +00:00
|
|
|
SubDirs += $(DIRS)
|
|
|
|
$(RecursiveTargets)::
|
|
|
|
$(Verb) for dir in $(DIRS); do \
|
2004-10-22 21:01:56 +00:00
|
|
|
if [ ! -f $$dir/Makefile ]; then \
|
|
|
|
$(MKDIR) $$dir; \
|
|
|
|
cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
|
|
|
|
fi; \
|
2004-10-25 08:27:37 +00:00
|
|
|
($(MAKE) -C $$dir $@ ) || exit 1; \
|
2002-09-17 23:35:02 +00:00
|
|
|
done
|
2002-09-18 04:29:30 +00:00
|
|
|
endif
|
2002-09-18 03:22:27 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Handle the EXPERIMENTAL_DIRS options ensuring success
|
|
|
|
# after each directory is built.
|
|
|
|
#---------------------------------------------------------
|
|
|
|
ifdef EXPERIMENTAL_DIRS
|
2004-10-30 09:19:36 +00:00
|
|
|
$(RecursiveTargets)::
|
|
|
|
$(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
|
2004-10-23 20:04:14 +00:00
|
|
|
if [ ! -f $$dir/Makefile ]; then \
|
|
|
|
$(MKDIR) $$dir; \
|
|
|
|
cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
|
|
|
|
fi; \
|
2004-10-25 08:27:37 +00:00
|
|
|
($(MAKE) -C $$dir $@ ) || exit 0; \
|
2004-10-23 20:04:14 +00:00
|
|
|
done
|
|
|
|
endif
|
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Handle the PARALLEL_DIRS options for parallel construction
|
|
|
|
#---------------------------------------------------------
|
2002-09-18 03:22:27 +00:00
|
|
|
ifdef PARALLEL_DIRS
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
SubDirs += $(PARALLEL_DIRS)
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
# Unfortunately, this list must be maintained if new
|
|
|
|
# recursive targets are added.
|
2004-10-30 09:19:36 +00:00
|
|
|
all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
|
|
|
|
clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
|
2004-11-02 16:56:15 +00:00
|
|
|
clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
|
2004-10-30 09:19:36 +00:00
|
|
|
check :: $(addsuffix /.makecheck ,$(PARALLEL_DIRS))
|
|
|
|
install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
|
2004-10-23 20:04:14 +00:00
|
|
|
uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
|
2002-09-18 03:22:27 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
Parallel_Targets := $(foreach T,$(RecursiveTargets),%/.make$(T))
|
2004-10-23 20:04:14 +00:00
|
|
|
|
|
|
|
$(Parallel_Targets) :
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) if [ ! -f $(@D)/Makefile ]; then \
|
2004-10-22 21:01:56 +00:00
|
|
|
$(MKDIR) $(@D); \
|
|
|
|
cp $(BUILD_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
|
2003-11-25 19:32:22 +00:00
|
|
|
fi; \
|
2004-10-25 08:27:37 +00:00
|
|
|
$(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
|
2001-06-06 20:29:01 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Handle the OPTIONAL_DIRS options for directores that may
|
|
|
|
# or may not exist.
|
|
|
|
#---------------------------------------------------------
|
2003-06-27 16:58:44 +00:00
|
|
|
ifdef OPTIONAL_DIRS
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
SubDirs += $(OPTIONAL_DIRS)
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(RecursiveTargets)::
|
|
|
|
$(Verb) for dir in $(OPTIONAL_DIRS); do \
|
2004-10-22 21:01:56 +00:00
|
|
|
if [ -d $(BUILD_SRC_DIR)/$$dir ]; then\
|
|
|
|
if [ ! -f $$dir/Makefile ]; then \
|
|
|
|
$(MKDIR) $$dir; \
|
|
|
|
cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
|
|
|
|
fi; \
|
2004-10-25 08:27:37 +00:00
|
|
|
($(MAKE) -C$$dir $@ ) || exit 1; \
|
2004-10-22 21:01:56 +00:00
|
|
|
fi \
|
2003-06-27 16:58:44 +00:00
|
|
|
done
|
|
|
|
endif
|
|
|
|
|
2004-08-20 09:20:05 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Handle the CONFIG_FILES options
|
|
|
|
#---------------------------------------------------------
|
|
|
|
ifdef CONFIG_FILES
|
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
install-local:: $(sysconfdir) $(CONFIG_FILES)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Installing Configuration Files To $(sysconfdir)
|
|
|
|
$(Verb)for file in $(CONFIG_FILES); do \
|
2004-10-22 21:01:56 +00:00
|
|
|
$(INSTALL) $(BUILD_SRC_DIR)/$${file} $(sysconfdir) ; \
|
2004-08-20 09:20:05 +00:00
|
|
|
done
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
uninstall-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Uninstalling Configuration Files From $(sysconfdir)
|
|
|
|
$(Verb)for file in $(CONFIG_FILES); do \
|
2004-10-25 08:27:37 +00:00
|
|
|
$(RM) -f $(sysconfdir)/$${file} ; \
|
2004-10-24 07:53:21 +00:00
|
|
|
done
|
|
|
|
|
2004-08-20 09:20:05 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
###############################################################################
|
|
|
|
# Library Build Rules: Four ways to build a library
|
|
|
|
###############################################################################
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-01-22 22:53:48 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
# if we're building a library ...
|
2001-06-06 20:29:01 +00:00
|
|
|
ifdef LIBRARYNAME
|
2001-07-15 13:16:47 +00:00
|
|
|
|
2002-09-16 22:36:42 +00:00
|
|
|
# Make sure there isn't any extranous whitespace on the LIBRARYNAME option
|
2002-09-16 22:34:56 +00:00
|
|
|
LIBRARYNAME := $(strip $(LIBRARYNAME))
|
2004-10-30 09:19:36 +00:00
|
|
|
LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
|
|
|
|
LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
|
|
|
|
LibName.O := $(LibDir)/$(LIBRARYNAME).o
|
|
|
|
LibName.BC := $(LibDir)/lib$(LIBRARYNAME).bc
|
2002-09-16 22:34:56 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Shared Library Targets:
|
|
|
|
# If the user asked for a shared library to be built
|
|
|
|
# with the SHARED_LIBRARY variable, then we provide
|
|
|
|
# targets for building them.
|
|
|
|
#---------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
ifdef SHARED_LIBRARY
|
2003-08-15 02:18:35 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
all-local:: $(LibName.LA)
|
2002-08-02 18:34:12 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(LibName.LA): $(BUILT_SOURCES) $(ObjectsLO) $(LibDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(Link) -o $@ $(ObjectsLO)
|
|
|
|
$(Verb) $(LTInstall) $@ $(LibDir)
|
2004-10-23 20:04:14 +00:00
|
|
|
|
|
|
|
clean-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
ifneq ($(strip $(LibName.LA)),)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(LibName.LA)
|
2004-10-24 07:53:21 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
DestSharedLib = $(libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
|
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
install-local:: $(DestSharedLib)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(DestSharedLib): $(libdir) $(LibName.LA)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
|
|
|
|
$(Verb) $(LIBTOOL) --finish $(libdir)
|
2002-07-23 17:56:16 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
uninstall-local::
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(DestSharedLib)
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2002-07-23 17:56:16 +00:00
|
|
|
endif
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Bytecode Library Targets:
|
|
|
|
# If the user asked for a bytecode library to be built
|
|
|
|
# with the BYTECODE_LIBRARY variable, then we provide
|
|
|
|
# targets for building them.
|
|
|
|
#---------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
ifdef BYTECODE_LIBRARY
|
2003-06-30 21:59:07 +00:00
|
|
|
|
2003-08-15 02:18:35 +00:00
|
|
|
ifdef EXPORTED_SYMBOL_LIST
|
2004-10-22 21:01:56 +00:00
|
|
|
BCLinkLib += -Xlinker -internalize-public-api-list=$(EXPORTED_SYMBOL_LIST)
|
2003-08-15 02:18:35 +00:00
|
|
|
else
|
2003-09-15 15:06:54 +00:00
|
|
|
ifdef EXPORTED_SYMBOL_FILE
|
2004-10-22 21:01:56 +00:00
|
|
|
BCLinkLib += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
|
2003-09-15 15:06:54 +00:00
|
|
|
else
|
2004-10-22 21:01:56 +00:00
|
|
|
BCLinkLib += -Xlinker -disable-internalize
|
2003-09-15 15:06:54 +00:00
|
|
|
endif
|
2003-08-15 02:18:35 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
all-local:: $(LibName.BC)
|
2003-08-15 02:18:35 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(LibName.BC): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Linking $(BuildMode) Bytecode Library $(notdir $@)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(BCLinkLib) -o $@ $(ObjectsBC)
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
clean-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
ifneq ($(strip $(LibName.BC)),)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(LibName.BC)
|
2004-10-24 07:53:21 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
DestBytecodeLib = $(bytecode_libdir)/lib$(LIBRARYNAME).bc
|
2004-10-26 07:09:33 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
install-local:: $(DestBytecodeLib)
|
2002-09-20 14:03:13 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(DestBytecodeLib): $(bytecode_libdir) $(LibName.BC)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Installing $(BuildMode) Bytecode Library $(DestBytecodeLib)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(INSTALL) $(LibName.BC) $@
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
uninstall-local::
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Uninstalling $(BuildMode) Bytecode Library $(DestBytecodeLib)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(DestBytecodeLib)
|
2003-12-18 20:57:48 +00:00
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
endif
|
2003-08-15 02:18:35 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# ReLinked Library Targets:
|
|
|
|
# If the user didn't explicitly forbid building a
|
|
|
|
# relinked then we provide targets for building them.
|
|
|
|
#---------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
ifndef DONT_BUILD_RELINKED
|
2002-07-23 17:56:16 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
all-local:: $(LibName.O)
|
|
|
|
|
|
|
|
$(LibName.O): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Linking $(BuildMode) Object Library $(notdir $@)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(Relink) -o $@ $(ObjectsO)
|
2002-09-20 14:03:13 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
clean-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
ifneq ($(strip $(LibName.O)),)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(LibName.O)
|
2004-10-24 07:53:21 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
DestRelinkedLib = $(libdir)/$(LIBRARYNAME).o
|
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
install-local:: $(DestRelinkedLib)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(DestRelinkedLib): $(libdir) $(LibName.O)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
uninstall-local::
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(DestRelinkedLib)
|
2004-10-22 21:01:56 +00:00
|
|
|
|
|
|
|
endif
|
2003-12-18 20:57:48 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Archive Library Targets:
|
|
|
|
# If the user wanted a regular archive library built,
|
|
|
|
# then we provide targets for building them.
|
|
|
|
#---------------------------------------------------------
|
2004-10-22 21:01:56 +00:00
|
|
|
ifdef BUILD_ARCHIVE
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
all-local:: $(LibName.A)
|
|
|
|
|
|
|
|
$(LibName.A): $(BUILT_SOURCES) $(ObjectsO) $(LibDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Building $(BuildMode) Archive Library $(notdir $@)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $@
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(Archive) $@ $(ObjectsO)
|
|
|
|
$(Verb) $(Ranlib) $@
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
clean-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
ifneq ($(strip $(LibName.A)),)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(LibName.A)
|
2004-10-24 07:53:21 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
DestArchiveLib := $(libdir)/lib$(LIBRARYNAME).a
|
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
install-local:: $(DestArchiveLib)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(DestArchiveLib): $(libdir) $(LibName.A)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(MKDIR) $(libdir)
|
|
|
|
$(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
uninstall-local::
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(DestArchiveLib)
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2001-06-06 20:29:01 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-24 07:53:21 +00:00
|
|
|
# endif LIBRARYNAME
|
2004-10-22 21:01:56 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-24 08:21:04 +00:00
|
|
|
###############################################################################
|
|
|
|
# Tool Build Rules: Build executable tool based on TOOLNAME option
|
|
|
|
###############################################################################
|
|
|
|
|
2001-09-07 22:57:58 +00:00
|
|
|
ifdef TOOLNAME
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Set up variables for building a tool.
|
|
|
|
#---------------------------------------------------------
|
|
|
|
ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
|
|
|
|
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))
|
2003-05-29 16:18:20 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Handle optional compression libraries automatically
|
|
|
|
#---------------------------------------------------------
|
|
|
|
ExtraLibs := $(LIBS)
|
2004-10-22 21:01:56 +00:00
|
|
|
ifeq ($(HAVE_BZIP2),1)
|
2004-10-30 09:19:36 +00:00
|
|
|
ExtraLibs += -lbz2
|
2004-10-22 21:01:56 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(HAVE_ZLIB),1)
|
2004-10-30 09:19:36 +00:00
|
|
|
ExtraLibs += -lz
|
2004-10-22 21:01:56 +00:00
|
|
|
endif
|
2003-05-29 16:18:20 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Tell make that we need to rebuild subdirectories before
|
|
|
|
# we can link the tool. This affects things like LLI which
|
|
|
|
# has library subdirectories.
|
|
|
|
#---------------------------------------------------------
|
|
|
|
$(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS))
|
2003-01-22 16:13:31 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Provide targets for building the tools
|
|
|
|
#---------------------------------------------------------
|
|
|
|
all-local:: $(ToolBuildPath)
|
2003-06-27 16:58:44 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
clean-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
ifneq ($(strip $(ToolBuildPath)),)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(ToolBuildPath)
|
2004-10-24 07:53:21 +00:00
|
|
|
endif
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(ToolBuildPath): $(BUILT_SOURCES) $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)\
|
|
|
|
$(ToolDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
|
|
|
|
$(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
|
|
|
DestTool = $(bindir)/$(TOOLNAME)
|
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
install-local:: $(DestTool)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(DestTool): $(bindir) $(ToolBuildPath)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Installing $(BuildMode) $(DestTool)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(INSTALL) $(ToolBuildPath) $(DestTool)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-28 07:57:28 +00:00
|
|
|
uninstall-local::
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) Uninstalling $(BuildMode) $(DestTool)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(DestTool)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
###############################################################################
|
|
|
|
# Object Build Rules: Build object files based on sources
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
# Provide rule sets for when dependency generation is enabled
|
2004-10-22 21:01:56 +00:00
|
|
|
ifndef DISABLE_AUTO_DEPENDENCIES
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Create .lo files in the ObjDir directory from the .cpp and .c files...
|
|
|
|
#---------------------------------------------------------
|
2004-10-23 20:04:14 +00:00
|
|
|
ifdef SHARED_LIBRARY
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
|
2004-10-30 09:19:36 +00:00
|
|
|
$(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
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build (PIC)"
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
|
|
|
|
then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
|
|
|
|
else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
|
2004-10-23 20:04:14 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Create .o files in the ObjDir directory from the .cpp and .c files...
|
|
|
|
#---------------------------------------------------------
|
2004-10-23 20:04:14 +00:00
|
|
|
else
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build"
|
2004-10-30 09:19:36 +00:00
|
|
|
$(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
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(ObjDir)/%.o: %.c $(ObjDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build"
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \
|
|
|
|
then $(MV) -f "$(ObjDir)/$*.Cd" "$(ObjDir)/$*.d"; \
|
|
|
|
else $(RM) -f "$(ObjDir)/$*.Cd"; exit 1; fi
|
2004-10-23 20:04:14 +00:00
|
|
|
|
|
|
|
endif
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Create .bc files in the ObjDir directory from .cpp and .c files...
|
|
|
|
#---------------------------------------------------------
|
|
|
|
$(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
|
2004-10-30 09:19:36 +00:00
|
|
|
$(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
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \
|
|
|
|
then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
|
|
|
|
else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
|
|
|
|
|
|
|
|
# Provide alternate rule sets if dependencies are disabled
|
2004-10-22 21:01:56 +00:00
|
|
|
else
|
2001-09-07 22:57:58 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
ifdef SHARED_LIBRARY
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
|
2004-10-23 20:04:14 +00:00
|
|
|
$(LTCompile.CXX) $< -o $@
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)"
|
2004-10-23 20:04:14 +00:00
|
|
|
$(LTCompile.C) $< -o $@
|
|
|
|
|
|
|
|
else
|
2001-09-07 22:57:58 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build"
|
2004-10-23 20:04:14 +00:00
|
|
|
$(Compile.CXX) $< -o $@
|
2002-09-20 14:03:13 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(ObjDir)/%.o: %.c $(ObjDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build"
|
2004-10-23 20:04:14 +00:00
|
|
|
$(Compile.C) $< -o $@
|
|
|
|
endif
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
|
2004-10-31 18:52:15 +00:00
|
|
|
$(BCCompile.CXX) $< -o $@
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(ObjDir)/%.bc: %.c $(ObjDir)/.dir
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
|
2004-10-31 18:52:15 +00:00
|
|
|
$(BCCompile.C) $< -o $@
|
2003-12-10 00:26:28 +00:00
|
|
|
|
2001-09-07 22:57:58 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Provide rule to build .bc files from .ll sources,
|
|
|
|
# regardless of dependencies
|
|
|
|
#---------------------------------------------------------
|
|
|
|
$(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "Compiling $*.ll for $(BuildMode) build"
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(LLVMAS) $< -f -o $@
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# TABLEGEN: Provide rules for running tblgen to produce *.inc files
|
|
|
|
###############################################################################
|
2001-09-07 22:57:58 +00:00
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
ifdef TARGET
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
TDFiles := $(strip $(wildcard $(BUILD_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td)
|
|
|
|
INCFiles := $(filter %.inc,$(BUILT_SOURCES))
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
$(INCFiles) : $(TBLGEN) $(TDFiles)
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-27 04:34:35 +00:00
|
|
|
%GenRegisterNames.inc : %.td
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) register names with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-register-enums -o $@ $<
|
2001-07-15 13:16:47 +00:00
|
|
|
|
2004-10-27 04:34:35 +00:00
|
|
|
%GenRegisterInfo.h.inc : %.td
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) register information header with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
|
2002-09-20 14:03:13 +00:00
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
%GenRegisterInfo.inc : %.td
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) register info implementation with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-register-desc -o $@ $<
|
2002-09-22 02:47:15 +00:00
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
%GenInstrNames.inc : %.td
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) instruction names with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-instr-enums -o $@ $<
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
%GenInstrInfo.inc : %.td
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) instruction information with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-instr-desc -o $@ $<
|
2003-06-30 21:59:07 +00:00
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
%GenAsmWriter.inc : %.td
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) assembly writer with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-asm-writer -o $@ $<
|
2003-08-15 02:18:35 +00:00
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
%GenATTAsmWriter.inc : %.td
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) AT&T assembly writer with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-asm-writer -o $@ $<
|
2003-08-15 02:18:35 +00:00
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
%GenIntelAsmWriter.inc : %.td
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) Intel assembly writer with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
|
2004-10-22 21:01:56 +00:00
|
|
|
|
|
|
|
%GenInstrSelector.inc: %.td
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) instruction selector with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-instr-selector -o $@ $<
|
2003-08-15 02:18:35 +00:00
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
%GenCodeEmitter.inc:: %.td
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Building $(<F) code emitter with tblgen"
|
|
|
|
$(Verb) $(TableGen) -gen-emitter -o $@ $<
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
clean-local::
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(INCFiles)
|
2004-10-22 21:01:56 +00:00
|
|
|
|
|
|
|
endif
|
2003-08-15 02:18:35 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
###############################################################################
|
|
|
|
# LEX AND YACC: Provide rules for generating sources with lex and yacc
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Provide rules for generating a .cpp source file from
|
|
|
|
# (f)lex input sources.
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
2004-11-02 16:36:03 +00:00
|
|
|
LexFiles := $(filter %.l,$(Sources))
|
2004-10-30 09:19:36 +00:00
|
|
|
|
2004-11-02 16:36:03 +00:00
|
|
|
ifneq ($(LexFiles),)
|
|
|
|
|
|
|
|
LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
|
2004-10-30 09:19:36 +00:00
|
|
|
|
|
|
|
.PRECIOUS: $(LexOutput)
|
|
|
|
|
|
|
|
# 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
|
|
|
|
# being able to resize the buffer on a large token input. Currently, for
|
|
|
|
# uninitialized string buffers in LLVM we can generate very long tokens, so
|
|
|
|
# this is a hack around it.
|
2003-08-15 20:00:47 +00:00
|
|
|
# FIXME. (f.e. char Buffer[10000] )
|
2001-06-06 20:29:01 +00:00
|
|
|
%.cpp: %.l
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Flexing $<
|
|
|
|
$(Verb) $(FLEX) -t $< | \
|
2004-10-22 21:01:56 +00:00
|
|
|
$(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)/' \
|
2004-10-28 00:41:43 +00:00
|
|
|
> $@
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-11-01 07:50:27 +00:00
|
|
|
clean-local::
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(LexOutput)
|
2004-11-02 16:36:03 +00:00
|
|
|
$(Verb) $(RM) -f $(LexOutput)
|
2004-11-01 07:50:27 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Provide rules for generating a .cpp and .h source files
|
|
|
|
# from yacc (bison) input sources.
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
2004-11-02 16:36:03 +00:00
|
|
|
YaccFiles := $(filter %.y,$(Sources))
|
|
|
|
ifneq ($(YaccFiles),)
|
|
|
|
YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
|
2004-10-30 09:19:36 +00:00
|
|
|
|
|
|
|
.PRECIOUS: $(YaccOutput)
|
|
|
|
|
|
|
|
# Cancel built-in rules for yacc
|
|
|
|
%.c: %.y
|
|
|
|
%.cpp: %.y
|
|
|
|
%.h: %.y
|
|
|
|
|
2001-06-06 20:29:01 +00:00
|
|
|
# Rule for building the bison parsers...
|
|
|
|
%.cpp %.h : %.y
|
2004-10-30 09:19:36 +00:00
|
|
|
$(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
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-11-01 07:50:27 +00:00
|
|
|
clean-local::
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f $(YaccOutput)
|
2004-11-02 16:36:03 +00:00
|
|
|
$(Verb) $(RM) -f $(YaccOutput)
|
2004-10-30 09:19:36 +00:00
|
|
|
endif
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
###############################################################################
|
|
|
|
# OTHER RULES: Other rules needed
|
|
|
|
###############################################################################
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2003-01-16 21:06:18 +00:00
|
|
|
# To create postscript files from dot files...
|
2003-10-02 19:02:02 +00:00
|
|
|
ifneq ($(DOT),false)
|
2003-06-30 21:59:07 +00:00
|
|
|
%.ps: %.dot
|
2004-10-22 21:01:56 +00:00
|
|
|
$(DOT) -Tps < $< > $@
|
2003-06-30 21:59:07 +00:00
|
|
|
else
|
2003-01-16 21:06:18 +00:00
|
|
|
%.ps: %.dot
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "Cannot build $@: The program dot is not installed"
|
2003-06-30 21:59:07 +00:00
|
|
|
endif
|
2003-01-16 21:06:18 +00:00
|
|
|
|
2003-09-06 14:44:17 +00:00
|
|
|
# This rules ensures that header files that are removed still have a rule for
|
|
|
|
# which they can be "generated." This allows make to ignore them and
|
|
|
|
# reproduce the dependency lists.
|
2003-09-18 18:37:08 +00:00
|
|
|
%.h:: ;
|
2003-09-06 14:44:17 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
# Define clean-local to clean the current directory. Note that this uses a
|
|
|
|
# very conservative approach ensuring that empty variables do not cause
|
|
|
|
# errors or disastrous removal.
|
2004-10-23 20:04:14 +00:00
|
|
|
clean-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
ifneq ($(strip $(ObjDir)),)
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -rf $(ObjDir)
|
2004-10-24 07:53:21 +00:00
|
|
|
endif
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
|
2004-01-21 19:53:11 +00:00
|
|
|
ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -f *$(SHLIBEXT)
|
2004-01-21 19:53:11 +00:00
|
|
|
endif
|
2003-06-30 21:59:07 +00:00
|
|
|
|
2004-11-02 16:36:03 +00:00
|
|
|
clean-all-local::
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -rf Debug Release Profile
|
2004-11-02 16:36:03 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
# Build tags database for Emacs/Xemacs:
|
|
|
|
tags:: TAGS
|
|
|
|
TAGS:
|
|
|
|
find include lib tools examples -name '*.cpp' -o -name '*.h' | \
|
|
|
|
$(ETAGS) $(ETAGSFLAGS) -
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
###############################################################################
|
|
|
|
# DEPENDENCIES: Include the dependency files if we should
|
|
|
|
###############################################################################
|
2003-08-22 14:10:16 +00:00
|
|
|
ifndef DISABLE_AUTO_DEPENDENCIES
|
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
# If its not one of the cleaning targets
|
2004-10-30 09:19:36 +00:00
|
|
|
ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
|
2003-05-15 21:28:55 +00:00
|
|
|
|
2004-10-23 20:04:14 +00:00
|
|
|
# Get the list of dependency files
|
2004-10-30 09:19:36 +00:00
|
|
|
DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
|
2004-11-01 07:50:27 +00:00
|
|
|
DependFiles := $(patsubst %,$(BUILD_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
|
2004-10-23 20:04:14 +00:00
|
|
|
|
|
|
|
-include /dev/null $(DependFiles)
|
2003-11-09 21:36:19 +00:00
|
|
|
|
2003-08-12 18:51:51 +00:00
|
|
|
endif
|
2003-08-18 17:27:40 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
endif
|
2004-10-22 21:01:56 +00:00
|
|
|
|
2004-10-24 07:53:21 +00:00
|
|
|
###############################################################################
|
2004-10-30 09:19:36 +00:00
|
|
|
# DISTRIBUTION: Handle construction of a distribution tarball
|
2004-10-24 07:53:21 +00:00
|
|
|
###############################################################################
|
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Define distribution related variables
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
DistName := $(LLVM_TARBALL_NAME)
|
|
|
|
DistDir := $(BUILD_OBJ_ROOT)/$(DistName)
|
|
|
|
TopDistDir := $(BUILD_OBJ_ROOT)/$(DistName)
|
|
|
|
DistTarGZip := $(BUILD_OBJ_ROOT)/$(DistName).tar.gz
|
|
|
|
DistZip := $(BUILD_OBJ_ROOT)/$(DistName).zip
|
|
|
|
DistTarBZ2 := $(BUILD_OBJ_ROOT)/$(DistName).tar.bz2
|
|
|
|
DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
|
|
|
|
ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
|
|
|
|
Makefile.config.in configure autoconf
|
|
|
|
DistOther := $(notdir $(wildcard \
|
|
|
|
$(BUILD_SRC_DIR)/*.h \
|
|
|
|
$(BUILD_SRC_DIR)/*.td \
|
|
|
|
$(BUILD_SRC_DIR)/*.def \
|
|
|
|
$(BUILD_SRC_DIR)/*.ll \
|
|
|
|
$(BUILD_SRC_DIR)/*.in))
|
2004-10-30 09:19:36 +00:00
|
|
|
DistSources := $(Sources) $(EXTRA_DIST)
|
|
|
|
DistSubDirs := $(SubDirs)
|
2004-10-26 07:09:33 +00:00
|
|
|
DistFiles := $(DistAlways) $(DistSources) $(DistOther)
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# We MUST build distribution with OBJ_DIR != SRC_DIR
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
ifeq ($(BUILD_SRC_DIR),$(BUILD_OBJ_DIR))
|
2004-10-25 08:27:37 +00:00
|
|
|
dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
DistCheckTop :=
|
2004-10-25 08:27:37 +00:00
|
|
|
else
|
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
DistCheckTop := check
|
2004-10-30 09:19:36 +00:00
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Prevent catastrophic remove
|
|
|
|
#------------------------------------------------------------------------
|
2004-10-25 08:27:37 +00:00
|
|
|
ifeq ($(LLVM_TARBALL_NAME),)
|
2004-10-26 02:58:10 +00:00
|
|
|
$(error LLVM_TARBALL_NAME is empty. Please rerun configure)
|
2004-10-25 08:27:37 +00:00
|
|
|
endif
|
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Prevent attempt to run dist targets from anywhere but the top level
|
|
|
|
#------------------------------------------------------------------------
|
2004-10-25 08:27:37 +00:00
|
|
|
ifneq ($(LEVEL),.)
|
|
|
|
|
|
|
|
dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) ERROR: You must run $@ from $(BUILD_OBJ_ROOT)
|
2004-10-25 08:27:37 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Provide the top level targets
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
dist-gzip:: $(DistTarGZip)
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
$(DistTarGZip) : distdir
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Packing gzipped distribution tar file.
|
|
|
|
$(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | gzip -c > "$(DistTarGZip)"
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
dist-bzip2:: $(DistTarBZ2)
|
2004-10-26 07:09:33 +00:00
|
|
|
|
|
|
|
$(DistTarBZ2) : distdir
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Packing bzipped distribution tar file.
|
|
|
|
$(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - $(DistName) | $(BZIP2) -c >$(DistTarBZ2)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
dist-zip:: $(DistZip)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
$(DistZip) : distdir
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Packing zipped distribution file.
|
|
|
|
$(Verb) rm -f $(DistZip)
|
|
|
|
$(Verb) cd $(BUILD_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
|
2004-10-26 07:09:33 +00:00
|
|
|
|
|
|
|
dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
DistCheckDir := $(LLVM_OBJ_ROOT)/_distcheckdir
|
|
|
|
|
2004-10-26 22:26:33 +00:00
|
|
|
dist-check:: $(DistCheckTop) $(DistTarGZip)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Checking distribution tar file.
|
|
|
|
$(Verb) if test -d $(DistCheckDir) ; then \
|
2004-10-26 07:09:33 +00:00
|
|
|
$(RM) -rf $(DistCheckDir) ; \
|
|
|
|
fi
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(MKDIR) $(DistCheckDir)
|
|
|
|
$(Verb) cd $(DistCheckDir) && \
|
2004-10-26 07:09:33 +00:00
|
|
|
$(MKDIR) $(DistCheckDir)/build && \
|
|
|
|
$(MKDIR) $(DistCheckDir)/install && \
|
|
|
|
gunzip -c $(DistTarGZip) | $(TAR) xf - && \
|
|
|
|
cd build && \
|
|
|
|
../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
|
|
|
|
--srcdir=../$(DistName) --with-llvmgccdir="$(LLVMGCCDIR)" && \
|
|
|
|
$(MAKE) check && \
|
|
|
|
$(MAKE) install && \
|
|
|
|
$(MAKE) uninstall && \
|
|
|
|
$(MAKE) dist && \
|
|
|
|
$(MAKE) clean && \
|
|
|
|
$(MAKE) dist-clean && \
|
2004-10-30 09:19:36 +00:00
|
|
|
$(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
|
2004-10-25 08:27:37 +00:00
|
|
|
|
|
|
|
dist-clean::
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Cleaning distribution files
|
2004-11-02 16:56:15 +00:00
|
|
|
-$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) $(DistCheckDir)
|
2004-10-25 08:27:37 +00:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
2004-10-26 07:09:33 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Provide the recursive distdir target for building the distribution directory
|
|
|
|
#------------------------------------------------------------------------
|
2004-10-26 22:26:33 +00:00
|
|
|
distdir : $(DistSources)
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Building Distribution Directory $(DistDir)
|
|
|
|
$(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
|
2004-10-26 07:09:33 +00:00
|
|
|
if test -d "$(DistDir)" ; then \
|
|
|
|
find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
|
|
|
|
exit 1 ; \
|
|
|
|
fi ; \
|
2004-10-30 09:19:36 +00:00
|
|
|
$(EchoCmd) Removing $(DistDir) ; \
|
2004-10-26 07:09:33 +00:00
|
|
|
$(RM) -rf $(DistDir); \
|
|
|
|
fi
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(MKDIR) $(DistDir)
|
|
|
|
$(Verb) srcdirstrip=`echo "$(BUILD_SRC_DIR)" | sed 's|.|.|g'`; \
|
2004-10-25 08:27:37 +00:00
|
|
|
srcrootstrip=`echo "$(BUILD_SRC_ROOT)" | sed 's|.|.|g'`; \
|
|
|
|
for file in $(DistFiles) ; do \
|
|
|
|
case "$$file" in \
|
|
|
|
$(BUILD_SRC_DIR)/*) file=`echo "$$file" | sed "s#^$$srcdirstrip/##"`;; \
|
2004-10-26 07:09:33 +00:00
|
|
|
$(BUILD_SRC_ROOT)/*) file=`echo "$$file" | sed "s#^$$srcrootstrip/#$(BUILD_OBJ_ROOT)/#"`;; \
|
2004-10-25 08:27:37 +00:00
|
|
|
esac; \
|
|
|
|
if test -f "$$file" || test -d "$$file" ; then \
|
|
|
|
from_dir=. ; \
|
|
|
|
else \
|
|
|
|
from_dir=$(BUILD_SRC_DIR); \
|
|
|
|
fi; \
|
|
|
|
to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'`; \
|
|
|
|
if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
|
|
|
|
to_dir="$(DistDir)/$$dir"; \
|
|
|
|
$(MKDIR) "$$to_dir" ; \
|
|
|
|
else \
|
|
|
|
to_dir="$(DistDir)"; \
|
|
|
|
fi; \
|
|
|
|
mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
|
|
|
|
if test -n "$$mid_dir" ; then \
|
2004-10-26 07:09:33 +00:00
|
|
|
$(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
|
2004-10-25 08:27:37 +00:00
|
|
|
fi ; \
|
|
|
|
if test -d "$$from_dir/$$file"; then \
|
|
|
|
if test -d "$(BUILD_SRC_DIR)/$$file" && \
|
|
|
|
test "$$from_dir" != "$(BUILD_SRC_DIR)" ; then \
|
|
|
|
cp -pR "$(BUILD_SRC_DIR)/$$file" "$$to_dir" || exit 1; \
|
|
|
|
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 \
|
|
|
|
cp -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
|
|
|
|
elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
|
2004-10-30 09:19:36 +00:00
|
|
|
$(EchoCmd) "===== WARNING: Distribution Source $$from_dir/$$file Not Found!" ; \
|
|
|
|
elif test "$(Verb)" != '@' ; then \
|
|
|
|
$(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
|
2004-10-25 08:27:37 +00:00
|
|
|
fi; \
|
|
|
|
done
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) for subdir in $(DistSubDirs) ; do \
|
2004-10-25 08:27:37 +00:00
|
|
|
if test "$$subdir" \!= "." ; then \
|
|
|
|
new_distdir="$(DistDir)/$$subdir" ; \
|
2004-10-26 07:09:33 +00:00
|
|
|
test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
|
|
|
|
( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || exit 1; \
|
2004-10-25 08:27:37 +00:00
|
|
|
fi; \
|
|
|
|
done
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Verb) $(MAKE) DistDir="$(DistDir)" dist-hook || exit 1
|
|
|
|
-$(Verb) find $(DistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|
2004-10-25 08:27:37 +00:00
|
|
|
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
|
|
|
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
|
|
|
! -type d ! -perm -444 -exec $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
|
|
|
|
|| chmod -R a+r $(DistDir)
|
|
|
|
|
2004-10-30 09:19:36 +00:00
|
|
|
# This is invoked by distdir target, define it as a no-op to avoid errors if not
|
|
|
|
# defined by user.
|
2004-10-25 08:27:37 +00:00
|
|
|
dist-hook::
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# TOP LEVEL - targets only to apply at the top level directory
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
ifeq ($(LEVEL),.)
|
2004-10-24 07:53:21 +00:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Install support for project's include files:
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
install-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Installing include files
|
|
|
|
$(Verb) $(MKDIR) $(includedir)
|
|
|
|
$(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
|
2004-10-24 07:53:21 +00:00
|
|
|
cd $(BUILD_SRC_ROOT)/include && \
|
|
|
|
find . -path '*/Internal' -prune -o '(' -type f \
|
|
|
|
'!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
|
|
|
|
-print ')' | grep -v CVS | pax -rwdvpe $(includedir) ; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
uninstall-local::
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Uninstalling include files
|
|
|
|
$(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
|
2004-10-24 07:53:21 +00:00
|
|
|
cd $(BUILD_SRC_ROOT)/include && \
|
|
|
|
$(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
|
|
|
|
'!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' ')' \
|
|
|
|
-print ')' | grep -v CVS | sed 's#^#$(includedir)/#'` ; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2004-10-22 21:01:56 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Print out the directories used for building
|
2004-10-30 09:19:36 +00:00
|
|
|
#------------------------------------------------------------------------
|
2004-10-23 20:04:14 +00:00
|
|
|
printvars::
|
2004-11-01 07:50:27 +00:00
|
|
|
$(Echo) "BuildMode : " '$(BuildMode)'
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) "BUILD_SRC_ROOT : " '$(BUILD_SRC_ROOT)'
|
|
|
|
$(Echo) "BUILD_SRC_DIR : " '$(BUILD_SRC_DIR)'
|
|
|
|
$(Echo) "BUILD_OBJ_ROOT : " '$(BUILD_OBJ_ROOT)'
|
|
|
|
$(Echo) "BUILD_OBJ_DIR : " '$(BUILD_OBJ_DIR)'
|
|
|
|
$(Echo) "LLVM_SRC_ROOT : " '$(LLVM_SRC_ROOT)'
|
|
|
|
$(Echo) "LLVM_OBJ_ROOT : " '$(LLVM_OBJ_ROOT)'
|
|
|
|
$(Echo) "libdir : " '$(libdir)'
|
|
|
|
$(Echo) "bindir : " '$(bindir)'
|
|
|
|
$(Echo) "sysconfdir : " '$(sysconfdir)'
|
|
|
|
$(Echo) "bytecode_libdir: " '$(bytecode_libdir)'
|
|
|
|
$(Echo) "UserTargets : " '$(UserTargets)'
|
|
|
|
$(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
|
|
|
|
$(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
|
|
|
|
$(Echo) "ObjDir : " '$(ObjDir)'
|
|
|
|
$(Echo) "LibDir : " '$(LibDir)'
|
|
|
|
$(Echo) "ToolDir : " '$(ToolDir)'
|
|
|
|
$(Echo) "TDFiles : " '$(TDFiles)'
|
|
|
|
$(Echo) "INCFiles : " '$(INCFiles)'
|
|
|
|
$(Echo) "Compile.CXX : " '$(Compile.CXX)'
|
|
|
|
$(Echo) "Compile.C : " '$(Compile.C)'
|
|
|
|
$(Echo) "Archive : " '$(Archive)'
|
2004-11-02 16:36:03 +00:00
|
|
|
$(Echo) "YaccFiles : " '$(YaccFiles)'
|
|
|
|
$(Echo) "LexFiles : " '$(LexFiles)'
|