Bug Fixes:
authorReid Spencer <rspencer@reidspencer.com>
Thu, 28 Oct 2004 09:15:28 +0000 (09:15 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Thu, 28 Oct 2004 09:15:28 +0000 (09:15 +0000)
* 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

index 1175d89d73da14dc2d0f18441a57b58da790eaca..c564703eddd52111f6f228b2691c16cc8963f357 100644 (file)
@@ -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 $(<F) register names with tblgen"
+       @$(ECHO) "Building $(<F) register names with tblgen"
        $(VERB) $(TableGen) -gen-register-enums -o $@ $<
 
 %GenRegisterInfo.h.inc : %.td 
-       @echo "Building $(<F) register information header with tblgen"
+       @$(ECHO) "Building $(<F) register information header with tblgen"
        $(VERB) $(TableGen) -gen-register-desc-header -o $@ $<
 
 %GenRegisterInfo.inc : %.td
-       @echo "Building $(<F) register info implementation with tblgen"
+       @$(ECHO) "Building $(<F) register info implementation with tblgen"
        $(VERB) $(TableGen) -gen-register-desc -o $@ $<
 
 %GenInstrNames.inc : %.td
-       @echo "Building $(<F) instruction names with tblgen"
+       @$(ECHO) "Building $(<F) instruction names with tblgen"
        $(VERB) $(TableGen) -gen-instr-enums -o $@ $<
 
 %GenInstrInfo.inc : %.td
-       @echo "Building $(<F) instruction information with tblgen"
+       @$(ECHO) "Building $(<F) instruction information with tblgen"
        $(VERB) $(TableGen) -gen-instr-desc -o $@ $<
 
 %GenAsmWriter.inc : %.td
-       @echo "Building $(<F) assembly writer with tblgen"
+       @$(ECHO) "Building $(<F) assembly writer with tblgen"
        $(VERB) $(TableGen) -gen-asm-writer -o $@ $<
 
 %GenATTAsmWriter.inc : %.td
-       @echo "Building $(<F) AT&T assembly writer with tblgen"
+       @$(ECHO) "Building $(<F) AT&T assembly writer with tblgen"
        $(VERB) $(TableGen) -gen-asm-writer -o $@ $< 
 
 %GenIntelAsmWriter.inc : %.td
-       @echo "Building $(<F) Intel assembly writer with tblgen"
+       @$(ECHO) "Building $(<F) Intel assembly writer with tblgen"
        $(VERB) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $< 
 
 %GenInstrSelector.inc: %.td
-       @echo "Building $(<F) instruction selector with tblgen"
+       @$(ECHO) "Building $(<F) instruction selector with tblgen"
        $(VERB) $(TableGen) -gen-instr-selector -o $@ $< 
 
 %GenCodeEmitter.inc:: %.td
-       @echo "Building $(<F) code emitter with tblgen"
+       @$(ECHO) "Building $(<F) code emitter with tblgen"
        $(VERB) $(TableGen) -gen-emitter -o $@ $<
 
 clean-local::
@@ -973,7 +958,7 @@ distdir : $(DistSources)
            find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';'  || \
              exit 1 ; \
          fi ; \
-         echo Removing $(DistDir) ; \
+         $(ECHO) Removing $(DistDir) ; \
          $(RM) -rf $(DistDir); \
        fi
        $(VERB) $(MKDIR) $(DistDir)