Makefile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. hostprogs-y := modpost mk_elfconfig
  2. always := $(hostprogs-y) empty.o
  3. modpost-objs := modpost.o file2alias.o sumversion.o
  4. devicetable-offsets-file := devicetable-offsets.h
  5. define sed-y
  6. "/^->/{s:->#\(.*\):/* \1 */:; \
  7. s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
  8. s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
  9. s:->::; p;}"
  10. endef
  11. quiet_cmd_offsets = GEN $@
  12. define cmd_offsets
  13. (set -e; \
  14. echo "#ifndef __DEVICETABLE_OFFSETS_H__"; \
  15. echo "#define __DEVICETABLE_OFFSETS_H__"; \
  16. echo "/*"; \
  17. echo " * DO NOT MODIFY."; \
  18. echo " *"; \
  19. echo " * This file was generated by Kbuild"; \
  20. echo " *"; \
  21. echo " */"; \
  22. echo ""; \
  23. sed -ne $(sed-y) $<; \
  24. echo ""; \
  25. echo "#endif" ) > $@
  26. endef
  27. $(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s
  28. $(call if_changed,offsets)
  29. targets += $(devicetable-offsets-file) devicetable-offsets.s
  30. # dependencies on generated files need to be listed explicitly
  31. $(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h
  32. $(obj)/file2alias.o: $(obj)/$(devicetable-offsets-file)
  33. quiet_cmd_elfconfig = MKELF $@
  34. cmd_elfconfig = $(obj)/mk_elfconfig < $< > $@
  35. $(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE
  36. $(call if_changed,elfconfig)
  37. targets += elfconfig.h