Back to home page

Linux Cross Reference

 
 

    


0001 #
0002 # Kbuild for top-level directory of the kernel
0003 # This file takes care of the following:
0004 # 1) Generate bounds.h
0005 # 2) Generate asm-offsets.h (may need bounds.h)
0006 # 3) Check for missing system calls
0007 
0008 #####
0009 # 1) Generate bounds.h
0010 
0011 bounds-file := include/generated/bounds.h
0012 
0013 always  := $(bounds-file)
0014 targets := $(bounds-file) kernel/bounds.s
0015 
0016 quiet_cmd_bounds = GEN     $@
0017 define cmd_bounds
0018         (set -e; \
0019          echo "#ifndef __LINUX_BOUNDS_H__"; \
0020          echo "#define __LINUX_BOUNDS_H__"; \
0021          echo "/*"; \
0022          echo " * DO NOT MODIFY."; \
0023          echo " *"; \
0024          echo " * This file was generated by Kbuild"; \
0025          echo " *"; \
0026          echo " */"; \
0027          echo ""; \
0028          sed -ne $(sed-y) $<; \
0029          echo ""; \
0030          echo "#endif" ) > $@
0031 endef
0032 
0033 # We use internal kbuild rules to avoid the "is up to date" message from make
0034 kernel/bounds.s: kernel/bounds.c FORCE
0035         $(Q)mkdir -p $(dir $@)
0036         $(call if_changed_dep,cc_s_c)
0037 
0038 $(obj)/$(bounds-file): kernel/bounds.s Kbuild
0039         $(Q)mkdir -p $(dir $@)
0040         $(call cmd,bounds)
0041 
0042 #####
0043 # 2) Generate asm-offsets.h
0044 #
0045 
0046 offsets-file := include/generated/asm-offsets.h
0047 
0048 always  += $(offsets-file)
0049 targets += $(offsets-file)
0050 targets += arch/$(SRCARCH)/kernel/asm-offsets.s
0051 
0052 
0053 # Default sed regexp - multiline due to syntax constraints
0054 define sed-y
0055         "/^->/{s:->#\(.*\):/* \1 */:; \
0056         s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
0057         s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
0058         s:->::; p;}"
0059 endef
0060 
0061 quiet_cmd_offsets = GEN     $@
0062 define cmd_offsets
0063         (set -e; \
0064          echo "#ifndef __ASM_OFFSETS_H__"; \
0065          echo "#define __ASM_OFFSETS_H__"; \
0066          echo "/*"; \
0067          echo " * DO NOT MODIFY."; \
0068          echo " *"; \
0069          echo " * This file was generated by Kbuild"; \
0070          echo " *"; \
0071          echo " */"; \
0072          echo ""; \
0073          sed -ne $(sed-y) $<; \
0074          echo ""; \
0075          echo "#endif" ) > $@
0076 endef
0077 
0078 # We use internal kbuild rules to avoid the "is up to date" message from make
0079 arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
0080                                       $(obj)/$(bounds-file) FORCE
0081         $(Q)mkdir -p $(dir $@)
0082         $(call if_changed_dep,cc_s_c)
0083 
0084 $(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild
0085         $(call cmd,offsets)
0086 
0087 #####
0088 # 3) Check for missing system calls
0089 #
0090 
0091 always += missing-syscalls
0092 targets += missing-syscalls
0093 
0094 quiet_cmd_syscalls = CALL    $<
0095       cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
0096 
0097 missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
0098         $(call cmd,syscalls)
0099 
0100 # Keep these two files during make clean
0101 no-clean-files := $(bounds-file) $(offsets-file)