Use a vector<char*> instead of char*[] so that we can add arbitrary number of
[oota-llvm.git] / Makefile.common
index 94db697e93e23e4876d4194d24c0022e799f5c2c..c3f5af220113ed0f94c024a2b6f12e4e190e44b7 100644 (file)
@@ -89,7 +89,7 @@ endif
 # Determine the path of the source tree relative from $HOME (the mythical
 # home directory).
 #
-HOME_OBJ_ROOT := $(OBJ_ROOT)/$(patsubst $(HOME)%,%,$(BUILD_SRC_ROOT))
+HOME_OBJ_ROOT := $(OBJ_ROOT)$(patsubst $(HOME)%,%,$(BUILD_SRC_ROOT))
 
 #
 # Set the object build directory.  Its location depends upon the source path
@@ -149,6 +149,9 @@ install ::
 # Default rule for test.  It ensures everything has a test rule
 test::
 
+# Default rule for building only bytecode.
+bytecode::
+
 # Print out the directories used for building
 prdirs::
        echo "Home Offset      : " $(HOME_OBJ_ROOT);
@@ -159,6 +162,13 @@ prdirs::
        echo "LLVM  Source Root: " $(LLVM_SRC_ROOT);
        echo "LLVM  Object Root: " $(LLVM_OBJ_ROOT);
 
+#
+# Mark all of these targets as phony.  This will hopefully speed up builds
+# slightly since GNU Make will not try to find implicit rules for targets
+# which are marked as Phony.
+#
+.PHONY: all dynamic clean distclean install test bytecode prdirs
+
 ###########################################################################
 # Miscellaneous paths and commands:
 #      This section defines various configuration macros, such as where
@@ -256,9 +266,9 @@ PROJTOOLCURRENT := $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION)
 # Libtool is found in the current directory.
 #
 ifdef VERBOSE
-LIBTOOL=$(LLVM_SRC_ROOT)/libtool
+LIBTOOL=$(LLVM_SRC_ROOT)/mklib
 else
-LIBTOOL=$(LLVM_SRC_ROOT)/libtool --silent
+LIBTOOL=$(LLVM_SRC_ROOT)/mklib --silent
 endif
 
 #
@@ -297,7 +307,7 @@ CPPFLAGS += -I$(BUILD_SRC_ROOT)/include -I$(LLVM_SRC_ROOT)/include
 # By default, strip symbol information from executable
 ifndef KEEP_SYMBOLS
 STRIP = $(PLATFORMSTRIPOPTS)
-STRIP_WARN_MSG = "(without symbols) "
+STRIP_WARN_MSG = "(without symbols)"
 endif
 
 # Allow gnu extensions...
@@ -400,7 +410,7 @@ ObjectsG := $(addprefix $(BUILD_OBJ_DIR)/Debug/,$(Objs))
 #---------------------------------------------------------
 
 ifdef DIRS
-all install clean test ::
+all install clean test bytecode ::
        $(VERB) for dir in ${DIRS}; do \
                (cd $$dir; $(MAKE) $@) || exit 1; \
        done
@@ -408,18 +418,19 @@ endif
 
 # Handle PARALLEL_DIRS
 ifdef PARALLEL_DIRS
-all     :: $(addsuffix /.makeall    , $(PARALLEL_DIRS))
-install :: $(addsuffix /.makeinstall, $(PARALLEL_DIRS))
-clean   :: $(addsuffix /.makeclean  , $(PARALLEL_DIRS))
-test    :: $(addsuffix /.maketest   , $(PARALLEL_DIRS))
+all      :: $(addsuffix /.makeall     , $(PARALLEL_DIRS))
+install  :: $(addsuffix /.makeinstall , $(PARALLEL_DIRS))
+clean    :: $(addsuffix /.makeclean   , $(PARALLEL_DIRS))
+test     :: $(addsuffix /.maketest    , $(PARALLEL_DIRS))
+bytecode :: $(addsuffix /.makebytecode, $(PARALLEL_DIRS))
 
-%/.makeall %/.makeinstall %/.makeclean %/.maketest:
+%/.makeall %/.makeinstall %/.makeclean %/.maketest %/.makebytecode:
        $(VERB) cd $(@D); $(MAKE) $(subst $(@D)/.make,,$@)
 endif
 
 # Handle directories that may or may not exist
 ifdef OPTIONAL_DIRS
-all install clean test ::
+all install clean test bytecode ::
        $(VERB) for dir in ${OPTIONAL_DIRS}; do \
                if [ -d $$dir ]; \
                then\
@@ -588,7 +599,7 @@ LIB_OPTS_P :=  $(LLVM_LIBS_OPTIONS_P) $(PROJ_LIBS_OPTIONS_P)
 
 # USED_LIB_PATHS - Compute the path of the libraries used so that tools are
 # rebuilt if libraries change.  This has to make sure to handle .a/.so and .o
-# files seperately.
+# files separately.
 #
 STATICUSEDLIBS   := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
 USED_LIB_PATHS_G := $(addprefix $(DESTLIBDEBUG)/, $(STATICUSEDLIBS))
@@ -618,7 +629,7 @@ clean::
        $(VERB) $(RM) -f $(TOOLEXENAMES)
 
 $(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(DESTTOOLDEBUG)/.dir
-       @echo ======= Linking $(TOOLNAME) debug executable $(STRIP_WARN_MSG)=======
+       @echo ======= Linking $(TOOLNAME) debug executable $(STRIP_WARN_MSG) =======
        $(VERB) $(LinkG) -o $@ $(ObjectsG) $(LIB_OPTS_G) $(LINK_OPTS) $(LIBS)
 
 $(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(DESTTOOLRELEASE)/.dir