blob: 1570d248ad9237e4fa6e4d079336b9da62d9ba32 [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
Thomas Gleixner96a388d2007-10-11 11:20:03 +020011offsets-file := include/asm-$(SRCARCH)/asm-offsets.h
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020012
13always := $(offsets-file)
14targets := $(offsets-file)
Thomas Gleixner6752ed92007-10-11 11:11:36 +020015targets += arch/$(SRCARCH)/kernel/asm-offsets.s
Sam Ravnborgf2411822007-05-28 22:14:37 +020016clean-files := $(addprefix $(objtree)/,$(targets))
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020017
Sam Ravnborg048eb582005-09-09 22:32:31 +020018# Default sed regexp - multiline due to syntax constraints
19define sed-y
20 "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"
21endef
22# Override default regexp for specific architectures
Atsushi Nemoto09476402006-03-28 00:18:54 +090023sed-$(CONFIG_MIPS) := "/^@@@/{s/^@@@//; s/ \#.*\$$//; p;}"
Sam Ravnborg048eb582005-09-09 22:32:31 +020024
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020025quiet_cmd_offsets = GEN $@
26define cmd_offsets
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020027 (set -e; \
28 echo "#ifndef __ASM_OFFSETS_H__"; \
29 echo "#define __ASM_OFFSETS_H__"; \
30 echo "/*"; \
31 echo " * DO NOT MODIFY."; \
32 echo " *"; \
Olaf Hering65ff22e2006-07-25 18:42:26 -070033 echo " * This file was generated by Kbuild"; \
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020034 echo " *"; \
35 echo " */"; \
36 echo ""; \
Brian Gerstac448af2006-01-06 18:28:45 -050037 sed -ne $(sed-y) $<; \
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020038 echo ""; \
39 echo "#endif" ) > $@
40endef
41
42# We use internal kbuild rules to avoid the "is up to date" message from make
Thomas Gleixner6752ed92007-10-11 11:11:36 +020043arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c FORCE
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020044 $(Q)mkdir -p $(dir $@)
45 $(call if_changed_dep,cc_s_c)
46
Thomas Gleixner6752ed92007-10-11 11:11:36 +020047$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild
Brian Gerstac448af2006-01-06 18:28:45 -050048 $(Q)mkdir -p $(dir $@)
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020049 $(call cmd,offsets)
50
Sam Ravnborgc53aeca2007-03-27 22:50:29 +020051#####
52# 2) Check for missing system calls
53#
54
55quiet_cmd_syscalls = CALL $<
56 cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags)
57
58PHONY += missing-syscalls
59missing-syscalls: scripts/checksyscalls.sh FORCE
60 $(call cmd,syscalls)