aboutsummaryrefslogtreecommitdiff
path: root/Makefile.config.in
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-08-03 22:53:22 +0000
committerChris Lattner <sabre@nondot.org>2010-08-03 22:53:22 +0000
commit7cf8fc7a45373aab97ce58130087b8b5db064f54 (patch)
tree55af786206ada3b6ac734d46604740472282629b /Makefile.config.in
parent656f6800b2930ebbdc4c36746f47723174100acf (diff)
Make the makefiles go much faster by using the realpath
builtin instead of shell. On my 8 core mac pro, this speeds up a 'make -j8' null build of the lib directory from 1.11s to 0.77s wall time. Patch by NAKAMURA Takumi! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110166 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Makefile.config.in')
-rw-r--r--Makefile.config.in18
1 files changed, 11 insertions, 7 deletions
diff --git a/Makefile.config.in b/Makefile.config.in
index 1d54b317c3..5ebd80384f 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -39,14 +39,18 @@ ifndef PROJECT_NAME
PROJECT_NAME := $(LLVMPackageName)
endif
-PROJ_OBJ_DIR := $(shell $(PWD))
-PROJ_OBJ_ROOT := $(shell cd $(PROJ_OBJ_DIR)/$(LEVEL); $(PWD))
+# The macro below is expanded when 'realpath' is not built-in.
+# Built-in 'realpath' is available on GNU Make 3.81.
+realpath = $(shell cd $(1); $(PWD))
+
+PROJ_OBJ_DIR := $(call realpath, .)
+PROJ_OBJ_ROOT := $(call realpath, $(PROJ_OBJ_DIR)/$(LEVEL))
ifeq ($(PROJECT_NAME),llvm)
-LLVM_SRC_ROOT := $(shell cd @abs_top_srcdir@; $(PWD))
-LLVM_OBJ_ROOT := $(shell cd @abs_top_builddir@; $(PWD))
-PROJ_SRC_ROOT := $(shell cd $(LLVM_SRC_ROOT); $(PWD))
-PROJ_SRC_DIR := $(shell cd $(LLVM_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)); $(PWD))
+LLVM_SRC_ROOT := $(call realpath, @abs_top_srcdir@)
+LLVM_OBJ_ROOT := $(call realpath, @abs_top_builddir@)
+PROJ_SRC_ROOT := $(LLVM_SRC_ROOT)
+PROJ_SRC_DIR := $(call realpath, $(LLVM_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)))
prefix := @prefix@
PROJ_prefix := $(prefix)
PROJ_VERSION := $(LLVMVersion)
@@ -66,7 +70,7 @@ endif
ifndef LLVM_OBJ_ROOT
$(error Projects must define LLVM_OBJ_ROOT)
endif
-PROJ_SRC_DIR := $(shell cd $(PROJ_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)); $(PWD))
+PROJ_SRC_DIR := $(call realpath, $(PROJ_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)))
prefix := $(PROJ_INSTALL_ROOT)
PROJ_prefix := $(prefix)
ifndef PROJ_VERSION