Makefile.inc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. # ################################################################
  2. # LZ4 - Makefile common definitions
  3. # Copyright (C) Yann Collet 2020
  4. # All rights reserved.
  5. #
  6. # BSD license
  7. # Redistribution and use in source and binary forms, with or without modification,
  8. # are permitted provided that the following conditions are met:
  9. #
  10. # * Redistributions of source code must retain the above copyright notice, this
  11. # list of conditions and the following disclaimer.
  12. #
  13. # * Redistributions in binary form must reproduce the above copyright notice, this
  14. # list of conditions and the following disclaimer in the documentation and/or
  15. # other materials provided with the distribution.
  16. #
  17. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  18. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  21. # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  24. # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. #
  28. # You can contact the author at :
  29. # - LZ4 source repository : https://github.com/lz4/lz4
  30. # - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
  31. # ################################################################
  32. UNAME ?= uname
  33. TARGET_OS ?= $(shell $(UNAME))
  34. ifeq ($(TARGET_OS),)
  35. TARGET_OS ?= $(OS)
  36. endif
  37. ifneq (,$(filter Windows%,$(TARGET_OS)))
  38. LIBLZ4 = liblz4-$(LIBVER_MAJOR)
  39. LIBLZ4_EXP = liblz4.lib
  40. WINBASED = yes
  41. else
  42. LIBLZ4_EXP = liblz4.dll.a
  43. ifneq (,$(filter MINGW%,$(TARGET_OS)))
  44. LIBLZ4 = liblz4
  45. WINBASED = yes
  46. else
  47. ifneq (,$(filter MSYS%,$(TARGET_OS)))
  48. LIBLZ4 = msys-lz4-$(LIBVER_MAJOR)
  49. WINBASED = yes
  50. else
  51. ifneq (,$(filter CYGWIN%,$(TARGET_OS)))
  52. LIBLZ4 = cyglz4-$(LIBVER_MAJOR)
  53. WINBASED = yes
  54. else
  55. LIBLZ4 = liblz4.$(SHARED_EXT_VER)
  56. WINBASED = no
  57. EXT =
  58. endif
  59. endif
  60. endif
  61. endif
  62. ifeq ($(WINBASED),yes)
  63. EXT = .exe
  64. WINDRES = windres
  65. endif
  66. #determine if dev/nul based on host environment
  67. ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell $(UNAME))))
  68. VOID := /dev/null
  69. else
  70. ifneq (,$(filter Windows%,$(OS)))
  71. VOID := nul
  72. else
  73. VOID := /dev/null
  74. endif
  75. endif
  76. ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW% CYGWIN% MSYS%,$(shell $(UNAME))))
  77. POSIX_ENV = Yes
  78. else
  79. POSIX_ENV = No
  80. endif
  81. # Avoid symlinks when targeting Windows or building on a Windows host
  82. ifeq ($(WINBASED),yes)
  83. LN_SF = cp -p
  84. else
  85. ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell $(UNAME))))
  86. LN_SF = cp -p
  87. else
  88. ifneq (,$(filter Windows%,$(OS)))
  89. LN_SF = cp -p
  90. else
  91. LN_SF = ln -sf
  92. endif
  93. endif
  94. endif
  95. ifneq (,$(filter $(shell $(UNAME)),SunOS))
  96. INSTALL ?= ginstall
  97. else
  98. INSTALL ?= install
  99. endif
  100. INSTALL_PROGRAM ?= $(INSTALL) -m 755
  101. INSTALL_DATA ?= $(INSTALL) -m 644
  102. INSTALL_DIR ?= $(INSTALL) -d -m 755