Blame view

Kbuild 2.12 KB
86feeaa81   Sam Ravnborg   kbuild: full depe...
1
2
3
  #
  # Kbuild for top-level directory of the kernel
  # This file takes care of the following:
1cdf25d70   Christoph Lameter   kbuild: create a ...
4
5
6
  # 1) Generate bounds.h
  # 2) Generate asm-offsets.h (may need bounds.h)
  # 3) Check for missing system calls
86feeaa81   Sam Ravnborg   kbuild: full depe...
7

39664e2f3   Masahiro Yamada   kbuild: merge bou...
8
9
10
11
12
13
14
  # Default sed regexp - multiline due to syntax constraints
  define sed-y
  	"/^->/{s:->#\(.*\):/* \1 */:; \
  	s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
  	s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
  	s:->::; p;}"
  endef
1cdf25d70   Christoph Lameter   kbuild: create a ...
15

39664e2f3   Masahiro Yamada   kbuild: merge bou...
16
17
  quiet_cmd_offsets = GEN     $@
  define cmd_offsets
1cdf25d70   Christoph Lameter   kbuild: create a ...
18
  	(set -e; \
39664e2f3   Masahiro Yamada   kbuild: merge bou...
19
20
  	 echo "#ifndef $2"; \
  	 echo "#define $2"; \
1cdf25d70   Christoph Lameter   kbuild: create a ...
21
22
23
24
  	 echo "/*"; \
  	 echo " * DO NOT MODIFY."; \
  	 echo " *"; \
  	 echo " * This file was generated by Kbuild"; \
1cdf25d70   Christoph Lameter   kbuild: create a ...
25
26
27
28
29
30
  	 echo " */"; \
  	 echo ""; \
  	 sed -ne $(sed-y) $<; \
  	 echo ""; \
  	 echo "#endif" ) > $@
  endef
39664e2f3   Masahiro Yamada   kbuild: merge bou...
31
32
33
34
35
36
37
  #####
  # 1) Generate bounds.h
  
  bounds-file := include/generated/bounds.h
  
  always  := $(bounds-file)
  targets := $(bounds-file) kernel/bounds.s
1cdf25d70   Christoph Lameter   kbuild: create a ...
38
39
40
41
42
43
44
  # We use internal kbuild rules to avoid the "is up to date" message from make
  kernel/bounds.s: kernel/bounds.c FORCE
  	$(Q)mkdir -p $(dir $@)
  	$(call if_changed_dep,cc_s_c)
  
  $(obj)/$(bounds-file): kernel/bounds.s Kbuild
  	$(Q)mkdir -p $(dir $@)
39664e2f3   Masahiro Yamada   kbuild: merge bou...
45
  	$(call cmd,offsets,__LINUX_BOUNDS_H__)
1cdf25d70   Christoph Lameter   kbuild: create a ...
46
47
48
  
  #####
  # 2) Generate asm-offsets.h
86feeaa81   Sam Ravnborg   kbuild: full depe...
49
  #
559df2e02   Sam Ravnborg   kbuild: move asm-...
50
  offsets-file := include/generated/asm-offsets.h
86feeaa81   Sam Ravnborg   kbuild: full depe...
51

1cdf25d70   Christoph Lameter   kbuild: create a ...
52
53
  always  += $(offsets-file)
  targets += $(offsets-file)
6752ed90d   Thomas Gleixner   Kbuild: allow arc...
54
  targets += arch/$(SRCARCH)/kernel/asm-offsets.s
1cdf25d70   Christoph Lameter   kbuild: create a ...
55

86feeaa81   Sam Ravnborg   kbuild: full depe...
56
  # We use internal kbuild rules to avoid the "is up to date" message from make
1cdf25d70   Christoph Lameter   kbuild: create a ...
57
58
  arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
                                        $(obj)/$(bounds-file) FORCE
86feeaa81   Sam Ravnborg   kbuild: full depe...
59
60
  	$(Q)mkdir -p $(dir $@)
  	$(call if_changed_dep,cc_s_c)
6752ed90d   Thomas Gleixner   Kbuild: allow arc...
61
  $(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild
39664e2f3   Masahiro Yamada   kbuild: merge bou...
62
  	$(call cmd,offsets,__ASM_OFFSETS_H__)
86feeaa81   Sam Ravnborg   kbuild: full depe...
63

c53aeca05   Sam Ravnborg   kbuild: complain ...
64
  #####
1cdf25d70   Christoph Lameter   kbuild: create a ...
65
  # 3) Check for missing system calls
c53aeca05   Sam Ravnborg   kbuild: complain ...
66
  #
5f7efb4c6   Arnaud Lacombe   Kbuild: append mi...
67
68
  always += missing-syscalls
  targets += missing-syscalls
c53aeca05   Sam Ravnborg   kbuild: complain ...
69
  quiet_cmd_syscalls = CALL    $<
44656fa03   David Daney   kbuild: Fix missi...
70
        cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
c53aeca05   Sam Ravnborg   kbuild: complain ...
71

5f7efb4c6   Arnaud Lacombe   Kbuild: append mi...
72
  missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
c53aeca05   Sam Ravnborg   kbuild: complain ...
73
  	$(call cmd,syscalls)
1cdf25d70   Christoph Lameter   kbuild: create a ...
74

ef8ff89b5   Michal Marek   kbuild: Really do...
75
76
  # Keep these two files during make clean
  no-clean-files := $(bounds-file) $(offsets-file)