blob: 1880e6f760aab05f139d74400d2477e7c47681da [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
5
6#####
7# 1) Generate asm-offsets.h
8#
9
10offsets-file := include/asm-$(ARCH)/asm-offsets.h
11
12always := $(offsets-file)
13targets := $(offsets-file)
14targets += arch/$(ARCH)/kernel/asm-offsets.s
15
Sam Ravnborg048eb582005-09-09 22:32:31 +020016# Default sed regexp - multiline due to syntax constraints
17define sed-y
18 "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"
19endef
20# Override default regexp for specific architectures
21sed-$(CONFIG_MIPS) := "/^@@@/s///p"
22
Sam Ravnborg86feeaa2005-09-09 19:28:28 +020023quiet_cmd_offsets = GEN $@
24define cmd_offsets
25 cat $< | \
26 (set -e; \
27 echo "#ifndef __ASM_OFFSETS_H__"; \
28 echo "#define __ASM_OFFSETS_H__"; \
29 echo "/*"; \
30 echo " * DO NOT MODIFY."; \
31 echo " *"; \
32 echo " * This file was generated by $(srctree)/Kbuild"; \
33 echo " *"; \
34 echo " */"; \
35 echo ""; \
Sam Ravnborg048eb582005-09-09 22:32:31 +020036 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
46$(srctree)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild
47 $(call cmd,offsets)
48