Makefile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #
  2. # Copyright (C) 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:=wrapper
  9. PKG_VERSION:=1
  10. include $(INCLUDE_DIR)/toolchain-build.mk
  11. # 1: args
  12. define toolchain_util
  13. $(strip $(SCRIPT_DIR)/ext-toolchain.sh --toolchain $(CONFIG_TOOLCHAIN_ROOT) \
  14. --cflags $(CONFIG_TARGET_OPTIMIZATION) \
  15. --cflags "$(if $(call qstrip,$(CONFIG_TOOLCHAIN_LIBC)),-m$(call qstrip,$(CONFIG_TOOLCHAIN_LIBC))) $(if $(CONFIG_SOFT_FLOAT),-msoft-float)" \
  16. --cflags "$(patsubst ./%,-I$(TOOLCHAIN_ROOT_DIR)/%,$(call qstrip,$(CONFIG_TOOLCHAIN_INC_PATH)))" \
  17. --cflags "$(patsubst ./%,-L$(TOOLCHAIN_ROOT_DIR)/%,$(call qstrip,$(CONFIG_TOOLCHAIN_LIB_PATH)))" \
  18. $(1))
  19. endef
  20. # 1: config symbol
  21. # 2: feature
  22. define toolchain_test
  23. $$(if $$($(1)), \
  24. @echo -n "Testing external toolchain for $(2) support ... "; \
  25. if $(call toolchain_util,--test "$(2)"); then \
  26. echo "ok"; exit 0; \
  27. else \
  28. echo "failed"; \
  29. echo "ERROR: $(1) is enabled but the external toolchain does not support it"; \
  30. exit 1; \
  31. fi)
  32. endef
  33. define Host/Prepare
  34. $(call toolchain_test,CONFIG_SOFT_FLOAT,softfloat)
  35. $(call toolchain_test,CONFIG_IPV6,ipv6)
  36. $(call toolchain_test,CONFIG_NLS,wchar)
  37. $(call toolchain_test,CONFIG_PACKAGE_libpthread,threads)
  38. endef
  39. define Host/Configure
  40. endef
  41. define Host/Compile
  42. endef
  43. define Host/Install
  44. $(call toolchain_util,--wrap "$(TOOLCHAIN_DIR)/bin")
  45. endef
  46. define Host/Clean
  47. rm -rf $(TOOLCHAIN_DIR)/bin
  48. endef
  49. $(eval $(call HostBuild))