127b27ec6Sopenharmony_ci# ################################################################
227b27ec6Sopenharmony_ci# LZ4 - Makefile common definitions
327b27ec6Sopenharmony_ci# Copyright (C) Yann Collet 2020
427b27ec6Sopenharmony_ci# All rights reserved.
527b27ec6Sopenharmony_ci#
627b27ec6Sopenharmony_ci# BSD license
727b27ec6Sopenharmony_ci# Redistribution and use in source and binary forms, with or without modification,
827b27ec6Sopenharmony_ci# are permitted provided that the following conditions are met:
927b27ec6Sopenharmony_ci#
1027b27ec6Sopenharmony_ci# * Redistributions of source code must retain the above copyright notice, this
1127b27ec6Sopenharmony_ci#   list of conditions and the following disclaimer.
1227b27ec6Sopenharmony_ci#
1327b27ec6Sopenharmony_ci# * Redistributions in binary form must reproduce the above copyright notice, this
1427b27ec6Sopenharmony_ci#   list of conditions and the following disclaimer in the documentation and/or
1527b27ec6Sopenharmony_ci#   other materials provided with the distribution.
1627b27ec6Sopenharmony_ci#
1727b27ec6Sopenharmony_ci# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1827b27ec6Sopenharmony_ci# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1927b27ec6Sopenharmony_ci# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2027b27ec6Sopenharmony_ci# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
2127b27ec6Sopenharmony_ci# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2227b27ec6Sopenharmony_ci# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2327b27ec6Sopenharmony_ci# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
2427b27ec6Sopenharmony_ci# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2527b27ec6Sopenharmony_ci# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2627b27ec6Sopenharmony_ci# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727b27ec6Sopenharmony_ci#
2827b27ec6Sopenharmony_ci# You can contact the author at :
2927b27ec6Sopenharmony_ci#  - LZ4 source repository : https://github.com/lz4/lz4
3027b27ec6Sopenharmony_ci#  - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
3127b27ec6Sopenharmony_ci# ################################################################
3227b27ec6Sopenharmony_ci
3327b27ec6Sopenharmony_ciUNAME ?= uname
3427b27ec6Sopenharmony_ci
3527b27ec6Sopenharmony_ciTARGET_OS ?= $(shell $(UNAME))
3627b27ec6Sopenharmony_ciifeq ($(TARGET_OS),)
3727b27ec6Sopenharmony_ci  TARGET_OS ?= $(OS)
3827b27ec6Sopenharmony_ciendif
3927b27ec6Sopenharmony_ci
4027b27ec6Sopenharmony_ciifneq (,$(filter Windows%,$(TARGET_OS)))
4127b27ec6Sopenharmony_ciLIBLZ4 = liblz4-$(LIBVER_MAJOR)
4227b27ec6Sopenharmony_ciLIBLZ4_EXP = liblz4.lib
4327b27ec6Sopenharmony_ciWINBASED   = yes
4427b27ec6Sopenharmony_cielse
4527b27ec6Sopenharmony_ciLIBLZ4_EXP = liblz4.dll.a
4627b27ec6Sopenharmony_ci  ifneq (,$(filter MINGW%,$(TARGET_OS)))
4727b27ec6Sopenharmony_ciLIBLZ4     = liblz4
4827b27ec6Sopenharmony_ciWINBASED   = yes
4927b27ec6Sopenharmony_ci  else
5027b27ec6Sopenharmony_ci    ifneq (,$(filter MSYS%,$(TARGET_OS)))
5127b27ec6Sopenharmony_ciLIBLZ4     = msys-lz4-$(LIBVER_MAJOR)
5227b27ec6Sopenharmony_ciWINBASED   = yes
5327b27ec6Sopenharmony_ci    else
5427b27ec6Sopenharmony_ci      ifneq (,$(filter CYGWIN%,$(TARGET_OS)))
5527b27ec6Sopenharmony_ciLIBLZ4     = cyglz4-$(LIBVER_MAJOR)
5627b27ec6Sopenharmony_ciWINBASED   = yes
5727b27ec6Sopenharmony_ci      else
5827b27ec6Sopenharmony_ciLIBLZ4     = liblz4.$(SHARED_EXT_VER)
5927b27ec6Sopenharmony_ciWINBASED   = no
6027b27ec6Sopenharmony_ciEXT        =
6127b27ec6Sopenharmony_ci      endif
6227b27ec6Sopenharmony_ci    endif
6327b27ec6Sopenharmony_ci  endif
6427b27ec6Sopenharmony_ciendif
6527b27ec6Sopenharmony_ci
6627b27ec6Sopenharmony_ciifeq ($(WINBASED),yes)
6727b27ec6Sopenharmony_ciEXT        = .exe
6827b27ec6Sopenharmony_ciWINDRES    = windres
6927b27ec6Sopenharmony_ciendif
7027b27ec6Sopenharmony_ci
7127b27ec6Sopenharmony_ci#determine if dev/nul based on host environment
7227b27ec6Sopenharmony_ciifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell $(UNAME))))
7327b27ec6Sopenharmony_ciVOID := /dev/null
7427b27ec6Sopenharmony_cielse
7527b27ec6Sopenharmony_ci  ifneq (,$(filter Windows%,$(OS)))
7627b27ec6Sopenharmony_ciVOID := nul
7727b27ec6Sopenharmony_ci  else
7827b27ec6Sopenharmony_ciVOID  := /dev/null
7927b27ec6Sopenharmony_ci  endif
8027b27ec6Sopenharmony_ciendif
8127b27ec6Sopenharmony_ci
8227b27ec6Sopenharmony_ciifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW% CYGWIN% MSYS%,$(shell $(UNAME))))
8327b27ec6Sopenharmony_ciPOSIX_ENV = Yes
8427b27ec6Sopenharmony_cielse
8527b27ec6Sopenharmony_ciPOSIX_ENV = No
8627b27ec6Sopenharmony_ciendif
8727b27ec6Sopenharmony_ci
8827b27ec6Sopenharmony_ci# Avoid symlinks when targeting Windows or building on a Windows host
8927b27ec6Sopenharmony_ciifeq ($(WINBASED),yes)
9027b27ec6Sopenharmony_ciLN_SF = cp -p
9127b27ec6Sopenharmony_cielse
9227b27ec6Sopenharmony_ci  ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell $(UNAME))))
9327b27ec6Sopenharmony_ciLN_SF = cp -p
9427b27ec6Sopenharmony_ci  else
9527b27ec6Sopenharmony_ci    ifneq (,$(filter Windows%,$(OS)))
9627b27ec6Sopenharmony_ciLN_SF = cp -p
9727b27ec6Sopenharmony_ci    else
9827b27ec6Sopenharmony_ciLN_SF  = ln -sf
9927b27ec6Sopenharmony_ci    endif
10027b27ec6Sopenharmony_ci  endif
10127b27ec6Sopenharmony_ciendif
10227b27ec6Sopenharmony_ci
10327b27ec6Sopenharmony_ciifneq (,$(filter $(shell $(UNAME)),SunOS))
10427b27ec6Sopenharmony_ciINSTALL ?= ginstall
10527b27ec6Sopenharmony_cielse
10627b27ec6Sopenharmony_ciINSTALL ?= install
10727b27ec6Sopenharmony_ciendif
10827b27ec6Sopenharmony_ci
10927b27ec6Sopenharmony_ciINSTALL_PROGRAM ?= $(INSTALL) -m 755
11027b27ec6Sopenharmony_ciINSTALL_DATA    ?= $(INSTALL) -m 644
11127b27ec6Sopenharmony_ciINSTALL_DIR     ?= $(INSTALL) -d -m 755
112