Kbuild 1.6 KB

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