From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Thu, 6 Mar 2008 23:55:40 +0100 From: Sam Ravnborg Subject: Re: [patch 2/8] Kbuild: Create a way to create preprocessor constants from C expressions Message-ID: <20080306225540.GA7248@uranus.ravnborg.org> References: <20080305223815.574326323@sgi.com> <20080305223845.436523065@sgi.com> <20080305200800.23ee10ec.akpm@linux-foundation.org> <20080306210005.GB29026@uranus.ravnborg.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org Return-Path: To: Christoph Lameter Cc: Andrew Morton , ak@suse.de, Mel Gorman , apw@shadowen.org, KAMEZAWA Hiroyuki , KOSAKI Motohiro , Rik van Riel , linux-mm@kvack.org List-ID: On Thu, Mar 06, 2008 at 02:43:53PM -0800, Christoph Lameter wrote: > Hmmm.. Even after the Sam's fixes: I still have the recursion probblem > that include/linux/bounds.h needs to exist and provide some value for > the constants in order to create kernel/bounds.c. And kernel/bounds.c is > needed then to create bounds.s which creates bounds.h. Argh! I could only come up with following hack. And too late to try more today. It your test proves that it is OK then: Signed-off-by: Sam Ravnborg (But I had preferred the recursive dependency to be gone...) Sam diff --git a/Kbuild b/Kbuild index 1570d24..37a270f 100644 --- a/Kbuild +++ b/Kbuild @@ -2,18 +2,21 @@ # Kbuild for top-level directory of the kernel # This file takes care of the following: # 1) Generate asm-offsets.h -# 2) Check for missing system calls +# 2) Generate bounds.h +# 3) Check for missing system calls ##### # 1) Generate asm-offsets.h # +# Note: We create a temporary empty bounds.h file to build asm-offsets.s offsets-file := include/asm-$(SRCARCH)/asm-offsets.h +bounds-file := include/linux/bounds.h -always := $(offsets-file) +always := $(bounds-file) $(offsets-file) targets := $(offsets-file) targets += arch/$(SRCARCH)/kernel/asm-offsets.s -clean-files := $(addprefix $(objtree)/,$(targets)) + # Default sed regexp - multiline due to syntax constraints define sed-y @@ -42,6 +45,7 @@ endef # We use internal kbuild rules to avoid the "is up to date" message from make arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c FORCE $(Q)mkdir -p $(dir $@) + $(Q)test -f $(bounds-file) || (mkdir -p $(dir $(bounds-file)) && touch $(bounds-file)) $(call if_changed_dep,cc_s_c) $(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild @@ -49,7 +53,39 @@ $(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild $(call cmd,offsets) ##### -# 2) Check for missing system calls +# 2) Generate bounds.h + +always += $(bounds-file) +targets += $(bounds-file) kernel/bounds.s + +quiet_cmd_bounds = GEN $@ +define cmd_bounds + (set -e; \ + echo "#ifndef __LINUX_BOUNDS_H__"; \ + echo "#define __LINUX_BOUNDS_H__"; \ + echo "/*"; \ + echo " * DO NOT MODIFY."; \ + echo " *"; \ + echo " * This file was generated by Kbuild"; \ + echo " *"; \ + echo " */"; \ + echo ""; \ + sed -ne $(sed-y) $<; \ + echo ""; \ + echo "#endif" ) > $@ +endef + +# We use internal kbuild rules to avoid the "is up to date" message from make +kernel/bounds.s: kernel/bounds.c $(obj)/$(offsets-file) FORCE + $(Q)mkdir -p $(dir $@) + $(call if_changed_dep,cc_s_c) + +$(obj)/$(bounds-file): kernel/bounds.s Kbuild + $(Q)mkdir -p $(dir $@) + $(call cmd,bounds) + +##### +# 3) Check for missing system calls # quiet_cmd_syscalls = CALL $< @@ -58,3 +94,7 @@ quiet_cmd_syscalls = CALL $< PHONY += missing-syscalls missing-syscalls: scripts/checksyscalls.sh FORCE $(call cmd,syscalls) + +# Delete all targets during make clean +clean-files := $(addprefix $(objtree)/,$(targets)) + -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org