Messages in this thread Patch in this message | | | Date | Thu, 28 Oct 2004 21:01:19 +0200 | From | Sam Ravnborg <> | Subject | kbuild: generic support for offsets.h |
| |
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 + - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |