From a69b1ea1f3d7c005457f6dd79914196c2eff9d52 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Thu, 28 Oct 2004 09:15:28 +0000 Subject: [PATCH] Bug Fixes: * Move rules that build directories earlier in the file so that they are always built before the things that depend on them. This enables a parallel "dist-check" target. * Fix use of TOOLLINKOPTS and TOOLLINKOPTSB (thanks to Henrik Bach) * Standardize the output - some scripts using plain echo instead of $(ECHO) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17318 91177308-0d34-0410-b5e6-96231b3b80d8 --- Makefile.rules | 83 +++++++++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 49 deletions(-) diff --git a/Makefile.rules b/Makefile.rules index 1175d89d73d..c564703eddd 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -216,16 +216,7 @@ endif # Adjust linker flags for building an executable ifdef TOOLNAME - LDFLAGS += -rpath $(TOOLDIR) -export-dynamic $(TOOLLINKOPTS) -endif - -# Use TOOLLINKOPTSB to pass options to the linker like library search -# path etc. -# Note that this is different from TOOLLINKOPTS, these options -# are passed to the linker *before* the USEDLIBS options are passed. -# e.g. usage TOOLLINKOPTSB = -L/home/xxx/lib -ifdef TOOLLINKOPTSB -LDFLAGS += $(TOOLLINKOPTSB) + LDFLAGS += -rpath $(TOOLDIR) -export-dynamic endif #---------------------------------------------------------- @@ -251,7 +242,8 @@ BCCompile.CXX = $(LLVMGXX) $(CPPFLAGS) $(CompileCommonOpts) $(CXXFLAGS) -c BCCompile.C = $(LLVMGCC) $(CPPFLAGS) $(CompileCommonOpts) $(CFLAGS) -c Link = $(LIBTOOL) --tag=CXX --mode=link $(CXX) $(CPPFLAGS) \ $(CompileCommonOpts) $(LDFLAGS) $(STRIP) -Relink = $(LIBTOOL) --tag=CXX --mode=link $(CXX) +Relink = $(LIBTOOL) --tag=CXX --mode=link $(CXX) $(CPPFLAGS) \ + $(CompileCommonOpts) BCLinkLib = $(LLVMGCC) -shared -nostdlib Burg = $(BURG) -I $(BUILD_SRC_DIR) TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR) @@ -288,6 +280,24 @@ ObjectsBC := $(BASENAME_SOURCES:%=$(OBJDIR)/%.bc) # DIRECTORIES: Handle recursive descent of directory structure ############################################################################### +#--------------------------------------------------------- +# Provide rules to make install dirs. This must be early +# in the file so they get built before dependencies +#--------------------------------------------------------- + +$(bindir): + $(VERB) $(MKDIR) $(bindir) + +$(libdir): + $(VERB) $(MKDIR) $(libdir) + +$(bytecode_libdir): + $(VERB) $(MKDIR) $(bytecode_libdir) + +$(sysconfdir): + $(VERB) $(MKDIR) $(sysconfdir) + + #--------------------------------------------------------- # Handle the DIRS options for sequential construction #--------------------------------------------------------- @@ -381,22 +391,12 @@ uninstall-local:: $(RM) -f $(sysconfdir)/$${file} ; \ done -$(sysconfdir): - $(VERB) $(MKDIR) $(sysconfdir) - endif ############################################################################### # Library Build Rules: Four ways to build a library ############################################################################### -$(libdir): - $(VERB) $(MKDIR) $(libdir) - -$(bytecode_libdir): - $(VERB) $(MKDIR) $(bytecode_libdir) - - # if we're building a library ... ifdef LIBRARYNAME @@ -552,16 +552,6 @@ endif ifdef TOOLNAME -#--------------------------------------------------------- -# TOOLLINKOPTSB to pass options to the linker like library search path etc -# Note that this is different from TOOLLINKOPTS, these options -# are passed to the linker *before* the USEDLIBS options are passed. -# e.g. usage TOOLLINKOPTSB = -L/home/xxx/lib -#--------------------------------------------------------- -ifdef TOOLLINKOPTSB -Link += $(TOOLLINKOPTSB) -endif - # TOOLEXENAME - This is the output filenames to generate TOOLEXENAME := $(TOOLDIR)/$(TOOLNAME) @@ -577,9 +567,6 @@ LLVM_USED_LIBS := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS))) PROJ_LIBS_PATHS := $(addprefix $(LIBDIR)/,$(PROJ_USED_LIBS)) LLVM_LIBS_PATHS := $(addprefix $(LLVMLIBDIR)/,$(LLVM_USED_LIBS)) -# Concatenate all the optoins -LINK_OPTS := $(TOOLLINKOPTS) $(PROJ_LIBS_OPTIONS) $(LLVM_LIBS_OPTIONS) - # Handle compression libraries automatically ifeq ($(HAVE_BZIP2),1) LIBS += -lbz2 @@ -601,7 +588,8 @@ endif $(TOOLEXENAME): $(BUILT_SOURCES) $(ObjectsO) $(PROJ_LIBS_PATHS) $(LLVM_LIBS_PATHS) $(TOOLDIR)/.dir @$(ECHO) Linking $(CONFIGURATION) executable $(TOOLNAME) $(STRIP_WARN_MSG) - $(VERB) $(Link) -o $@ $(ObjectsO) $(PROJ_LIBS_OPTIONS) $(LLVM_LIBS_OPTIONS) $(LIBS) + $(VERB) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(PROJ_LIBS_OPTIONS) \ + $(LLVM_LIBS_OPTIONS) $(LIBS) $(TOOLLINKOPTSB) @$(ECHO) ======= Finished Linking $(CONFIGURATION) Executable $(TOOLNAME) $(STRIP_WARN_MSG) DestTool = $(bindir)/$(TOOLNAME) @@ -612,9 +600,6 @@ $(DestTool): $(bindir) $(TOOLEXENAME) @$(ECHO) Installing $(CONFIGURATION) $(DestTool) $(VERB) $(INSTALL) $(TOOLEXENAME) $(DestTool) -$(bindir): - $(VERB) $(MKDIR) $(bindir) - uninstall-local:: @$(ECHO) Uninstalling $(CONFIGURATION) $(DestTool) $(VERB) $(RM) -f $(DestTool) @@ -713,43 +698,43 @@ INCFILES := $(filter %.inc,$(BUILT_SOURCES)) $(INCFILES) : $(TBLGEN) $(TDFILES) %GenRegisterNames.inc : %.td - @echo "Building $(