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