config.mk 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. KBUILD_LDFLAGS :=
  15. LDFLAGS_FINAL :=
  16. LDFLAGS_STANDALONE :=
  17. OBJCOPYFLAGS :=
  18. # clear VENDOR for tcsh
  19. VENDOR :=
  20. #########################################################################
  21. ARCH := $(CONFIG_SYS_ARCH:"%"=%)
  22. CPU := $(CONFIG_SYS_CPU:"%"=%)
  23. ifdef CONFIG_SPL_BUILD
  24. ifdef CONFIG_ARCH_TEGRA
  25. CPU := arm720t
  26. endif
  27. endif
  28. BOARD := $(CONFIG_SYS_BOARD:"%"=%)
  29. ifneq ($(CONFIG_SYS_VENDOR),)
  30. VENDOR := $(CONFIG_SYS_VENDOR:"%"=%)
  31. endif
  32. ifneq ($(CONFIG_SYS_SOC),)
  33. SOC := $(CONFIG_SYS_SOC:"%"=%)
  34. endif
  35. # Some architecture config.mk files need to know what CPUDIR is set to,
  36. # so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
  37. # Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
  38. # CPU-specific code.
  39. CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),)
  40. sinclude $(srctree)/arch/$(ARCH)/config.mk # include architecture dependend rules
  41. sinclude $(srctree)/$(CPUDIR)/config.mk # include CPU specific rules
  42. ifdef SOC
  43. sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules
  44. endif
  45. ifneq ($(BOARD),)
  46. ifdef VENDOR
  47. BOARDDIR = $(VENDOR)/$(BOARD)
  48. ENVDIR=${vendor}/env
  49. else
  50. BOARDDIR = $(BOARD)
  51. ENVDIR=${board}/env
  52. endif
  53. endif
  54. ifdef BOARD
  55. sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules
  56. endif
  57. ifdef FTRACE
  58. PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE
  59. endif
  60. #########################################################################
  61. RELFLAGS := $(PLATFORM_RELFLAGS)
  62. PLATFORM_CPPFLAGS += $(RELFLAGS)
  63. PLATFORM_CPPFLAGS += -pipe
  64. LDFLAGS_FINAL += -Bstatic
  65. export PLATFORM_CPPFLAGS
  66. export RELFLAGS
  67. export LDFLAGS_FINAL
  68. export LDFLAGS_STANDALONE
  69. export CONFIG_STANDALONE_LOAD_ADDR