Makefile 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #
  2. # Copyright (C) 2006-2008 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. # $Id: Makefile 4855 2006-09-24 20:49:31Z nico $
  8. include $(TOPDIR)/rules.mk
  9. include $(INCLUDE_DIR)/kernel.mk
  10. PKG_NAME:=grub
  11. PKG_VERSION:=0.97
  12. PKG_RELEASE:=1
  13. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  14. PKG_SOURCE_URL:=ftp://alpha.gnu.org/gnu/grub
  15. PKG_MD5SUM:=cd3f3eb54446be6003156158d51f4884
  16. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/grub-$(PKG_VERSION)
  17. PKG_TARGETS:=bin
  18. include $(INCLUDE_DIR)/package.mk
  19. export grub_cv_prog_objcopy_absolute=yes
  20. define Package/grub
  21. SECTION:=boot
  22. DEPENDS:=@TARGET_x86
  23. CATEGORY:=Boot Loaders
  24. TITLE:=GRand Unified Bootloader
  25. URL:=http://www.gnu.org/software/grub/
  26. endef
  27. ifeq ($(HOST_OS),Linux)
  28. NATIVEGRUB-i386:=1
  29. NATIVEGRUB-i686:=1
  30. NATIVEGRUB:=$(NATIVEGRUB-$(HOST_ARCH))
  31. endif
  32. ifeq ($(NATIVEGRUB),)
  33. CONFIGURE_FLAGS:= \
  34. --target=$(GNU_TARGET_NAME) \
  35. --host=$(GNU_TARGET_NAME) \
  36. --build=$(GNU_HOST_NAME)
  37. else
  38. CONFIGURE_FLAGS:=
  39. endif
  40. ifneq ($(HOST_OS),Darwin)
  41. define Build/Configure
  42. (cd $(PKG_BUILD_DIR); \
  43. LDFLAGS="-static" \
  44. ./configure \
  45. $(CONFIGURE_FLAGS) \
  46. --program-prefix="" \
  47. --program-suffix="" \
  48. --prefix=/usr \
  49. --exec-prefix=/usr \
  50. --bindir=/usr/bin \
  51. --sbindir=/usr/sbin \
  52. --libexecdir=/usr/lib \
  53. --sysconfdir=/etc \
  54. --datadir=/usr/share \
  55. --localstatedir=/var \
  56. --mandir=/usr/man \
  57. --infodir=/usr/info \
  58. $(DISABLE_NLS) \
  59. --disable-auto-linux-mem-opt \
  60. )
  61. endef
  62. #
  63. # ./configure detects whether the host compiler supports
  64. # -fno-stack-protector but only sets STAGE2_CFLAGS accordingly
  65. #
  66. define Build/Compile
  67. $(MAKE) -C $(PKG_BUILD_DIR) \
  68. GRUB_CFLAGS="\$$$$(STAGE2_CFLAGS)" \
  69. STAGE1_CFLAGS="\$$$$(STAGE2_CFLAGS)"
  70. endef
  71. define Build/InstallDev
  72. $(MAKE) -C $(PKG_BUILD_DIR) \
  73. DESTDIR="$(STAGING_DIR_HOST)" \
  74. install
  75. mv $(STAGING_DIR_HOST)/usr/sbin/grub $(STAGING_DIR_HOST)/bin
  76. endef
  77. endif
  78. $(eval $(call BuildPackage,grub))