Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #
  2. # Copyright (C) 2006-2012 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=busybox
  9. PKG_VERSION:=1.19.4
  10. PKG_RELEASE:=4
  11. PKG_FLAGS:=essential
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  13. PKG_SOURCE_URL:=http://www.busybox.net/downloads \
  14. http://distfiles.gentoo.org/distfiles/
  15. PKG_MD5SUM:=9c0cae5a0379228e7b55e5b29528df8e
  16. PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_FEATURE_HAVE_RPC:librpc
  17. PKG_BUILD_PARALLEL:=1
  18. include $(INCLUDE_DIR)/package.mk
  19. ifeq ($(DUMP),)
  20. STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | md5s)
  21. endif
  22. ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
  23. BB_MAKE_VERBOSE := V=1
  24. else
  25. BB_MAKE_VERBOSE :=
  26. endif
  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. define Package/busybox
  32. SECTION:=base
  33. CATEGORY:=Base system
  34. MAINTAINER:=Nicolas Thill <[email protected]>
  35. TITLE:=Core utilities for embedded Linux
  36. URL:=http://busybox.net/
  37. DEPENDS:=+BUSYBOX_CONFIG_FEATURE_HAVE_RPC:librpc
  38. MENU:=1
  39. endef
  40. define Package/busybox/description
  41. The Swiss Army Knife of embedded Linux.
  42. It slices, it dices, it makes Julian Fries.
  43. endef
  44. define Package/busybox/config
  45. source "$(SOURCE)/Config.in"
  46. endef
  47. define Build/Configure
  48. rm -f $(PKG_BUILD_DIR)/.configured*
  49. grep 'CONFIG_BUSYBOX_' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_\\(.*\\),\\1\\2,g" > $(PKG_BUILD_DIR)/.config
  50. yes '' | $(MAKE) -C $(PKG_BUILD_DIR) \
  51. CC="$(TARGET_CC)" \
  52. CROSS_COMPILE="$(TARGET_CROSS)" \
  53. KBUILD_HAVE_NLS=no \
  54. ARCH="$(ARCH)" \
  55. $(BB_MAKE_VERBOSE) \
  56. oldconfig
  57. endef
  58. ifdef CONFIG_GCC_VERSION_LLVM
  59. TARGET_CFLAGS += -fnested-functions
  60. endif
  61. LDLIBS:=m crypt
  62. ifdef CONFIG_BUSYBOX_CONFIG_FEATURE_HAVE_RPC
  63. TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
  64. export LDFLAGS=$(TARGET_LDFLAGS)
  65. LDLIBS += rpc
  66. endif
  67. define Build/Compile
  68. $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  69. CC="$(TARGET_CC)" \
  70. CROSS_COMPILE="$(TARGET_CROSS)" \
  71. KBUILD_HAVE_NLS=no \
  72. EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
  73. ARCH="$(ARCH)" \
  74. SKIP_STRIP=y \
  75. LDLIBS="$(LDLIBS)" \
  76. $(BB_MAKE_VERBOSE) \
  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. LDLIBS="$(LDLIBS)" \
  87. $(BB_MAKE_VERBOSE) \
  88. install
  89. endef
  90. define Package/busybox/install
  91. $(INSTALL_DIR) $(1)/etc/init.d
  92. $(CP) $(PKG_INSTALL_DIR)/* $(1)/
  93. for tmp in $(init-y); do \
  94. $(INSTALL_BIN) ./files/$$$$tmp $(1)/etc/init.d/$$$$tmp; \
  95. done
  96. -rm -rf $(1)/lib64
  97. endef
  98. $(eval $(call BuildPackage,busybox))