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 33UNAME ?= uname 34 35TARGET_OS ?= $(shell $(UNAME)) 36ifeq ($(TARGET_OS),) 37 TARGET_OS ?= $(OS) 38endif 39 40ifneq (,$(filter Windows%,$(TARGET_OS))) 41LIBLZ4 = liblz4-$(LIBVER_MAJOR) 42LIBLZ4_EXP = liblz4.lib 43WINBASED = yes 44else 45LIBLZ4_EXP = liblz4.dll.a 46 ifneq (,$(filter MINGW%,$(TARGET_OS))) 47LIBLZ4 = liblz4 48WINBASED = yes 49 else 50 ifneq (,$(filter MSYS%,$(TARGET_OS))) 51LIBLZ4 = msys-lz4-$(LIBVER_MAJOR) 52WINBASED = yes 53 else 54 ifneq (,$(filter CYGWIN%,$(TARGET_OS))) 55LIBLZ4 = cyglz4-$(LIBVER_MAJOR) 56WINBASED = yes 57 else 58LIBLZ4 = liblz4.$(SHARED_EXT_VER) 59WINBASED = no 60EXT = 61 endif 62 endif 63 endif 64endif 65 66ifeq ($(WINBASED),yes) 67EXT = .exe 68WINDRES = windres 69endif 70 71#determine if dev/nul based on host environment 72ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell $(UNAME)))) 73VOID := /dev/null 74else 75 ifneq (,$(filter Windows%,$(OS))) 76VOID := nul 77 else 78VOID := /dev/null 79 endif 80endif 81 82ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW% CYGWIN% MSYS%,$(shell $(UNAME)))) 83POSIX_ENV = Yes 84else 85POSIX_ENV = No 86endif 87 88# Avoid symlinks when targeting Windows or building on a Windows host 89ifeq ($(WINBASED),yes) 90LN_SF = cp -p 91else 92 ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell $(UNAME)))) 93LN_SF = cp -p 94 else 95 ifneq (,$(filter Windows%,$(OS))) 96LN_SF = cp -p 97 else 98LN_SF = ln -sf 99 endif 100 endif 101endif 102 103ifneq (,$(filter $(shell $(UNAME)),SunOS)) 104INSTALL ?= ginstall 105else 106INSTALL ?= install 107endif 108 109INSTALL_PROGRAM ?= $(INSTALL) -m 755 110INSTALL_DATA ?= $(INSTALL) -m 644 111INSTALL_DIR ?= $(INSTALL) -d -m 755 112