fix grub segfaults on hosts where gcc is built with stack smashing protection
[openwrt/staging/chunkeey.git] / target / linux / x86-2.6 / image / grub / Makefile
1 #
2 # Copyright (C) 2006 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
9 include $(TOPDIR)/rules.mk
10 include $(INCLUDE_DIR)/kernel.mk
11
12 PKG_NAME:=grub
13 PKG_VERSION:=0.97
14 PKG_RELEASE:=1
15
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=ftp://alpha.gnu.org/gnu/grub
18 PKG_MD5SUM:=cd3f3eb54446be6003156158d51f4884
19 PKG_CAT:=zcat
20
21 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/grub-$(PKG_VERSION)
22
23 include $(INCLUDE_DIR)/package.mk
24
25 ifeq ($(HOST_ARCH),x86_64)
26 define Build/Configure
27 (cd $(PKG_BUILD_DIR); \
28 LDFLAGS="-static" \
29 ./configure \
30 --target=$(GNU_TARGET_NAME) \
31 --host=$(GNU_TARGET_NAME) \
32 --build=$(GNU_HOST_NAME) \
33 --program-prefix="" \
34 --program-suffix="" \
35 --prefix=/usr \
36 --exec-prefix=/usr \
37 --bindir=/usr/bin \
38 --sbindir=/usr/sbin \
39 --libexecdir=/usr/lib \
40 --sysconfdir=/etc \
41 --datadir=/usr/share \
42 --localstatedir=/var \
43 --mandir=/usr/man \
44 --infodir=/usr/info \
45 $(DISABLE_NLS) \
46 --disable-auto-linux-mem-opt \
47 )
48 endef
49 else
50 define Build/Configure
51 (cd $(PKG_BUILD_DIR); \
52 LDFLAGS="-static" \
53 ./configure \
54 --program-prefix="" \
55 --program-suffix="" \
56 --prefix=/usr \
57 --exec-prefix=/usr \
58 --bindir=/usr/bin \
59 --sbindir=/usr/sbin \
60 --libexecdir=/usr/lib \
61 --sysconfdir=/etc \
62 --datadir=/usr/share \
63 --localstatedir=/var \
64 --mandir=/usr/man \
65 --infodir=/usr/info \
66 $(DISABLE_NLS) \
67 --disable-auto-linux-mem-opt \
68 )
69 endef
70 endif
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)" \
85 install
86 endef
87
88 $(eval $(call Build/DefaultTargets))