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