linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Christoph Lameter <clameter@sgi.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	ak@suse.de, Mel Gorman <mel@csn.ul.ie>,
	apw@shadowen.org,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Rik van Riel <riel@redhat.com>,
	linux-mm@kvack.org
Subject: Re: [patch 2/8] Kbuild: Create a way to create preprocessor constants from C expressions
Date: Thu, 6 Mar 2008 23:55:40 +0100	[thread overview]
Message-ID: <20080306225540.GA7248@uranus.ravnborg.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0803061442010.15906@schroedinger.engr.sgi.com>

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 <sam@ravnborg.org>

(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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2008-03-06 22:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080305223815.574326323@sgi.com>
     [not found] ` <20080305223846.780991734@sgi.com>
2008-03-06  2:40   ` [patch 8/8] Pageflags: Eliminate PG_xxx aliases Nick Piggin
2008-03-06 22:51     ` Christoph Lameter
2008-03-07  0:48       ` Nick Piggin
2008-03-07  1:38         ` Christoph Lameter
2008-03-07  2:20           ` Nick Piggin
2008-03-07  3:53             ` Christoph Lameter
2008-03-07  4:16               ` Nick Piggin
     [not found] ` <20080305223845.436523065@sgi.com>
2008-03-06  4:08   ` [patch 2/8] Kbuild: Create a way to create preprocessor constants from C expressions Andrew Morton
2008-03-06 20:20     ` Christoph Lameter
2008-03-06 21:00       ` Sam Ravnborg
2008-03-06 21:49         ` Christoph Lameter
2008-03-06 22:43         ` Christoph Lameter
2008-03-06 22:55           ` Sam Ravnborg [this message]
2008-03-06 23:02             ` Christoph Lameter
2008-03-06 20:51   ` Sam Ravnborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080306225540.GA7248@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=apw@shadowen.org \
    --cc=clameter@sgi.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).