common.mk 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #
  2. # Copyright (C) 2012-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. include $(TOPDIR)/rules.mk
  8. include $(INCLUDE_DIR)/target.mk
  9. PKG_NAME:=musl
  10. PKG_VERSION:=$(call qstrip,$(CONFIG_MUSL_VERSION))
  11. PKG_RELEASE=1
  12. PKG_MD5SUM:=fc30892ee582c91920505bbd0021049f
  13. PKG_SOURCE_URL:=http://www.musl-libc.org/releases
  14. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  15. LIBC_SO_VERSION:=$(PKG_VERSION)
  16. PATCH_DIR:=$(PATH_PREFIX)/patches
  17. HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
  18. include $(INCLUDE_DIR)/toolchain-build.mk
  19. include $(INCLUDE_DIR)/hardening.mk
  20. MUSL_CONFIGURE:= \
  21. $(TARGET_CONFIGURE_OPTS) \
  22. CFLAGS="$(TARGET_CFLAGS)" \
  23. CROSS_COMPILE="$(TARGET_CROSS)" \
  24. $(HOST_BUILD_DIR)/configure \
  25. --prefix=/ \
  26. --host=$(GNU_HOST_NAME) \
  27. --target=$(REAL_GNU_TARGET_NAME) \
  28. --disable-gcc-wrapper
  29. ifeq ($(CONFIG_MUSL_ENABLE_DEBUG),y)
  30. MUSL_CONFIGURE+= \
  31. --enable-debug
  32. endif
  33. define Host/Prepare
  34. $(call Host/Prepare/Default)
  35. $(if $(strip $(QUILT)), \
  36. cd $(HOST_BUILD_DIR); \
  37. if $(QUILT_CMD) next >/dev/null 2>&1; then \
  38. $(QUILT_CMD) push -a; \
  39. fi
  40. )
  41. ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
  42. endef
  43. define Host/Configure
  44. ( cd $(HOST_BUILD_DIR); rm -f config.cache; \
  45. $(MUSL_CONFIGURE) \
  46. );
  47. endef
  48. define Host/Clean
  49. rm -rf \
  50. $(HOST_BUILD_DIR) \
  51. $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME) \
  52. $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev
  53. endef