mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
New Makefile Features:
* "dist" target now builds tar.gz, tar.bz2, and zip files suitable for distribution. "dist" can only be run from $(BUILD_OBJ_ROOT) and implies a "check". * made the preconditions not do a recursive make and ensured that they are executed sequentially. * made the messages output by the makefile be prefixed with "llvm" and the make level (e.g. llvm[1]: ) in the same way that make does so that the messages are uniform and more readable. * Fixed the tags target so that tags depends on TAGS which contains the rules to build a file named TAGS * Implemented the EXTRA_DIST feature in a few directories to make sure it works. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17210 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
11
Makefile
11
Makefile
@@ -9,13 +9,24 @@
|
||||
LEVEL = .
|
||||
DIRS = lib/System lib/Support utils lib tools
|
||||
|
||||
|
||||
ifneq ($(MAKECMDGOALS),tools-only)
|
||||
DIRS += runtime
|
||||
OPTIONAL_DIRS = examples projects
|
||||
endif
|
||||
|
||||
EXTRA_DIST := llvm.spec include configure \
|
||||
autoconf/AutoRegen.sh autoconf/LICENSE.TXT autoconf/README.TXT \
|
||||
autoconf/aclocal.m4 autoconf/config.guess autoconf/config.sub \
|
||||
autoconf/configure.ac autoconf/depcomp autoconf/install-sh \
|
||||
autoconf/ltmain.sh autoconf/missing autoconf/mkinstalldirs \
|
||||
autoconf/m4
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
||||
dist-hook::
|
||||
@$(ECHO) Eliminating CVS directories from distribution
|
||||
$(VERB) rm -rf `find $(TopDistDir) -type d -name CVS -print`
|
||||
|
||||
test :: all
|
||||
cd test; $(MAKE)
|
||||
|
||||
|
@@ -40,24 +40,29 @@ TOOLLINKOPTS=@LIBS@
|
||||
# Path to the library archiver program.
|
||||
AR_PATH = @AR@
|
||||
|
||||
# The pathnames of the Flex and Bison programs, respectively.
|
||||
# The pathnames of the programs we require to build
|
||||
YACC = @YACC@
|
||||
BISON = @BISON@
|
||||
FLEX = @LEX@
|
||||
|
||||
# Paths to miscellaneous programs.
|
||||
RPWD = pwd
|
||||
SED = sed
|
||||
RM = rm
|
||||
ECHO = echo
|
||||
MKDIR = @abs_top_srcdir@/autoconf/mkinstalldirs
|
||||
DATE = date
|
||||
MV = mv
|
||||
TAR = @TAR@
|
||||
INSTALL = @INSTALL@
|
||||
DOT = @DOT@
|
||||
ETAGS = @ETAGS@
|
||||
ETAGSFLAGS = @ETAGSFLAGS@
|
||||
|
||||
# Paths to miscellaneous programs we assume are present
|
||||
RPWD = pwd
|
||||
SED = sed
|
||||
RM = rm
|
||||
ECHO = echo "llvm["$(MAKELEVEL)"]:"
|
||||
MKDIR = @abs_top_srcdir@/autoconf/mkinstalldirs
|
||||
INSTALL_SH = $(BUILD_SRC_ROOT)/autoconf/install-sh
|
||||
DATE = date
|
||||
MV = mv
|
||||
GZIP = gzip
|
||||
ZIP = zip
|
||||
BZIP2 = bzip2
|
||||
|
||||
# Determine the target for which LLVM should generate code.
|
||||
LLVMGCCARCH := @target@/3.4-llvm
|
||||
|
||||
@@ -173,4 +178,5 @@ mandir = @mandir@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
LLVM_TARBALL_NAME = @PACKAGE_NAME@-@PACKAGE_VERSION@
|
||||
|
||||
|
201
Makefile.rules
201
Makefile.rules
@@ -28,6 +28,7 @@ RECURSIVE_TARGETS := all clean check install uninstall
|
||||
LOCAL_TARGETS := all-local clean-local check-local install-local printvars\
|
||||
uninstall-local
|
||||
TOPLEV_TARGETS := dist dist-check dist-clean tags
|
||||
USER_TARGETS := $(RECURSIVE_TARGETS) $(LOCAL_TARGETS) $(TOPLEV_TARGETS)
|
||||
INTERNAL_TARGETS := preconditions \
|
||||
install-config-dir install-shared-library install-bytecode-library \
|
||||
install-archive-library install-relinked-library install-tool \
|
||||
@@ -37,25 +38,22 @@ INTERNAL_TARGETS := preconditions \
|
||||
#--------------------------------------------------------------------
|
||||
# Mark all of these targets as phony to avoid implicit rule search
|
||||
#--------------------------------------------------------------------
|
||||
.PHONY: $(RECURSIVE_TARGETS) $(LOCAL_TARGETS) $(TOP_TARGETS) $(INTERNAL_TARGETS)
|
||||
.PHONY: $(USER_TARGETS) $(INTERNAL_TARGETS)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Make sure all the user-target rules are double colon rules and that
|
||||
# the preconditions are run first.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
$(USER_TARGETS) :: preconditions
|
||||
|
||||
all :: all-local
|
||||
check:: check-local
|
||||
clean:: clean-local
|
||||
install :: install-local
|
||||
uninstall :: uninstall-local
|
||||
|
||||
all-local :: preconditions
|
||||
clean-local :: preconditions
|
||||
check-local :: all-local
|
||||
install-local :: all-local
|
||||
printvars :: preconditions
|
||||
uninstall-local :: preconditions
|
||||
|
||||
###############################################################################
|
||||
# SUFFIXES: Reset the list of suffixes we know how to build
|
||||
@@ -132,6 +130,9 @@ ifndef VERBOSE
|
||||
VERB := @
|
||||
LIBTOOL += --silent
|
||||
AR += >/dev/null 2>/dev/null
|
||||
CONFIGUREFLAGS += >$(BUILD_OBJ_DIR)/configure.out 2>&1
|
||||
else
|
||||
CONFIGUREFLAGS :=
|
||||
endif
|
||||
|
||||
# By default, strip symbol information from executable
|
||||
@@ -218,14 +219,16 @@ ObjectsBC := $(BASENAME_SOURCES:%=$(OBJDIR)/%.bc)
|
||||
# Handle the DIRS options for sequential construction
|
||||
#---------------------------------------------------------
|
||||
|
||||
SUBDIRS :=
|
||||
ifdef DIRS
|
||||
SUBDIRS += $(DIRS)
|
||||
$(RECURSIVE_TARGETS)::
|
||||
$(VERB) for dir in $(DIRS); do \
|
||||
if [ ! -f $$dir/Makefile ]; then \
|
||||
$(MKDIR) $$dir; \
|
||||
cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
|
||||
fi; \
|
||||
($(MAKE) -C $$dir $@ $(MFLAGS)) || exit 1; \
|
||||
($(MAKE) -C $$dir $@ ) || exit 1; \
|
||||
done
|
||||
endif
|
||||
|
||||
@@ -240,7 +243,7 @@ $(RECURSIVE_TARGETS)::
|
||||
$(MKDIR) $$dir; \
|
||||
cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
|
||||
fi; \
|
||||
($(MAKE) -C $$dir $@ $(MFLAGS)) || exit 0; \
|
||||
($(MAKE) -C $$dir $@ ) || exit 0; \
|
||||
done
|
||||
endif
|
||||
|
||||
@@ -249,6 +252,7 @@ endif
|
||||
#---------------------------------------------------------
|
||||
ifdef PARALLEL_DIRS
|
||||
|
||||
SUBDIRS += $(PARALLEL_DIRS)
|
||||
# Unfortunately, this list must be maintained if new
|
||||
# recursive targets are added.
|
||||
all :: $(addsuffix /.makeall , $(PARALLEL_DIRS))
|
||||
@@ -264,7 +268,7 @@ $(Parallel_Targets) :
|
||||
$(MKDIR) $(@D); \
|
||||
cp $(BUILD_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
|
||||
fi; \
|
||||
$(MAKE) -C $(@D) $(subst $(@D)/.make,,$@) $(MFLAGS)
|
||||
$(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------
|
||||
@@ -272,6 +276,9 @@ endif
|
||||
# or may not exist.
|
||||
#---------------------------------------------------------
|
||||
ifdef OPTIONAL_DIRS
|
||||
|
||||
SUBDIRS += $(OPTIONAL_DIRS)
|
||||
|
||||
$(RECURSIVE_TARGETS)::
|
||||
$(VERB) for dir in $(OPTIONAL_DIRS); do \
|
||||
if [ -d $(BUILD_SRC_DIR)/$$dir ]; then\
|
||||
@@ -279,7 +286,7 @@ $(RECURSIVE_TARGETS)::
|
||||
$(MKDIR) $$dir; \
|
||||
cp $(BUILD_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
|
||||
fi; \
|
||||
($(MAKE) -C$$dir $@ $(MFLAGS)) || exit 1; \
|
||||
($(MAKE) -C$$dir $@ ) || exit 1; \
|
||||
fi \
|
||||
done
|
||||
endif
|
||||
@@ -802,9 +809,10 @@ MAKE_CONFIG := $(LLVM_OBJ_ROOT)/Makefile.config
|
||||
#------------------------------------------------------------------------
|
||||
# List of the preconditions
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
preconditions: $(CONFIG_STATUS) $(MAKE_CONFIG) $(OBJMKFILE)
|
||||
|
||||
all all-local check check-local dist dist-check install:: $(BUILT_SOURCES)
|
||||
$(filter-out clean clean-local,USER_TARGETS):: $(BUILT_SOURCES)
|
||||
|
||||
clean-local::
|
||||
ifneq ($(strip $(BUILT_SOURCES)),)
|
||||
@@ -816,18 +824,15 @@ endif
|
||||
#------------------------------------------------------------------------
|
||||
.PRECIOUS: $(CONFIG_STATUS)
|
||||
$(CONFIG_STATUS): $(CONFIGURE)
|
||||
@$(ECHO) Reconfiguring with $@
|
||||
$(VERB) $(CONFIG_STATUS) --recheck
|
||||
@$(ECHO) Reconfiguring with $<
|
||||
$(VERB) $(CONFIG_STATUS) --recheck $(CONFIGUREFLAGS)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Make sure the configuration makefile is up to date
|
||||
#------------------------------------------------------------------------
|
||||
$(MAKE_CONFIG): $(MAKE_CONFIG_IN)
|
||||
$(MAKE_CONFIG): $(MAKE_CONFIG_IN) $(CONFIG_STATUS)
|
||||
@$(ECHO) Regenerating $@
|
||||
$(VERB) cd $(LLVM_OBJ_ROOT) ; $(CONFIG_STATUS) Makefile.config
|
||||
$(VERB) $(MAKE) $(MFLAGS) $(MAKECMDGOALS)
|
||||
@exit 0;
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# If the Makefile in the source tree has been updated, copy it over into the
|
||||
@@ -836,11 +841,146 @@ $(MAKE_CONFIG): $(MAKE_CONFIG_IN)
|
||||
ifneq ($(OBJMKFILE),$(SRCMKFILE))
|
||||
.PRECIOUS: $(OBJMKFILE)
|
||||
$(OBJMKFILE): $(SRCMKFILE)
|
||||
@$(ECHO) "Updating Makefile from : $(dir $<)"
|
||||
@$(ECHO) "Updating Makefile from: $(dir $<)"
|
||||
$(VERB) $(MKDIR) $(@D)
|
||||
$(VERB) cp -f $< $@
|
||||
$(VERB) $(MAKE) $(MFLAGS) $(MAKECMDGOALS)
|
||||
@exit 0;
|
||||
endif
|
||||
|
||||
###############################################################################
|
||||
# Handle construction of a distribution tarball
|
||||
###############################################################################
|
||||
|
||||
.PHONY: dist dist-chck dist-clean distdir dist-gzip dist-bzip2 dist-zip
|
||||
|
||||
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
|
||||
|
||||
else
|
||||
|
||||
ifeq ($(LLVM_TARBALL_NAME),)
|
||||
$(error LLVM_TARBALL_NAME is empty)
|
||||
endif
|
||||
|
||||
ifneq ($(LEVEL),.)
|
||||
|
||||
dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
|
||||
@$(ECHO) ERROR: You must run $@ from $(BUILD_OBJ_ROOT)
|
||||
|
||||
DistTopCheck :=
|
||||
|
||||
else
|
||||
|
||||
DistTopCheck := check
|
||||
|
||||
dist-gzip: distdir
|
||||
@$(ECHO) Packing gzipped distribution tar file.
|
||||
$(VERB) $(TAR) chf - "$(TopDistDir)" | gzip -c > "$(DistTarGZip)"
|
||||
|
||||
dist-bzip2: distdir
|
||||
@$(ECHO) Packing bzipped distribution tar file.
|
||||
$(VERB) $(TAR) chf - $(DistName) | $(BZIP2) -c >$(DistTarBZ2)
|
||||
|
||||
dist-zip: distdir
|
||||
@$(ECHO) Packing zipped distribution file.
|
||||
$(VERB) rm -f $(DistZip)
|
||||
$(VERB) $(ZIP) -rq $(DistZip) $(DistName)
|
||||
|
||||
dist :: distdir
|
||||
@$(ECHO) Packing gzipped distribution tar file.
|
||||
$(VERB) $(TAR) chf - $(DistName) | $(GZIP) -c >$(DistTarGZip)
|
||||
@$(ECHO) Packing bzipped distribution tar file.
|
||||
$(VERB) $(TAR) chf - $(DistName) | $(BZIP2) -c >$(DistTarBZ2)
|
||||
@$(ECHO) Packing zipped distribution file.
|
||||
$(VERB) rm -f $(DistZip)
|
||||
$(VERB) $(ZIP) -rq $(DistZip) $(DistName)
|
||||
@$(ECHO) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
|
||||
|
||||
dist-check:: dist
|
||||
|
||||
dist-clean::
|
||||
@$(ECHO) Cleaning distribution files
|
||||
$(VERB) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName)
|
||||
|
||||
endif
|
||||
|
||||
DistName := $(LLVM_TARBALL_NAME)
|
||||
DistDir := $(BUILD_OBJ_ROOT)/$(DistName)
|
||||
TopDistDir := $(DistDir)
|
||||
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
|
||||
DistSources := $(filter-out projects,$(SOURCES) $(EXTRA_DIST))
|
||||
DistSubDirs := $(filter-out projects,$(SUBDIRS))
|
||||
DistFiles := $(DistAlways) $(DistSources)
|
||||
RmDistDir := { test ! -d $(DistDir) || { \
|
||||
find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -rf $(DistDir); }; }
|
||||
|
||||
distdir : $(DistTopCheck) $(DistSources)
|
||||
@$(ECHO) Building Distribution Directory $(DistDir)
|
||||
$(VERB) $(RmDistDir)
|
||||
$(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" ; \
|
||||
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 \
|
||||
$(ECHO) "===== WARNING: Distribution Source $$from_dir/$$file Not Found!" ; \
|
||||
elif test "$(VERB)" != '@' ; then \
|
||||
$(ECHO) "Skipping non-existent $$from_dir/$$file" ; \
|
||||
fi; \
|
||||
done
|
||||
$(VERB) for subdir in $(SUBDIRS) ; do \
|
||||
if test "$$subdir" \!= "." ; then \
|
||||
test -d "$(DistDir)/$$subdir" || $(MKDIR) "$(DistDir)/$$subdir" || exit 1; \
|
||||
new_distdir="$(DistDir)/$$subdir" ; \
|
||||
( cd $$subdir && $(MAKE) DistDir="$$new_distdir" distdir ) || exit 1; \
|
||||
fi; \
|
||||
done
|
||||
$(VERB) $(MAKE) DistDir="$(DistDir)" dist-hook
|
||||
-$(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)
|
||||
|
||||
dist-hook::
|
||||
|
||||
|
||||
endif
|
||||
|
||||
###############################################################################
|
||||
@@ -849,17 +989,6 @@ endif
|
||||
|
||||
ifeq ($(LEVEL),.)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Handle construction of a distribution
|
||||
dist:: preconditions
|
||||
@$(ECHO) Target dist is not implemented yet
|
||||
|
||||
dist-check:: preconditions dist
|
||||
@$(ECHO) Target dist-check is not implemented yet
|
||||
|
||||
dist-clean:: preconditions
|
||||
@$(ECHO) Target dist-clean is not implemented yet
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Install support for project's include files:
|
||||
#------------------------------------------------------------------------
|
||||
@@ -885,17 +1014,11 @@ uninstall-local::
|
||||
#------------------------------------------------------------------------
|
||||
# Build tags database for Emacs/Xemacs:
|
||||
#------------------------------------------------------------------------
|
||||
TAGS: tags
|
||||
tags:: TAGS
|
||||
|
||||
tags::
|
||||
TAGS:
|
||||
find include lib tools examples -name '*.cpp' -o -name '*.h' | $(ETAGS) $(ETAGSFLAGS) -
|
||||
|
||||
dist-clean:: clean
|
||||
$(VERB) $(RM) -rf $(LEVEL)/Makefile.config \
|
||||
$(LEVEL)/include/llvm/Config/config.h \
|
||||
$(LEVEL)/autoconf/autom4te.cache \
|
||||
$(LEVEL)/config.log \
|
||||
$(LEVEL)/TAGS
|
||||
endif
|
||||
|
||||
###############################################################################
|
||||
|
@@ -10,5 +10,10 @@
|
||||
LEVEL = ..
|
||||
DIRS = Burg TableGen fpcmp
|
||||
|
||||
EXTRA_DIST = check-each-file codegen-diff countloc.sh cvsupdate emacs \
|
||||
getsrcs.sh llvmdo llvmgrep llvm-native-gcc llvm-native-gxx \
|
||||
makellvm NightlyTest.gnuplot NightlyTest.pl \
|
||||
NightlyTestTemplate.html profile.pl RegressionFinder.pl vim
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
||||
|
Reference in New Issue
Block a user