Makefile.rules 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ifeq ("$(origin V)", "command line")
  2. BUILD_VERBOSE = $(V)
  3. endif
  4. ifndef BUILD_VERBOSE
  5. BUILD_VERBOSE = 0
  6. endif
  7. ifeq ($(BUILD_VERBOSE),1)
  8. quiet =
  9. Q =
  10. else
  11. quiet = quiet_
  12. Q = @
  13. endif
  14. export Q quiet BUILD_VERBOSE
  15. squote := '
  16. escsq = $(subst $(squote),'\$(squote)',$1)
  17. echo-cmd = $(if $($(quiet)cmd_$(1)), echo ' $(call escsq,$($(quiet)cmd_$(1)))';)
  18. cmd = @$(echo-cmd) $(cmd_$(1))
  19. quiet_cmd_generated_offsets_s = [ $@ ]
  20. cmd_generated_offsets_s = $(CC) $(CFLAGS) $(defs) -S $< -o $@
  21. generated-offsets.s: generated-offsets.c $(filter-out asm-offsets.h,$(headers))
  22. $(call cmd,generated_offsets_s)
  23. CLEAN_FILES += generated-offsets.s
  24. quiet_cmd_asm_offsets_h = [ $@ ]
  25. cmd_asm_offsets_h = \
  26. (set -e; \
  27. echo "/* DO NOT MODIFY. THIS FILE WAS AUTO-GENERATED. */"; \
  28. echo "\#ifndef _ASM_OFFSETS_H_"; \
  29. echo "\#define _ASM_OFFSETS_H_"; \
  30. echo ""; \
  31. awk '/\.ascii "GENERATED_INTEGER/{print "\#ifndef " $$3 "\n\#define " $$3 " " $$4 "\n\#endif"}' $^; \
  32. echo ""; \
  33. echo "\#endif") > $@
  34. asm-offsets.h: generated-offsets.s
  35. $(call cmd,asm_offsets_h)
  36. CLEAN_FILES += asm-offsets.h
  37. quiet_cmd_generated_offsets_py = [ $@ ]
  38. cmd_generated_offsets_py = \
  39. (set -e; \
  40. echo "\# DO NOT MODIFY. THIS FILE WAS AUTO-GENERATED."; \
  41. echo ""; \
  42. awk '/\.ascii "GENERATED_INTEGER/{print $$3 " = " $$4}' $^) > $@
  43. generated_offsets.py: generated-offsets.s
  44. $(call cmd,generated_offsets_py)
  45. CLEAN_FILES += generated_offsets.py generated_offsets.pyc
  46. quiet_cmd_ln_sf = [ $@ ]
  47. cmd_ln_sf = ln -sf $(abspath $<) $@