]>
Commit | Line | Data |
---|---|---|
86feeaa8 SR |
1 | # |
2 | # Kbuild for top-level directory of the kernel | |
3 | # This file takes care of the following: | |
4 | # 1) Generate asm-offsets.h | |
c53aeca0 | 5 | # 2) Check for missing system calls |
86feeaa8 SR |
6 | |
7 | ##### | |
8d36a623 | 8 | # 1) Generate asm-offsets.h |
86feeaa8 SR |
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 | |
16 | ||
048eb582 SR |
17 | # Default sed regexp - multiline due to syntax constraints |
18 | define sed-y | |
19 | "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" | |
20 | endef | |
21 | # Override default regexp for specific architectures | |
0947640f | 22 | sed-$(CONFIG_MIPS) := "/^@@@/{s/^@@@//; s/ \#.*\$$//; p;}" |
048eb582 | 23 | |
86feeaa8 SR |
24 | quiet_cmd_offsets = GEN $@ |
25 | define cmd_offsets | |
86feeaa8 SR |
26 | (set -e; \ |
27 | echo "#ifndef __ASM_OFFSETS_H__"; \ | |
28 | echo "#define __ASM_OFFSETS_H__"; \ | |
29 | echo "/*"; \ | |
30 | echo " * DO NOT MODIFY."; \ | |
31 | echo " *"; \ | |
65ff22ee | 32 | echo " * This file was generated by Kbuild"; \ |
86feeaa8 SR |
33 | echo " *"; \ |
34 | echo " */"; \ | |
35 | echo ""; \ | |
ac448afb | 36 | sed -ne $(sed-y) $<; \ |
86feeaa8 SR |
37 | echo ""; \ |
38 | echo "#endif" ) > $@ | |
39 | endef | |
40 | ||
41 | # We use internal kbuild rules to avoid the "is up to date" message from make | |
42 | arch/$(ARCH)/kernel/asm-offsets.s: arch/$(ARCH)/kernel/asm-offsets.c FORCE | |
43 | $(Q)mkdir -p $(dir $@) | |
44 | $(call if_changed_dep,cc_s_c) | |
45 | ||
8d36a623 | 46 | $(obj)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild |
ac448afb | 47 | $(Q)mkdir -p $(dir $@) |
86feeaa8 SR |
48 | $(call cmd,offsets) |
49 | ||
c53aeca0 SR |
50 | ##### |
51 | # 2) Check for missing system calls | |
52 | # | |
53 | ||
54 | quiet_cmd_syscalls = CALL $< | |
55 | cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) | |
56 | ||
57 | PHONY += missing-syscalls | |
58 | missing-syscalls: scripts/checksyscalls.sh FORCE | |
59 | $(call cmd,syscalls) |