Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 -mtext-section-literals
  36. KBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
  37. KBUILD_CFLAGS += $(call cc-option,-mno-serialize-volatile,)
  38. KBUILD_AFLAGS += -mlongcalls -mtext-section-literals
  39. ifneq ($(CONFIG_LD_NO_RELAX),)
  40. KBUILD_LDFLAGS := --no-relax
  41. endif
  42. ifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)
  43. CHECKFLAGS += -D__XTENSA_EB__
  44. KBUILD_CPPFLAGS += -DCONFIG_CPU_BIG_ENDIAN
  45. endif
  46. ifeq ($(shell echo __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1)
  47. CHECKFLAGS += -D__XTENSA_EL__
  48. KBUILD_CPPFLAGS += -DCONFIG_CPU_LITTLE_ENDIAN
  49. endif
  50. vardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
  51. plfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
  52. KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs))
  53. KBUILD_DEFCONFIG := iss_defconfig
  54. # Only build variant and/or platform if it includes a Makefile
  55. buildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/)
  56. buildplf := $(shell test -e $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/)
  57. # Find libgcc.a
  58. LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
  59. head-y := arch/xtensa/kernel/head.o
  60. core-y += arch/xtensa/kernel/ arch/xtensa/mm/
  61. core-y += $(buildvar) $(buildplf)
  62. core-y += arch/xtensa/boot/dts/
  63. libs-y += arch/xtensa/lib/ $(LIBGCC)
  64. drivers-$(CONFIG_OPROFILE) += arch/xtensa/oprofile/
  65. boot := arch/xtensa/boot
  66. all Image zImage uImage xipImage: vmlinux
  67. $(Q)$(MAKE) $(build)=$(boot) $@
  68. archheaders:
  69. $(Q)$(MAKE) $(build)=arch/xtensa/kernel/syscalls all
  70. define archhelp
  71. @echo '* Image - Kernel ELF image with reset vector'
  72. @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
  73. @echo '* uImage - U-Boot wrapped image'
  74. @echo ' xipImage - XIP image'
  75. endef