rules.mk 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include $(TOPDIR)/prereq.mk
  4. -include $(TOPDIR)/.config
  5. ifeq ($(VERBOSE),1)
  6. START_TRACE:= :
  7. END_TRACE:= :
  8. TRACE:= :
  9. CMD_TRACE:= :
  10. PKG_TRACE:= :
  11. MAKE_TRACE:=
  12. EXTRA_MAKEFLAGS:=
  13. SET_DASHX:= set -x
  14. else
  15. START_TRACE:= echo -n "---> "
  16. END_TRACE:= echo
  17. TRACE:= echo "---> "
  18. CMD_TRACE:= echo -n
  19. PKG_TRACE:= echo "------> "
  20. EXTRA_MAKEFLAGS:= -s
  21. MAKE_TRACE:= >/dev/null 2>&1 || { echo "Build failed. Please re-run make with v to see what's going on"; false; }
  22. SET_DASHX:= :
  23. endif
  24. # Strip off the annoying quoting
  25. ADK_TARGET_ARCH:= $(strip $(subst ",, $(ADK_TARGET_ARCH)))
  26. ADK_TARGET_SYSTEM:= $(strip $(subst ",, $(ADK_TARGET_SYSTEM)))
  27. ADK_TARGET_LIBC:= $(strip $(subst ",, $(ADK_TARGET_LIBC)))
  28. ADK_TARGET_ENDIAN:= $(strip $(subst ",, $(ADK_TARGET_ENDIAN)))
  29. ADK_TARGET_CPU_ARCH:= $(strip $(subst ",, $(ADK_TARGET_CPU_ARCH)))
  30. ADK_TARGET_CFLAGS:= $(strip $(subst ",, $(ADK_TARGET_CFLAGS)))
  31. ADK_TARGET_ABI_CFLAGS:= $(strip $(subst ",, $(ADK_TARGET_ABI_CFLAGS)))
  32. ADK_TARGET_ABI:= $(strip $(subst ",, $(ADK_TARGET_ABI)))
  33. ADK_TARGET_IP:= $(strip $(subst ",, $(ADK_TARGET_IP)))
  34. ADK_TARGET_SUFFIX:= $(strip $(subst ",, $(ADK_TARGET_SUFFIX)))
  35. ADK_TARGET_CMDLINE:= $(strip $(subst ",, $(ADK_TARGET_CMDLINE)))
  36. ADK_RUNTIME_TMPFS_SIZE:= $(strip $(subst ",, $(ADK_RUNTIME_TMPFS_SIZE)))
  37. ADK_RUNTIME_CONSOLE_SERIAL_SPEED:= $(strip $(subst ",, $(ADK_RUNTIME_CONSOLE_SERIAL_SPEED)))
  38. ADK_HOST:= $(strip $(subst ",, $(ADK_HOST)))
  39. ADK_VENDOR:= $(strip $(subst ",, $(ADK_VENDOR)))
  40. ADK_TOOLS_ADDPATTERN_ARGS:= $(strip $(subst ",, $(ADK_TOOLS_ADDPATTERN_ARGS)))
  41. ifeq ($(strip ${ADK_HAVE_DOT_CONFIG}),y)
  42. ifneq ($(strip $(wildcard $(TOPDIR)/target/$(ADK_TARGET_ARCH)/target.mk)),)
  43. include $(TOPDIR)/target/$(ADK_TARGET_ARCH)/target.mk
  44. endif
  45. endif
  46. ifneq (${DEBUG},)
  47. ADK_DEBUG:=y
  48. endif
  49. ifneq (${STATIC},)
  50. ADK_STATIC:=y
  51. endif
  52. include $(TOPDIR)/mk/vars.mk
  53. CPPFLAGS_FOR_BUILD?=
  54. CFLAGS_FOR_BUILD?= -O2 -Wall
  55. CXXFLAGS_FOR_BUILD?= -O2 -Wall
  56. LDFLAGS_FOR_BUILD?=
  57. FLAGS_FOR_BUILD:= ${CPPFLAGS_FOR_BUILD} ${CFLAGS_FOR_BUILD} ${LDFLAGS_FOR_BUILD}
  58. ifneq (${show},)
  59. .DEFAULT_GOAL:= show
  60. show:
  61. @$(info ${${show}})
  62. else ifneq (${dump},)
  63. __shquote= '$(subst ','\'',$(1))'
  64. __dumpvar= echo $(call __shquote,$(1)=$(call __shquote,${$(1)}))
  65. .DEFAULT_GOAL:= show
  66. show:
  67. @$(foreach _s,${dump},$(call __dumpvar,${_s});)
  68. endif