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 |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 5 | # 2) Check for missing system calls |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 6 | |
| 7 | ##### |
Sam Ravnborg | 8d36a62 | 2005-09-10 21:05:36 +0200 | [diff] [blame] | 8 | # 1) Generate asm-offsets.h |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 9 | # |
| 10 | |
| 11 | offsets-file := include/asm-$(ARCH)/asm-offsets.h |
| 12 | |
| 13 | always := $(offsets-file) |
| 14 | targets := $(offsets-file) |
| 15 | targets += arch/$(ARCH)/kernel/asm-offsets.s |
Sam Ravnborg | f241182 | 2007-05-28 22:14:37 +0200 | [diff] [blame^] | 16 | clean-files := $(addprefix $(objtree)/,$(targets)) |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 17 | |
Sam Ravnborg | 048eb58 | 2005-09-09 22:32:31 +0200 | [diff] [blame] | 18 | # Default sed regexp - multiline due to syntax constraints |
| 19 | define sed-y |
| 20 | "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" |
| 21 | endef |
| 22 | # Override default regexp for specific architectures |
Atsushi Nemoto | 0947640 | 2006-03-28 00:18:54 +0900 | [diff] [blame] | 23 | sed-$(CONFIG_MIPS) := "/^@@@/{s/^@@@//; s/ \#.*\$$//; p;}" |
Sam Ravnborg | 048eb58 | 2005-09-09 22:32:31 +0200 | [diff] [blame] | 24 | |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 25 | quiet_cmd_offsets = GEN $@ |
| 26 | define cmd_offsets |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 27 | (set -e; \ |
| 28 | echo "#ifndef __ASM_OFFSETS_H__"; \ |
| 29 | echo "#define __ASM_OFFSETS_H__"; \ |
| 30 | echo "/*"; \ |
| 31 | echo " * DO NOT MODIFY."; \ |
| 32 | echo " *"; \ |
Olaf Hering | 65ff22e | 2006-07-25 18:42:26 -0700 | [diff] [blame] | 33 | echo " * This file was generated by Kbuild"; \ |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 34 | echo " *"; \ |
| 35 | echo " */"; \ |
| 36 | echo ""; \ |
Brian Gerst | ac448af | 2006-01-06 18:28:45 -0500 | [diff] [blame] | 37 | sed -ne $(sed-y) $<; \ |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 38 | echo ""; \ |
| 39 | echo "#endif" ) > $@ |
| 40 | endef |
| 41 | |
| 42 | # We use internal kbuild rules to avoid the "is up to date" message from make |
| 43 | arch/$(ARCH)/kernel/asm-offsets.s: arch/$(ARCH)/kernel/asm-offsets.c FORCE |
| 44 | $(Q)mkdir -p $(dir $@) |
| 45 | $(call if_changed_dep,cc_s_c) |
| 46 | |
Sam Ravnborg | 8d36a62 | 2005-09-10 21:05:36 +0200 | [diff] [blame] | 47 | $(obj)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild |
Brian Gerst | ac448af | 2006-01-06 18:28:45 -0500 | [diff] [blame] | 48 | $(Q)mkdir -p $(dir $@) |
Sam Ravnborg | 86feeaa | 2005-09-09 19:28:28 +0200 | [diff] [blame] | 49 | $(call cmd,offsets) |
| 50 | |
Sam Ravnborg | c53aeca | 2007-03-27 22:50:29 +0200 | [diff] [blame] | 51 | ##### |
| 52 | # 2) Check for missing system calls |
| 53 | # |
| 54 | |
| 55 | quiet_cmd_syscalls = CALL $< |
| 56 | cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) |
| 57 | |
| 58 | PHONY += missing-syscalls |
| 59 | missing-syscalls: scripts/checksyscalls.sh FORCE |
| 60 | $(call cmd,syscalls) |