platform.mk 838 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. SYSTEM_TYPE := $(shell gcc -dumpmachine)
  2. GCC_VERSION := $(shell gcc --version 2>/dev/null)
  3. CC = $(CC_PREFIX) gcc
  4. OBJCOPY =
  5. OBJDUMP =
  6. SIZE =
  7. AR =
  8. NM =
  9. HEX =
  10. EEP =
  11. BIN =
  12. # workaround for undefined reference to weak function under mingw
  13. ifneq ($(findstring mingw, ${SYSTEM_TYPE}),)
  14. LTO_ENABLE := yes
  15. endif
  16. COMPILEFLAGS += -funsigned-char
  17. ifeq ($(findstring clang, ${GCC_VERSION}),)
  18. COMPILEFLAGS += -funsigned-bitfields
  19. endif
  20. COMPILEFLAGS += -ffunction-sections
  21. COMPILEFLAGS += -fdata-sections
  22. COMPILEFLAGS += -fshort-enums
  23. ifneq ($(findstring mingw, ${SYSTEM_TYPE}),)
  24. COMPILEFLAGS += -mno-ms-bitfields
  25. endif
  26. CFLAGS += $(COMPILEFLAGS)
  27. ifeq ($(findstring clang, ${GCC_VERSION}),)
  28. CFLAGS += -fno-inline-small-functions
  29. endif
  30. CFLAGS += -fno-strict-aliasing
  31. CXXFLAGS += $(COMPILEFLAGS)
  32. CXXFLAGS += -fno-exceptions
  33. CXXFLAGS += $(CXXSTANDARD)