Makefile 1.3 KB

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