config.mk 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # SPDX-License-Identifier: GPL-2.0+
  2. #
  3. # (C) Copyright 2000-2013
  4. # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. #########################################################################
  6. # This file is included from ./Makefile and spl/Makefile.
  7. # Clean the state to avoid the same flags added twice.
  8. #
  9. # (Tegra needs different flags for SPL.
  10. # That's the reason why this file must be included from spl/Makefile too.
  11. # If we did not have Tegra SoCs, build system would be much simpler...)
  12. PLATFORM_RELFLAGS :=
  13. PLATFORM_CPPFLAGS :=
  14. PLATFORM_LDFLAGS :=
  15. LDFLAGS :=
  16. LDFLAGS_FINAL :=
  17. LDFLAGS_STANDALONE :=
  18. OBJCOPYFLAGS :=
  19. # clear VENDOR for tcsh
  20. VENDOR :=
  21. #########################################################################
  22. ARCH := $(CONFIG_SYS_ARCH:"%"=%)
  23. CPU := $(CONFIG_SYS_CPU:"%"=%)
  24. ifdef CONFIG_SPL_BUILD
  25. ifdef CONFIG_TEGRA
  26. CPU := arm720t
  27. endif
  28. endif
  29. BOARD := $(CONFIG_SYS_BOARD:"%"=%)
  30. ifneq ($(CONFIG_SYS_VENDOR),)
  31. VENDOR := $(CONFIG_SYS_VENDOR:"%"=%)
  32. endif
  33. ifneq ($(CONFIG_SYS_SOC),)
  34. SOC := $(CONFIG_SYS_SOC:"%"=%)
  35. endif
  36. # Some architecture config.mk files need to know what CPUDIR is set to,
  37. # so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
  38. # Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
  39. # CPU-specific code.
  40. CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),)
  41. sinclude $(srctree)/arch/$(ARCH)/config.mk # include architecture dependend rules
  42. sinclude $(srctree)/$(CPUDIR)/config.mk # include CPU specific rules
  43. ifdef SOC
  44. sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules
  45. endif
  46. ifneq ($(BOARD),)
  47. ifdef VENDOR
  48. BOARDDIR = $(VENDOR)/$(BOARD)
  49. else
  50. BOARDDIR = $(BOARD)
  51. endif
  52. endif
  53. ifdef BOARD
  54. sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules
  55. endif
  56. ifdef FTRACE
  57. PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE
  58. endif
  59. ifeq ($(BUILD_TYPE),RELEASE)
  60. PLATFORM_CPPFLAGS += -DU_BUILD_RELEASE
  61. else # default build debug
  62. PLATFORM_CPPFLAGS += -DU_BUILD_DEBUG
  63. endif
  64. #########################################################################
  65. RELFLAGS := $(PLATFORM_RELFLAGS)
  66. PLATFORM_CPPFLAGS += $(RELFLAGS)
  67. PLATFORM_CPPFLAGS += -pipe
  68. LDFLAGS += $(PLATFORM_LDFLAGS)
  69. LDFLAGS_FINAL += -Bstatic
  70. export PLATFORM_CPPFLAGS
  71. export RELFLAGS
  72. export LDFLAGS_FINAL
  73. export LDFLAGS_STANDALONE
  74. export CONFIG_STANDALONE_LOAD_ADDR