lantiq: Tune the XWAY subtarget cflags
[openwrt/staging/mkresin.git] / package / busybox / Makefile
1 #
2 # Copyright (C) 2006-2013 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.19.4
12 PKG_RELEASE:=6
13 PKG_FLAGS:=essential
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://www.busybox.net/downloads \
17 http://distfiles.gentoo.org/distfiles/
18 PKG_MD5SUM:=9c0cae5a0379228e7b55e5b29528df8e
19
20 PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_FEATURE_HAVE_RPC:librpc
21 PKG_BUILD_PARALLEL:=1
22
23 PKG_LICENSE:=GPLv2 BSD-4c
24 PKG_LICENSE_FILES:=LICENSE archival/libarchive/bz/LICENSE
25
26 include $(INCLUDE_DIR)/package.mk
27
28 ifeq ($(DUMP),)
29 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | md5s)
30 endif
31
32 ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
33 BB_MAKE_VERBOSE := V=1
34 else
35 BB_MAKE_VERBOSE :=
36 endif
37
38 init-y :=
39 init-$(CONFIG_BUSYBOX_CONFIG_CROND) += cron
40 init-$(CONFIG_BUSYBOX_CONFIG_TELNETD) += telnet
41
42 define Package/busybox
43 SECTION:=base
44 CATEGORY:=Base system
45 MAINTAINER:=Nicolas Thill <nico@openwrt.org>
46 TITLE:=Core utilities for embedded Linux
47 URL:=http://busybox.net/
48 DEPENDS:=+BUSYBOX_CONFIG_FEATURE_HAVE_RPC:librpc
49 MENU:=1
50 endef
51
52 define Package/busybox/description
53 The Swiss Army Knife of embedded Linux.
54 It slices, it dices, it makes Julian Fries.
55 endef
56
57 define Package/busybox/config
58 source "$(SOURCE)/Config.in"
59 endef
60
61 define Build/Configure
62 rm -f $(PKG_BUILD_DIR)/.configured*
63 grep 'CONFIG_BUSYBOX_' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_\\(.*\\),\\1\\2,g" > $(PKG_BUILD_DIR)/.config
64 yes 'n' | $(MAKE) -C $(PKG_BUILD_DIR) \
65 CC="$(TARGET_CC)" \
66 CROSS_COMPILE="$(TARGET_CROSS)" \
67 KBUILD_HAVE_NLS=no \
68 ARCH="$(ARCH)" \
69 $(BB_MAKE_VERBOSE) \
70 oldconfig
71 endef
72
73 ifdef CONFIG_GCC_VERSION_LLVM
74 TARGET_CFLAGS += -fnested-functions
75 endif
76
77 LDLIBS:=m crypt
78 ifdef CONFIG_BUSYBOX_CONFIG_FEATURE_HAVE_RPC
79 TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
80 export LDFLAGS=$(TARGET_LDFLAGS)
81 LDLIBS += rpc
82 endif
83
84 define Build/Compile
85 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
86 CC="$(TARGET_CC)" \
87 CROSS_COMPILE="$(TARGET_CROSS)" \
88 KBUILD_HAVE_NLS=no \
89 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
90 ARCH="$(ARCH)" \
91 SKIP_STRIP=y \
92 LDLIBS="$(LDLIBS)" \
93 $(BB_MAKE_VERBOSE) \
94 all
95 rm -rf $(PKG_INSTALL_DIR)
96 $(FIND) $(PKG_BUILD_DIR) -lname "*busybox" -exec rm \{\} \;
97 $(MAKE) -C $(PKG_BUILD_DIR) \
98 CC="$(TARGET_CC)" \
99 CROSS_COMPILE="$(TARGET_CROSS)" \
100 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
101 ARCH="$(ARCH)" \
102 CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
103 LDLIBS="$(LDLIBS)" \
104 $(BB_MAKE_VERBOSE) \
105 install
106 endef
107
108 define Package/busybox/install
109 $(INSTALL_DIR) $(1)/etc/init.d
110 $(CP) $(PKG_INSTALL_DIR)/* $(1)/
111 for tmp in $(init-y); do \
112 $(INSTALL_BIN) ./files/$$$$tmp $(1)/etc/init.d/$$$$tmp; \
113 done
114 -rm -rf $(1)/lib64
115 endef
116
117 $(eval $(call BuildPackage,busybox))