Modified directory building rules so that using the cd program/alias is
[oota-llvm.git] / Makefile.rules
index af0c021234afca1de8754afcd85bec72d540b86b..a3b57e1110aff36f8e3d9727e8a71360cfc8171a 100644 (file)
@@ -395,7 +395,7 @@ RObjectsG := $(addprefix $(BUILD_OBJ_DIR)/Debug/,$(RObjs))
 ifdef DIRS
 all install clean test bytecode ::
        $(VERB) for dir in ${DIRS}; do \
-               (cd $$dir; $(MAKE) $@) || exit 1; \
+               ($(MAKE) -C $$dir $@) || exit 1; \
        done
 endif
 
@@ -408,7 +408,7 @@ test     :: $(addsuffix /.maketest    , $(PARALLEL_DIRS))
 bytecode :: $(addsuffix /.makebytecode, $(PARALLEL_DIRS))
 
 %/.makeall %/.makeinstall %/.makeclean %/.maketest %/.makebytecode:
-       $(VERB) cd $(@D); $(MAKE) $(subst $(@D)/.make,,$@)
+       $(VERB) $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
 endif
 
 # Handle directories that may or may not exist
@@ -417,7 +417,7 @@ all install clean test bytecode ::
        $(VERB) for dir in ${OPTIONAL_DIRS}; do \
                if [ -d $$dir ]; \
                then\
-                       (cd $$dir; $(MAKE) $@) || exit 1; \
+                       ($(MAKE) -C$$dir $@) || exit 1; \
                fi \
        done
 endif
@@ -816,6 +816,12 @@ $(LLVM_OBJ_ROOT)/config.status:: $(LLVM_SRC_ROOT)/configure
        @${ECHO} "****************************************************************"
        $(VERB) exit 1
 
+# If the Makefile in the source tree has been updated, copy it over into the
+# build tree.
+Makefile :: $(BUILD_SRC_DIR)/Makefile
+       @${ECHO} "===== Updating Makefile from source dir: `dirname $<` ====="
+       cp -f $< $@
+
 #
 # Include dependencies generated from C/C++ source files, but not if we
 # are cleaning (this example taken from the GNU Make Manual).