Kbuild 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #
  2. # Kbuild for top-level directory of the kernel
  3. # This file takes care of the following:
  4. # 1) Generate asm-offsets.h
  5. # 2) Check for missing system calls
  6. #####
  7. # 1) Generate asm-offsets.h
  8. #
  9. offsets-file := include/asm-$(ARCH)/asm-offsets.h
  10. always := $(offsets-file)
  11. targets := $(offsets-file)
  12. targets += arch/$(ARCH)/kernel/asm-offsets.s
  13. # Default sed regexp - multiline due to syntax constraints
  14. define sed-y
  15. "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"
  16. endef
  17. # Override default regexp for specific architectures
  18. sed-$(CONFIG_MIPS) := "/^@@@/{s/^@@@//; s/ \#.*\$$//; p;}"
  19. quiet_cmd_offsets = GEN $@
  20. define cmd_offsets
  21. (set -e; \
  22. echo "#ifndef __ASM_OFFSETS_H__"; \
  23. echo "#define __ASM_OFFSETS_H__"; \
  24. echo "/*"; \
  25. echo " * DO NOT MODIFY."; \
  26. echo " *"; \
  27. echo " * This file was generated by Kbuild"; \
  28. echo " *"; \
  29. echo " */"; \
  30. echo ""; \
  31. sed -ne $(sed-y) $<; \
  32. echo ""; \
  33. echo "#endif" ) > $@
  34. endef
  35. # We use internal kbuild rules to avoid the "is up to date" message from make
  36. arch/$(ARCH)/kernel/asm-offsets.s: arch/$(ARCH)/kernel/asm-offsets.c FORCE
  37. $(Q)mkdir -p $(dir $@)
  38. $(call if_changed_dep,cc_s_c)
  39. $(obj)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild
  40. $(Q)mkdir -p $(dir $@)
  41. $(call cmd,offsets)
  42. #####
  43. # 2) Check for missing system calls
  44. #
  45. quiet_cmd_syscalls = CALL $<
  46. cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags)
  47. PHONY += missing-syscalls
  48. missing-syscalls: scripts/checksyscalls.sh FORCE
  49. $(call cmd,syscalls)