Makefile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include $(TOPDIR)/rules.mk
  4. TARGETS:=binutils gmp mpfr gcc
  5. ifeq ($(ADK_TARGET_LIB_GLIBC),y)
  6. TARGETS+=glibc
  7. LIBC:=glibc
  8. else
  9. TARGETS+=uClibc
  10. LIBC:=uClibc
  11. endif
  12. TARGETS+=gdb
  13. DOWNLOAD:=kernel-headers-download $(patsubst %,%-download,$(TARGETS))
  14. TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS))
  15. TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
  16. all: install
  17. install: $(TARGETS_INSTALL)
  18. clean: $(TARGETS_CLEAN)
  19. download: $(DOWNLOAD)
  20. $(LIBC)-prepare: kernel-headers-prepare
  21. binutils-prepare: $(LIBC)-prepare
  22. gcc-configure: binutils-install gmp-install mpfr-install
  23. $(LIBC)-compile: gcc-configure
  24. gcc-compile: $(LIBC)-install
  25. $(STAGING_TOOLS):
  26. @mkdir -p $(STAGING_TOOLS)/lib
  27. @mkdir -p $(STAGING_TOOLS)/include
  28. @mkdir -p $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)
  29. @ln -sf ../lib $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/lib
  30. $(TOOLCHAIN_BUILD_DIR):
  31. @mkdir -p $(TOOLCHAIN_BUILD_DIR)
  32. %-download:
  33. $(TRACE) toolchain/$(patsubst %-download,%,$@)/download
  34. $(MAKE) -C $(patsubst %-download,%,$@) fetch
  35. %-prepare: $(STAGING_TOOLS) $(TOOLCHAIN_BUILD_DIR)
  36. $(TRACE) toolchain/$(patsubst %-prepare,%,$@)/prepare
  37. @if test x"$(patsubst %-prepare,%,$@)" = x"$(LIBC)"; then \
  38. $(MAKE) -C $(patsubst %-prepare,%,$@) prepare \
  39. $(MAKE_TRACE); \
  40. else \
  41. $(MAKE) -C $(patsubst %-prepare,%,$@) prepare \
  42. CC='$(HOSTCC)' CFLAGS='$(HOSTCFLAGS)' \
  43. $(MAKE_TRACE); \
  44. fi
  45. %-configure: %-prepare
  46. $(TRACE) toolchain/$(patsubst %-configure,%,$@)/configure
  47. @if test x"$(patsubst %-configure,%,$@)" = x"$(LIBC)"; then \
  48. $(MAKE) -C $(patsubst %-configure,%,$@) configure \
  49. $(MAKE_TRACE); \
  50. else \
  51. $(MAKE) -C $(patsubst %-configure,%,$@) configure \
  52. CC='$(HOSTCC)' CFLAGS='$(HOSTCFLAGS)' \
  53. $(MAKE_TRACE); \
  54. fi
  55. %-compile: %-configure
  56. $(TRACE) toolchain/$(patsubst %-compile,%,$@)/compile
  57. @if test x"$(patsubst %-compile,%,$@)" = x"$(LIBC)"; then \
  58. $(MAKE) -C $(patsubst %-compile,%,$@) compile \
  59. $(MAKE_TRACE); \
  60. else \
  61. $(MAKE) -C $(patsubst %-compile,%,$@) compile \
  62. CC='$(HOSTCC)' CFLAGS='$(HOSTCFLAGS)' \
  63. $(MAKE_TRACE); \
  64. fi
  65. %-install: %-compile
  66. $(TRACE) toolchain/$(patsubst %-install,%,$@)/install
  67. @if test x"$(patsubst %-install,%,$@)" = x"$(LIBC)"; then \
  68. $(MAKE) -C $(patsubst %-install,%,$@) install \
  69. $(MAKE_TRACE); \
  70. else \
  71. $(MAKE) -C $(patsubst %-install,%,$@) install \
  72. CC='$(HOSTCC)' CFLAGS='$(HOSTCFLAGS)' \
  73. $(MAKE_TRACE); \
  74. fi
  75. %-clean:
  76. $(TRACE) toolchain/$(patsubst %-clean,%,$@)/clean
  77. @$(MAKE) -C $(patsubst %-clean,%,$@) clean $(MAKE_TRACE)