public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	linux-arch@vger.kernel.org
Subject: kbuild: generic support for offsets.h
Date: Thu, 28 Oct 2004 21:01:19 +0200	[thread overview]
Message-ID: <20041028190119.GC9004@mars.ravnborg.org> (raw)
In-Reply-To: <20041028185917.GA9004@mars.ravnborg.org>

kbuild: introduce a generic method to generate offsets.h
   
The following patch will break most architectures because it introduce a new way to
generate the offsets.h file. The main rationale is to use correct dependencies for
the offsets.h file. Before one could change a .h file with no recompile of
offsets.h resulting in assembler code to use wrong constants - horror.
Follow-up patches will try to unbreak all relevant architectures.
   
As an added bonus give a nice print-out when .config is missing.
   
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

diff -Nru a/Makefile b/Makefile
--- a/Makefile	2004-10-28 20:46:51 +02:00
+++ b/Makefile	2004-10-28 20:46:51 +02:00
@@ -476,6 +476,9 @@
 -include .config.cmd
 
 include .config
+$(if $(wildcard .config),, \
+	$(warning *** Use 'make *config' to generate .config.) \
+	$(error Try 'make help'!))
 
 # If .config needs to be updated, it will be done via the dependency
 # that autoconf has on .config.
@@ -758,6 +761,7 @@
 prepare1: prepare2 outputmakefile
 
 prepare0: prepare1 include/linux/version.h include/asm include/config/MARKER
+	$(Q)$(MAKE) $(build)=$(srctree)/include/asm
 ifneq ($(KBUILD_MODULES),)
 	$(Q)rm -rf $(MODVERDIR)
 	$(Q)mkdir -p $(MODVERDIR)
@@ -904,26 +908,6 @@
 
 endif # CONFIG_MODULES
 
-# Generate asm-offsets.h 
-# ---------------------------------------------------------------------------
-
-define filechk_gen-asm-offsets
-	(set -e; \
-	 echo "#ifndef __ASM_OFFSETS_H__"; \
-	 echo "#define __ASM_OFFSETS_H__"; \
-	 echo "/*"; \
-	 echo " * DO NOT MODIFY."; \
-	 echo " *"; \
-	 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
-	 echo " *"; \
-	 echo " */"; \
-	 echo ""; \
-	 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
-	 echo ""; \
-	 echo "#endif" )
-endef
-
-
 ###
 # Cleaning is done on three levels.
 # make clean     Delete most generated files
@@ -946,7 +930,7 @@
 #
 clean: rm-dirs  := $(CLEAN_DIRS)
 clean: rm-files := $(CLEAN_FILES)
-clean-dirs      := $(addprefix _clean_,$(vmlinux-alldirs))
+clean-dirs      := $(addprefix _clean_,$(vmlinux-alldirs) include/asm-$(ARCH))
 
 .PHONY: $(clean-dirs) clean archclean
 $(clean-dirs):
diff -Nru a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-generic/Kbuild	2004-10-28 20:46:51 +02:00
@@ -0,0 +1,24 @@
+# kbuild file for asm-generic contains generic support
+# for usage in asm-$(ARCH)
+# This file is included from include/asm-$(ARCH)/Kbuild
+
+
+# Generate asm-offsets.h 
+# ---------------------------------------------------------------------------
+
+define filechk_gen-asm-offsets
+	(set -e; \
+	 echo "#ifndef __ASM_OFFSETS_H__"; \
+	 echo "#define __ASM_OFFSETS_H__"; \
+	 echo "/*"; \
+	 echo " * DO NOT MODIFY."; \
+	 echo " *"; \
+	 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
+	 echo " *"; \
+	 echo " */"; \
+	 echo ""; \
+	 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
+	 echo ""; \
+	 echo "#endif" )
+endef
+

  parent reply	other threads:[~2004-10-28 17:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-28 18:59 kbuild/all archs: Sanitize creating offsets.h Sam Ravnborg
2004-10-28 19:00 ` New kbuild filename: Kbuild Sam Ravnborg
2004-10-28 17:30   ` Geert Uytterhoeven
2004-10-29 11:59   ` Christoph Hellwig
2004-10-29 19:12     ` Sam Ravnborg
2004-10-29 17:47       ` Roman Zippel
2004-10-29 20:46         ` Sam Ravnborg
2004-10-28 19:01 ` Sam Ravnborg [this message]
2004-10-28 19:02 ` i386: use generic support for offsets.h Sam Ravnborg
2004-10-29  9:52   ` Jan-Benedict Glaw
2004-10-29 19:05     ` Sam Ravnborg
2004-10-28 19:03 ` arm: use generic support for constants.h Sam Ravnborg
2004-10-28 19:44 ` kbuild/all archs: Sanitize creating offsets.h Russell King
2004-10-28 21:59   ` Sam Ravnborg
2004-10-28 21:00     ` Russell King
2004-10-28 23:45       ` Sam Ravnborg
2004-10-29 21:28         ` Sam Ravnborg
2004-10-29 19:51           ` Russell King
2004-10-29 22:36             ` 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=20041028190119.GC9004@mars.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=akpm@osdl.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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