Remove usage of grep-not script
[oota-llvm.git] / Makefile.rules
index b2411900bf19ab1edbe75e5710307f2cba96bc10..88cdd97c00ad647ff2ab321d11251ad382590497 100644 (file)
@@ -38,9 +38,9 @@
 #    LEVEL should be set to the top of LLVM source tree
 #    LLVM_LIB_DIR should be set to the top of the LLVM build tree
 #
-#    
 #===-----------------------------------------------------------------------====
 
+#
 # Configuration file to set paths specific to local installation of LLVM
 # 
 include $(LEVEL)/Makefile.config
@@ -72,7 +72,7 @@ endif
 # Set the source root directory.
 #
 ifndef BUILD_SRC_ROOT
-BUILD_SRC_ROOT = $(BUILD_SRC_DIR)/$(LEVEL)
+BUILD_SRC_ROOT = $(shell cd $(BUILD_SRC_DIR)/$(LEVEL); pwd)
 endif
 
 #
@@ -83,7 +83,7 @@ ifndef BUILD_OBJ_DIR
 ifeq ($(OBJ_ROOT),.)
 BUILD_OBJ_DIR = $(shell pwd)
 else
-BUILD_OBJ_DIR := $(OBJ_ROOT)$(patsubst $(HOME)%,%,$(shell cd $(BUILD_SRC_DIR); pwd))
+BUILD_OBJ_DIR := $(OBJ_ROOT)$(patsubst $(shell dirname $(BUILD_SRC_ROOT))%,%,$(shell cd $(BUILD_SRC_DIR); pwd))
 endif
 endif
 
@@ -94,7 +94,7 @@ ifndef BUILD_OBJ_ROOT
 ifeq ($(OBJ_ROOT),.)
 BUILD_OBJ_ROOT = $(shell cd $(LEVEL); pwd)
 else
-BUILD_OBJ_ROOT := $(OBJ_ROOT)$(patsubst $(HOME)%,%,$(shell cd $(LEVEL); pwd))
+BUILD_OBJ_ROOT := $(OBJ_ROOT)$(patsubst $(shell dirname $(BUILD_SRC_ROOT))%,%,$(shell cd $(BUILD_SRC_ROOT); pwd))
 endif
 endif
 
@@ -341,6 +341,16 @@ test    :: $(addsuffix /.maketest   , $(PARALLEL_DIRS))
        $(VERB) cd $(@D); $(MAKE) $(subst $(@D)/.make,,$@)
 endif
 
+ifdef OPTIONAL_DIRS
+all install clean test ::
+       $(VERB) for dir in ${OPTIONAL_DIRS}; do \
+               if [ -d $$dir ]; \
+               then\
+                       (cd $$dir; $(MAKE) $@) || exit 1; \
+               fi \
+       done
+endif
+
 #---------------------------------------------------------
 # Handle the LIBRARYNAME option - used when building libs...
 #---------------------------------------------------------
@@ -466,7 +476,7 @@ LLVM_LIBS_OPTIONS_O := $(patsubst %.o, $(LLVMLIBRELEASESOURCE)/%.o,$(LLVM_LIBS_O
 LLVM_LIBS_OPTIONS_P := $(patsubst %.o, $(LLVMLIBPROFILESOURCE)/%.o,$(LLVM_LIBS_OPTIONS))
 
 LIB_OPTS_G :=  $(LLVM_LIBS_OPTIONS_G) $(PROJ_LIBS_OPTIONS_G)
-LIB_OPTS_O :=  $(LLVM_LIBS_OPTIONS_O) $(PROJ_LIBS_OPTIONS_P)
+LIB_OPTS_O :=  $(LLVM_LIBS_OPTIONS_O) $(PROJ_LIBS_OPTIONS_O)
 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
@@ -490,6 +500,7 @@ $(USED_LIB_PATHS_G) $(USED_LIB_PATHS_O) $(USED_LIB_PATHS_P): \
         $(addsuffix /.makeall, $(PARALLEL_DIRS))
 
 all::   $(TOOLEXENAMES)
+
 clean::
        $(VERB) rm -f $(TOOLEXENAMES)