Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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_S6105) := s6105
  31. platform-$(CONFIG_XTENSA_PLATFORM_XTFPGA) := xtfpga
  32. PLATFORM = $(platform-y)
  33. export PLATFORM
  34. # temporarily until string.h is fixed
  35. KBUILD_CFLAGS += -ffreestanding -D__linux__
  36. KBUILD_CFLAGS += -pipe -mlongcalls
  37. KBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
  38. ifneq ($(CONFIG_LD_NO_RELAX),)
  39. LDFLAGS := --no-relax
  40. endif
  41. ifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)
  42. CHECKFLAGS += -D__XTENSA_EB__
  43. endif
  44. ifeq ($(shell echo __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1)
  45. CHECKFLAGS += -D__XTENSA_EL__
  46. endif
  47. vardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
  48. plfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
  49. ifeq ($(KBUILD_SRC),)
  50. KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(vardirs) $(plfdirs))
  51. else
  52. KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs))
  53. endif
  54. KBUILD_DEFCONFIG := iss_defconfig
  55. # Only build variant and/or platform if it includes a Makefile
  56. buildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/)
  57. buildplf := $(shell test -e $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/)
  58. # Find libgcc.a
  59. LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
  60. head-y := arch/xtensa/kernel/head.o
  61. core-y += arch/xtensa/kernel/ arch/xtensa/mm/
  62. core-y += $(buildvar) $(buildplf)
  63. libs-y += arch/xtensa/lib/ $(LIBGCC)
  64. drivers-$(CONFIG_OPROFILE) += arch/xtensa/oprofile/
  65. ifneq ($(CONFIG_BUILTIN_DTB),"")
  66. core-$(CONFIG_OF) += arch/xtensa/boot/dts/
  67. endif
  68. boot := arch/xtensa/boot
  69. all: zImage
  70. bzImage : zImage
  71. zImage: vmlinux
  72. $(Q)$(MAKE) $(build)=$(boot) $@
  73. %.dtb:
  74. $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
  75. define archhelp
  76. @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
  77. endef