busybox: fix configured stampfile name - add $(SH_FUNC) for md5s
[openwrt.git] / package / busybox / Makefile
1
2 # Copyright (C) 2006-2010 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
10 PKG_NAME:=busybox
11 PKG_VERSION:=1.17.3
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://www.busybox.net/downloads \
16                 http://distfiles.gentoo.org/distfiles/
17 PKG_MD5SUM:=a2ce1a951571da8c6e0eaf75b1acef60
18
19 PKG_BUILD_PARALLEL:=1
20
21 include $(INCLUDE_DIR)/package.mk
22
23 ifeq ($(DUMP),)
24   STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | md5s)
25 endif
26
27 init-y :=
28 init-$(CONFIG_BUSYBOX_CONFIG_HTTPD) += httpd
29 init-$(CONFIG_BUSYBOX_CONFIG_CROND) += cron
30 init-$(CONFIG_BUSYBOX_CONFIG_TELNETD) += telnet
31
32 define Package/busybox
33   SECTION:=base
34   CATEGORY:=Base system
35   MAINTAINER:=Nicolas Thill <nico@openwrt.org>
36   TITLE:=Core utilities for embedded Linux
37   URL:=http://busybox.net/
38   MENU:=1
39 endef
40
41 define Package/busybox/description
42  The Swiss Army Knife of embedded Linux.
43  It slices, it dices, it makes Julian Fries.
44 endef
45
46 define Package/busybox/config
47         source "$(SOURCE)/Config.in"
48 endef
49
50 define Build/Configure
51         rm -f $(PKG_BUILD_DIR)/.configured*
52         grep 'CONFIG_BUSYBOX_' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_\\(.*\\),\\1\\2,g" > $(PKG_BUILD_DIR)/.config
53         yes '' | $(MAKE) -C $(PKG_BUILD_DIR) \
54                 CC="$(TARGET_CC)" \
55                 CROSS_COMPILE="$(TARGET_CROSS)" \
56                 KBUILD_HAVE_NLS=no \
57                 ARCH="$(ARCH)" \
58                 oldconfig
59 endef
60
61 ifdef CONFIG_GCC_VERSION_LLVM
62   TARGET_CFLAGS += -fnested-functions
63 endif
64
65 ifdef CONFIG_GCC_VERSION_4_5_0
66   TARGET_CFLAGS += -fno-tree-pta
67 endif
68
69 define Build/Compile
70         $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
71                 CC="$(TARGET_CC)" \
72                 CROSS_COMPILE="$(TARGET_CROSS)" \
73                 KBUILD_HAVE_NLS=no \
74                 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
75                 ARCH="$(ARCH)" \
76                 SKIP_STRIP=y \
77                 all
78         rm -rf $(PKG_INSTALL_DIR)
79         $(FIND) $(PKG_BUILD_DIR) -lname "*busybox" -exec rm \{\} \;
80         $(MAKE) -C $(PKG_BUILD_DIR) \
81                 CC="$(TARGET_CC)" \
82                 CROSS_COMPILE="$(TARGET_CROSS)" \
83                 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
84                 ARCH="$(ARCH)" \
85                 CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
86                 install
87 endef
88
89 define Package/busybox/install
90         $(INSTALL_DIR) $(1)/etc/init.d
91         $(CP) $(PKG_INSTALL_DIR)/* $(1)/
92         for tmp in $(init-y); do \
93                 $(INSTALL_BIN) ./files/$$$$tmp $(1)/etc/init.d/$$$$tmp; \
94         done
95         -rm -rf $(1)/lib64
96 endef
97
98 $(eval $(call BuildPackage,busybox))