Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #
  2. # This file is subject to the terms and conditions of the GNU General Public
  3. # License. See the file "COPYING" in the main directory of this archive
  4. # for more details.
  5. #
  6. # Copyright (C) 2001 - 2005 Tensilica Inc.
  7. # Copyright (C) 2014 Cadence Design Systems Inc.
  8. #
  9. # This file is included by the global makefile so that you can add your own
  10. # architecture-specific flags and dependencies. Remember to do have actions
  11. # for "archclean" and "archdep" for cleaning up and making dependencies for
  12. # this architecture
  13. # Core configuration.
  14. # (Use VAR=<xtensa_config> to use another default compiler.)
  15. variant-y := $(patsubst "%",%,$(CONFIG_XTENSA_VARIANT_NAME))
  16. VARIANT = $(variant-y)
  17. export VARIANT
  18. # Test for cross compiling
  19. ifneq ($(VARIANT),)
  20. COMPILE_ARCH = $(shell uname -m)
  21. ifneq ($(COMPILE_ARCH), xtensa)
  22. ifndef CROSS_COMPILE
  23. CROSS_COMPILE = xtensa_$(VARIANT)-
  24. endif
  25. endif
  26. endif
  27. # Platform configuration
  28. platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000
  29. platform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss
  30. platform-$(CONFIG_XTENSA_PLATFORM_XTFPGA) := xtfpga
  31. PLATFORM = $(platform-y)
  32. export PLATFORM
  33. # temporarily until string.h is fixed
  34. KBUILD_CFLAGS += -ffreestanding -D__linux__
  35. KBUILD_CFLAGS += -pipe -mlongcalls
  36. KBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
  37. ifneq ($(CONFIG_LD_NO_RELAX),)
  38. LDFLAGS := --no-relax
  39. endif
  40. ifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)
  41. CHECKFLAGS += -D__XTENSA_EB__
  42. KBUILD_CPPFLAGS += -DCONFIG_CPU_BIG_ENDIAN
  43. endif
  44. ifeq ($(shell echo __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1)
  45. CHECKFLAGS += -D__XTENSA_EL__
  46. KBUILD_CPPFLAGS += -DCONFIG_CPU_LITTLE_ENDIAN
  47. endif
  48. vardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
  49. plfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
  50. ifeq ($(KBUILD_SRC),)
  51. KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(vardirs) $(plfdirs))
  52. else
  53. KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs))
  54. endif
  55. KBUILD_DEFCONFIG := iss_defconfig
  56. # Only build variant and/or platform if it includes a Makefile
  57. buildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/)
  58. buildplf := $(shell test -e $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/)
  59. # Find libgcc.a
  60. LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
  61. head-y := arch/xtensa/kernel/head.o
  62. core-y += arch/xtensa/kernel/ arch/xtensa/mm/
  63. core-y += $(buildvar) $(buildplf)
  64. libs-y += arch/xtensa/lib/ $(LIBGCC)
  65. drivers-$(CONFIG_OPROFILE) += arch/xtensa/oprofile/
  66. ifneq ($(CONFIG_BUILTIN_DTB),"")
  67. core-$(CONFIG_OF) += arch/xtensa/boot/dts/
  68. endif
  69. boot := arch/xtensa/boot
  70. all: zImage
  71. bzImage : zImage
  72. zImage: vmlinux
  73. $(Q)$(MAKE) $(build)=$(boot) $@
  74. %.dtb:
  75. $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
  76. dtbs: scripts
  77. $(Q)$(MAKE) $(build)=$(boot)/dts
  78. define archhelp
  79. @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
  80. @echo ' dtbs - Build device tree blobs for enabled boards'
  81. endef