blob: 163f8cb020a489a5f62d3ca995702b5565bc94e3 [file] [log] [blame]
Sam Ravnborg86feeaa2005-09-09 19:28:28 +02001#
2# Kbuild for top-level directory of the kernel
3# This file takes care of the following:
4# 1) Generate asm-offsets.h
Sam Ravnborgc53aeca2007-03-27 22:50:29 +02005# 2) Check for missing system calls
Sam Ravnborg86feeaa2005-09-09 19:28:28 +02006
7#####
Sam Ravnborg8d36a622005-09-10 21:05:36 +02008# 1) Generate asm-offsets.h
Sam Ravnborg86feeaa2005-09-09 19:28:28 +02009#
10
11offsets-file := include/asm-$(ARCH)/asm-offsets.h
12
13always := $(offsets-file)
14targets := $(offsets-file)
15targets += arch/$(ARCH)/kernel/asm-offsets.s
16
Sam Ravnborg048eb582005-09-09 22:32:31 +020017# Default sed regexp - multiline due to syntax constraints
18define sed-y
19 "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"
20endef
21# Override default regexp for specific architectures
Atsushi Nemoto09476402006-03-28 00:18:54 +090022sed-$(CONFIG_MIPS) := "/^@@@/{s/^@@@//; s/ \#.*\$$//; p;}"
Sam Ravnborg048eb582005-09-09 22:32:31 +020023
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020024quiet_cmd_offsets = GEN $@
25define cmd_offsets
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020026 (set -e; \
27 echo "#ifndef __ASM_OFFSETS_H__"; \
28 echo "#define __ASM_OFFSETS_H__"; \
29 echo "/*"; \
30 echo " * DO NOT MODIFY."; \
31 echo " *"; \
Olaf Hering65ff22e2006-07-25 18:42:26 -070032 echo " * This file was generated by Kbuild"; \
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020033 echo " *"; \
34 echo " */"; \
35 echo ""; \
Brian Gerstac448af2006-01-06 18:28:45 -050036 sed -ne $(sed-y) $<; \
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020037 echo ""; \
38 echo "#endif" ) > $@
39endef
40
41# We use internal kbuild rules to avoid the "is up to date" message from make
42arch/$(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
Sam Ravnborg8d36a622005-09-10 21:05:36 +020046$(obj)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild
Brian Gerstac448af2006-01-06 18:28:45 -050047 $(Q)mkdir -p $(dir $@)
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020048 $(call cmd,offsets)
49
Sam Ravnborgc53aeca2007-03-27 22:50:29 +020050#####
51# 2) Check for missing system calls
52#
53
54quiet_cmd_syscalls = CALL $<
55 cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags)
56
57PHONY += missing-syscalls
58missing-syscalls: scripts/checksyscalls.sh FORCE
59 $(call cmd,syscalls)