Kbuild 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #
  2. # Kbuild for top-level directory of the kernel
  3. # This file takes care of the following:
  4. # 1) Generate bounds.h
  5. # 2) Generate timeconst.h
  6. # 3) Generate asm-offsets.h (may need bounds.h and timeconst.h)
  7. # 4) Check for missing system calls
  8. #####
  9. # 1) Generate bounds.h
  10. bounds-file := include/generated/bounds.h
  11. always := $(bounds-file)
  12. targets := kernel/bounds.s
  13. # We use internal kbuild rules to avoid the "is up to date" message from make
  14. kernel/bounds.s: kernel/bounds.c FORCE
  15. $(Q)mkdir -p $(dir $@)
  16. $(call if_changed_dep,cc_s_c)
  17. $(obj)/$(bounds-file): kernel/bounds.s FORCE
  18. $(call filechk,offsets,__LINUX_BOUNDS_H__)
  19. #####
  20. # 2) Generate timeconst.h
  21. timeconst-file := include/generated/timeconst.h
  22. targets += $(timeconst-file)
  23. quiet_cmd_gentimeconst = GEN $@
  24. define cmd_gentimeconst
  25. (echo $(CONFIG_HZ) | bc -q $< ) > $@
  26. endef
  27. define filechk_gentimeconst
  28. (echo $(CONFIG_HZ) | bc -q $< )
  29. endef
  30. $(obj)/$(timeconst-file): kernel/time/timeconst.bc FORCE
  31. $(call filechk,gentimeconst)
  32. #####
  33. # 3) Generate asm-offsets.h
  34. #
  35. offsets-file := include/generated/asm-offsets.h
  36. always += $(offsets-file)
  37. targets += arch/$(SRCARCH)/kernel/asm-offsets.s
  38. # We use internal kbuild rules to avoid the "is up to date" message from make
  39. arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
  40. $(obj)/$(timeconst-file) $(obj)/$(bounds-file) FORCE
  41. $(Q)mkdir -p $(dir $@)
  42. $(call if_changed_dep,cc_s_c)
  43. $(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
  44. $(call filechk,offsets,__ASM_OFFSETS_H__)
  45. #####
  46. # 4) Check for missing system calls
  47. #
  48. always += missing-syscalls
  49. targets += missing-syscalls
  50. quiet_cmd_syscalls = CALL $<
  51. cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
  52. missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
  53. $(call cmd,syscalls)
  54. # Keep these three files during make clean
  55. no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file)