You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.2 KiB

  1. #
  2. # Copyright (C) 2018 Lim Guo Wei
  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:=coremark
  9. PKG_SOURCE_DATE:=2021-03-12
  10. PKG_SOURCE_VERSION:=1541482bf3e6ef7f5c69f5be76b14537b60833d0
  11. PKG_RELEASE:=1
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_DATE).tar.gz
  13. PKG_SOURCE_URL:=https://codeload.github.com/eembc/coremark/tar.gz/$(PKG_SOURCE_VERSION)?
  14. PKG_HASH:=ad32cb10ba491f5c897f1022e97bca691cc88fdbb02ded48a0766c10344abc4f
  15. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
  16. PKG_MAINTAINER:=Lim Guo Wei <limguowei@gmail.com>
  17. PKG_LICENSE:=Apache-2.0
  18. PKG_LICENSE_FILES:=LICENSE.md
  19. PKG_USE_MIPS16:=0
  20. include $(INCLUDE_DIR)/package.mk
  21. define Package/coremark
  22. SECTION:=utils
  23. CATEGORY:=Utilities
  24. TITLE:=CoreMark Embedded Microprocessor Benchmark
  25. URL:=https://github.com/eembc/coremark
  26. endef
  27. define Package/coremark/description
  28. Embedded Microprocessor Benchmark
  29. endef
  30. define Package/coremark/config
  31. config COREMARK_OPTIMIZE_O3
  32. bool "Use all optimizations (-O3)"
  33. depends on PACKAGE_coremark
  34. default y
  35. help
  36. This enables additional optmizations using the -O3 compilation flag.
  37. config COREMARK_ENABLE_MULTITHREADING
  38. bool "Enable multithreading support"
  39. depends on PACKAGE_coremark
  40. default n
  41. help
  42. This enables multithreading support
  43. config COREMARK_NUMBER_OF_THREADS
  44. int "Number of threads"
  45. depends on COREMARK_ENABLE_MULTITHREADING
  46. default 2
  47. help
  48. Number of threads to run in parallel
  49. endef
  50. TARGET_CFLAGS += -flto
  51. ifeq ($(CONFIG_COREMARK_OPTIMIZE_O3),y)
  52. TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS)) -O3
  53. endif
  54. ifeq ($(CONFIG_COREMARK_ENABLE_MULTITHREADING),y)
  55. EXTRA_CFLAGS := -DMULTITHREAD=$(CONFIG_COREMARK_NUMBER_OF_THREADS) -DUSE_PTHREAD
  56. endif
  57. define Build/Compile
  58. $(SED) 's|EXE = .exe|EXE =|' $(PKG_BUILD_DIR)/posix/core_portme.mak
  59. mkdir $(PKG_BUILD_DIR)/$(ARCH)
  60. $(CP) -r $(PKG_BUILD_DIR)/linux/* $(PKG_BUILD_DIR)/$(ARCH)
  61. $(MAKE) -C $(PKG_BUILD_DIR) PORT_DIR=$(ARCH) $(MAKE_FLAGS) \
  62. PORT_CFLAGS="$(TARGET_CFLAGS)" XCFLAGS="$(EXTRA_CFLAGS)" compile
  63. endef
  64. define Package/coremark/install
  65. $(INSTALL_DIR) $(1)/bin
  66. $(INSTALL_BIN) $(PKG_BUILD_DIR)/coremark $(1)/bin/
  67. endef
  68. $(eval $(call BuildPackage,coremark))