Newer
Older
$(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
$(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
$(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
-name '*.cpp' -o -name '*.h' | \
$(ETAGS) $(ETAGSFLAGS) -
CTAGS:
find $(BUILD_SRC_ROOT)/include $(BUILD_SRC_ROOT)/lib \
$(BUILD_SRC_ROOT)/tools $(BUILD_SRC_ROOT)/examples \
$(BUILD_OBJ_ROOT)/include $(BUILD_OBJ_ROOT)/lib \
$(BUILD_OBJ_ROOT)/tools $(BUILD_OBJ_ROOT)/examples \
\( -name '*.cpp' -o -name '*.h' \) -print | \
ctags -ImtT -o $(BUILD_OBJ_ROOT)/CTAGS -L -
###############################################################################
# DEPENDENCIES: Include the dependency files if we should
###############################################################################
ifndef DISABLE_AUTO_DEPENDENCIES
ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
DependFiles := $(patsubst %,$(BUILD_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
Misha Brukman
committed
endif
endif
###############################################################################
# DISTRIBUTION: Handle construction of a distribution tarball
###############################################################################
#------------------------------------------------------------------------
# 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))
DistSubDirs := $(SubDirs)
DistSources = $(Sources) $(EXTRA_DIST)
DistFiles = $(DistAlways) $(DistSources) $(DistOther)
#------------------------------------------------------------------------
# We MUST build distribution with OBJ_DIR != SRC_DIR
#------------------------------------------------------------------------
ifeq ($(BUILD_SRC_DIR),$(BUILD_OBJ_DIR))
dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
$(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
DistCheckTop :=
DistCheckTop := check
#------------------------------------------------------------------------
# Prevent catastrophic remove
#------------------------------------------------------------------------
$(error LLVM_TARBALL_NAME is empty. Please rerun configure)
#------------------------------------------------------------------------
# Prevent attempt to run dist targets from anywhere but the top level
#------------------------------------------------------------------------
ifneq ($(LEVEL),.)
dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
$(Echo) ERROR: You must run $@ from $(BUILD_OBJ_ROOT)
#------------------------------------------------------------------------
# Provide the top level targets
#------------------------------------------------------------------------
dist-gzip:: $(DistTarGZip)
$(DistTarGZip) : distdir
$(Echo) Packing gzipped distribution tar file.
$(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
$(GZIP) -c > "$(DistTarGZip)"
dist-bzip2:: $(DistTarBZ2)
$(DistTarBZ2) : distdir
$(Echo) Packing bzipped distribution tar file.
$(Verb) cd $(BUILD_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
$(BZIP2) -c >$(DistTarBZ2)
dist-zip:: $(DistZip)
$(DistZip) : distdir
$(Echo) Packing zipped distribution file.
$(Verb) rm -f $(DistZip)
$(Verb) cd $(BUILD_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
$(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
DistCheckDir := $(LLVM_OBJ_ROOT)/_distcheckdir
$(Echo) Checking distribution tar file.
$(Verb) if test -d $(DistCheckDir) ; then \
$(RM) -rf $(DistCheckDir) ; \
fi
$(Verb) $(MKDIR) $(DistCheckDir)
$(Verb) cd $(DistCheckDir) && \
$(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 && \
$(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
$(Echo) Cleaning distribution files
-$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) $(DistCheckDir)
#------------------------------------------------------------------------
# Provide the recursive distdir target for building the distribution directory
#------------------------------------------------------------------------
$(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
if test -d "$(DistDir)" ; then \
find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
exit 1 ; \
fi ; \
$(EchoCmd) Removing $(DistDir) ; \
$(RM) -rf $(DistDir); \
fi
$(Echo) Building Distribution Directory $(DistDir)
$(Verb) $(MKDIR) $(DistDir)
$(Verb) srcdirstrip=`echo "$(BUILD_SRC_DIR)" | sed 's|.|.|g'`; \
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/##"`;; \
$(BUILD_SRC_ROOT)/*) file=`echo "$$file" | sed "s#^$$srcrootstrip/#$(BUILD_OBJ_ROOT)/#"`;; \
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 \
$(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
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 \
$(EchoCmd) "===== WARNING: Distribution Source $$from_dir/$$file Not Found!" ; \
elif test "$(Verb)" != '@' ; then \
$(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
$(Verb) for subdir in $(DistSubDirs) ; do \
if test "$$subdir" \!= "." ; then \
new_distdir="$(DistDir)/$$subdir" ; \
test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || exit 1; \
$(Verb) $(MAKE) DistDir="$(DistDir)" dist-hook || exit 1
-$(Verb) find $(DistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -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)
# This is invoked by distdir target, define it as a no-op to avoid errors if not
# defined by user.
dist-hook::
endif
###############################################################################
# TOP LEVEL - targets only to apply at the top level directory
###############################################################################
ifeq ($(LEVEL),.)
#------------------------------------------------------------------------
# Install support for project's include files:
#------------------------------------------------------------------------
install-local::
$(Echo) Installing include files
$(Verb) $(MKDIR) $(includedir)
$(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
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::
$(Echo) Uninstalling include files
$(Verb) if [ -d "$(BUILD_SRC_ROOT)/include" ] ; then \
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
#------------------------------------------------------------------------
# Print out the directories used for building
#------------------------------------------------------------------------
$(Echo) "BuildMode : " '$(BuildMode)'
$(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)'
$(Echo) "YaccFiles : " '$(YaccFiles)'
$(Echo) "LexFiles : " '$(LexFiles)'