From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKjOZ-00015Y-Qk for qemu-devel@nongnu.org; Mon, 09 Feb 2015 03:08:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKjOT-0005du-Ur for qemu-devel@nongnu.org; Mon, 09 Feb 2015 03:08:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36048) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKjOT-0005dp-Mk for qemu-devel@nongnu.org; Mon, 09 Feb 2015 03:08:33 -0500 From: Fam Zheng Date: Mon, 9 Feb 2015 16:08:17 +0800 Message-Id: <1423469297-10826-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH] Makefile: Allow "make cscope TAGS" in unconfigured source tree List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Michael Tokarev , Fam Zheng , =?UTF-8?q?Llu=C3=ADs=20Vilanova?= , Stefan Hajnoczi It doesn't make much sense to ask one to switch to build dir in order to make these two targets. Signed-off-by: Fam Zheng --- Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6817c6f..257bef6 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,9 @@ # Always point to the root of the build tree (needs GNU make). BUILD_DIR=$(CURDIR) +# Before including a proper config-host.mak, assume we are in the source tree +SRC_PATH=. + # All following code might depend on configuration variables ifneq ($(wildcard config-host.mak),) # Put the all: rule here so that config-host.mak can contain dependencies. @@ -38,7 +41,7 @@ config-host.mak: $(SRC_PATH)/configure fi else config-host.mak: -ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) +ifneq ($(filter-out %clean TAGS cscope,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) @echo "Please call configure before running make!" @exit 1 endif @@ -433,9 +436,9 @@ TAGS: find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} + cscope: - rm -f ./cscope.* - find "$(SRC_PATH)" -name "*.[chsS]" -print | sed 's,^\./,,' > ./cscope.files - cscope -b + rm -f "$(SRC_PATH)"/cscope.* + find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files" + cscope -b -i"$(SRC_PATH)/cscope.files" # documentation MAKEINFO=makeinfo @@ -556,7 +559,7 @@ endif # CONFIG_WIN # Add a dependency on the generated files, so that they are always # rebuilt before other object files -ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) +ifneq ($(filter-out %clean TAGS cscope,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) Makefile: $(GENERATED_HEADERS) endif -- 1.9.3