config.mk 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #
  2. # (C) Copyright 2000-2013
  3. # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. #
  5. # SPDX-License-Identifier: GPL-2.0+
  6. #
  7. #########################################################################
  8. # clean the slate ...
  9. PLATFORM_RELFLAGS =
  10. PLATFORM_CPPFLAGS =
  11. PLATFORM_LDFLAGS =
  12. #########################################################################
  13. # Load generated board configuration
  14. ifeq ($(CONFIG_TPL_BUILD),y)
  15. # Include TPL autoconf
  16. sinclude include/tpl-autoconf.mk
  17. else
  18. ifeq ($(CONFIG_SPL_BUILD),y)
  19. # Include SPL autoconf
  20. sinclude include/spl-autoconf.mk
  21. else
  22. # Include normal autoconf
  23. sinclude include/autoconf.mk
  24. endif
  25. endif
  26. sinclude $(OBJTREE)/include/config.mk
  27. # Some architecture config.mk files need to know what CPUDIR is set to,
  28. # so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
  29. # Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
  30. # CPU-specific code.
  31. CPUDIR=arch/$(ARCH)/cpu/$(CPU)
  32. ifneq ($(SRCTREE)/$(CPUDIR),$(wildcard $(SRCTREE)/$(CPUDIR)))
  33. CPUDIR=arch/$(ARCH)/cpu
  34. endif
  35. sinclude $(TOPDIR)/arch/$(ARCH)/config.mk # include architecture dependend rules
  36. sinclude $(TOPDIR)/$(CPUDIR)/config.mk # include CPU specific rules
  37. ifdef SOC
  38. sinclude $(TOPDIR)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules
  39. endif
  40. ifdef VENDOR
  41. BOARDDIR = $(VENDOR)/$(BOARD)
  42. else
  43. BOARDDIR = $(BOARD)
  44. endif
  45. ifdef BOARD
  46. sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk # include board specific rules
  47. endif
  48. #########################################################################
  49. RELFLAGS= $(PLATFORM_RELFLAGS)
  50. OBJCFLAGS += --gap-fill=0xff
  51. CPPFLAGS = $(KBUILD_CPPFLAGS) $(RELFLAGS)
  52. CPPFLAGS += $(UBOOTINCLUDE)
  53. CPPFLAGS += $(NOSTDINC_FLAGS) -pipe $(PLATFORM_CPPFLAGS)
  54. CFLAGS := $(KBUILD_CFLAGS) $(CPPFLAGS)
  55. BCURDIR = $(subst $(SRCTREE)/,,$(CURDIR:$(obj)%=%))
  56. AFLAGS := $(KBUILD_AFLAGS) $(CPPFLAGS)
  57. LDFLAGS += $(PLATFORM_LDFLAGS)
  58. LDFLAGS_FINAL += -Bstatic
  59. #########################################################################
  60. export PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS