Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 1 | # |
| 2 | # Kbuild for top-level directory of the kernel |
| 3 | # This file takes care of the following: |
| 4 | # 1) Generate asm-offsets.h |
| 5 | |
| 6 | ##### |
Sam Ravnborg | 8d36a62 | 2005-09-10 21:05:36 +0200 | [diff] [blame] | 7 | # 1) Generate asm-offsets.h |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 8 | # |
| 9 | |
| 10 | offsets-file := include/asm-$(ARCH)/asm-offsets.h |
| 11 | |
| 12 | always := $(offsets-file) |
| 13 | targets := $(offsets-file) |
| 14 | targets += arch/$(ARCH)/kernel/asm-offsets.s |
| 15 | |
Sam Ravnborg | 048eb58 | 2005-09-09 22:32:31 +0200 | [diff] [blame] | 16 | # Default sed regexp - multiline due to syntax constraints |
| 17 | define sed-y |
| 18 | "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" |
| 19 | endef |
| 20 | # Override default regexp for specific architectures |
| 21 | sed-$(CONFIG_MIPS) := "/^@@@/s///p" |
| 22 | |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 23 | quiet_cmd_offsets = GEN $@ |
| 24 | define cmd_offsets |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 25 | (set -e; \ |
| 26 | echo "#ifndef __ASM_OFFSETS_H__"; \ |
| 27 | echo "#define __ASM_OFFSETS_H__"; \ |
| 28 | echo "/*"; \ |
| 29 | echo " * DO NOT MODIFY."; \ |
| 30 | echo " *"; \ |
| 31 | echo " * This file was generated by $(srctree)/Kbuild"; \ |
| 32 | echo " *"; \ |
| 33 | echo " */"; \ |
| 34 | echo ""; \ |
Brian Gerst | ac448af | 2006-01-06 18:28:45 -0500 | [diff] [blame^] | 35 | sed -ne $(sed-y) $<; \ |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 36 | echo ""; \ |
| 37 | echo "#endif" ) > $@ |
| 38 | endef |
| 39 | |
| 40 | # We use internal kbuild rules to avoid the "is up to date" message from make |
| 41 | arch/$(ARCH)/kernel/asm-offsets.s: arch/$(ARCH)/kernel/asm-offsets.c FORCE |
| 42 | $(Q)mkdir -p $(dir $@) |
| 43 | $(call if_changed_dep,cc_s_c) |
| 44 | |
Sam Ravnborg | 8d36a62 | 2005-09-10 21:05:36 +0200 | [diff] [blame] | 45 | $(obj)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild |
Brian Gerst | ac448af | 2006-01-06 18:28:45 -0500 | [diff] [blame^] | 46 | $(Q)mkdir -p $(dir $@) |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 47 | $(call cmd,offsets) |
| 48 | |