|
8 | 8 | # You may select, at your option, one of the above-listed licenses.
|
9 | 9 | # ################################################################
|
10 | 10 |
|
11 |
| -# Note: by default, the static library is built single-threaded and dynamic library is built |
12 |
| -# multi-threaded. It is possible to force multi or single threaded builds by appending |
13 |
| -# -mt or -nomt to the build target (like lib-mt for multi-threaded, lib-nomt for single-threaded). |
14 |
| -.PHONY: default |
15 |
| -default: lib-release |
16 |
| - |
17 |
| -# define silent mode as default (verbose mode with V=1 or VERBOSE=1) |
18 |
| -$(V)$(VERBOSE).SILENT: |
19 |
| - |
20 |
| -# When cross-compiling from linux to windows, |
21 |
| -# one might need to specify TARGET_SYSTEM as "Windows." |
22 |
| -# Building from Fedora fails without it. |
23 |
| -# (but Ubuntu and Debian don't need to set anything) |
24 |
| -TARGET_SYSTEM ?= $(OS) |
25 |
| - |
26 |
| -# Version numbers |
27 |
| -LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h` |
28 |
| -LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h` |
29 |
| -LIBVER_PATCH_SCRIPT:=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h` |
30 |
| -LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT) |
31 |
| -LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT)) |
32 |
| -LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT)) |
33 |
| -LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT)) |
34 |
| -LIBVER := $(shell echo $(LIBVER_SCRIPT)) |
35 |
| -VERSION?= $(LIBVER) |
36 |
| -CCVER := $(shell $(CC) --version) |
37 |
| - |
38 |
| -# ZSTD_LIB_MINIFY is a helper variable that |
39 |
| -# configures a bunch of other variables to space-optimized defaults. |
40 |
| -ZSTD_LIB_MINIFY ?= 0 |
41 |
| -ifneq ($(ZSTD_LIB_MINIFY), 0) |
42 |
| - HAVE_CC_OZ ?= $(shell echo "" | $(CC) -Oz -x c -c - -o /dev/null 2> /dev/null && echo 1 || echo 0) |
43 |
| - ZSTD_LEGACY_SUPPORT ?= 0 |
44 |
| - ZSTD_LIB_DEPRECATED ?= 0 |
45 |
| - HUF_FORCE_DECOMPRESS_X1 ?= 1 |
46 |
| - ZSTD_FORCE_DECOMPRESS_SHORT ?= 1 |
47 |
| - ZSTD_NO_INLINE ?= 1 |
48 |
| - ZSTD_STRIP_ERROR_STRINGS ?= 1 |
49 |
| -ifneq ($(HAVE_CC_OZ), 0) |
50 |
| - # Some compilers (clang) support an even more space-optimized setting. |
51 |
| - CFLAGS += -Oz |
52 |
| -else |
53 |
| - CFLAGS += -Os |
54 |
| -endif |
55 |
| - CFLAGS += -fno-stack-protector -fomit-frame-pointer -fno-ident \ |
56 |
| - -DDYNAMIC_BMI2=0 -DNDEBUG |
57 |
| -else |
58 |
| - CFLAGS += -O3 |
59 |
| -endif |
60 |
| - |
61 |
| -DEBUGLEVEL ?= 0 |
62 |
| -CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -DDEBUGLEVEL=$(DEBUGLEVEL) |
63 |
| -ifeq ($(TARGET_SYSTEM),Windows_NT) # MinGW assumed |
64 |
| - CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting |
65 |
| -endif |
66 |
| -DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ |
67 |
| - -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ |
68 |
| - -Wstrict-prototypes -Wundef -Wpointer-arith \ |
69 |
| - -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ |
70 |
| - -Wredundant-decls -Wmissing-prototypes -Wc++-compat |
71 |
| -CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) |
72 |
| -FLAGS = $(CPPFLAGS) $(CFLAGS) |
73 |
| - |
74 |
| -CPPFLAGS_DYNLIB += -DZSTD_MULTITHREAD # dynamic library build defaults to multi-threaded |
75 |
| -LDFLAGS_DYNLIB += -pthread |
76 |
| -CPPFLAGS_STATLIB += # static library build defaults to single-threaded |
77 |
| - |
78 |
| -HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0) |
79 |
| -GREP_OPTIONS ?= |
80 |
| -ifeq ($HAVE_COLORNEVER, 1) |
81 |
| - GREP_OPTIONS += --color=never |
82 |
| -endif |
83 |
| -GREP = grep $(GREP_OPTIONS) |
84 |
| -SED_ERE_OPT ?= -E |
85 |
| - |
86 |
| -ZSTDCOMMON_FILES := $(sort $(wildcard common/*.c)) |
87 |
| -ZSTDCOMP_FILES := $(sort $(wildcard compress/*.c)) |
88 |
| -ZSTDDECOMP_FILES := $(sort $(wildcard decompress/*.c)) |
89 |
| -ZDICT_FILES := $(sort $(wildcard dictBuilder/*.c)) |
90 |
| -ZDEPR_FILES := $(sort $(wildcard deprecated/*.c)) |
91 |
| -ZSTD_FILES := $(ZSTDCOMMON_FILES) |
92 |
| - |
93 |
| -ifeq ($(findstring GCC,$(CCVER)),GCC) |
94 |
| -decompress/zstd_decompress_block.o : CFLAGS+=-fno-tree-vectorize |
95 |
| -endif |
96 |
| - |
97 | 11 | # Modules
|
98 | 12 | ZSTD_LIB_COMPRESSION ?= 1
|
99 | 13 | ZSTD_LIB_DECOMPRESSION ?= 1
|
@@ -143,9 +57,9 @@ VERSION := $(ZSTD_VERSION)
|
143 | 57 | .PHONY: default
|
144 | 58 | default: lib-release
|
145 | 59 |
|
146 |
| -CPPFLAGS_DYNLIB = -DZSTD_MULTITHREAD # dynamic library build defaults to multi-threaded |
147 |
| -LDFLAGS_DYNLIB = -pthread |
148 |
| -CPPFLAGS_STATLIB = # static library build defaults to single-threaded |
| 60 | +CPPFLAGS_DYNLIB += -DZSTD_MULTITHREAD # dynamic library build defaults to multi-threaded |
| 61 | +LDFLAGS_DYNLIB += -pthread |
| 62 | +CPPFLAGS_STATLIB += # static library build defaults to single-threaded |
149 | 63 |
|
150 | 64 |
|
151 | 65 | ifeq ($(findstring GCC,$(CCVER)),GCC)
|
|
0 commit comments