]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fix Makefile Variable Concatenation Order 2294/head
authorW. Felix Handte <w@felixhandte.com>
Thu, 3 Sep 2020 21:28:37 +0000 (17:28 -0400)
committerW. Felix Handte <w@felixhandte.com>
Thu, 3 Sep 2020 21:30:29 +0000 (17:30 -0400)
Previously, this construct would add `-O3` onto the end of the compiler flags
variable, **after** `MOREFLAGS`, which meant that it was impossible to over-
ride. This commit fixes this order and should otherwise be a no-op.

lib/Makefile

index 4a9ab799ef01e7d4bfd12322e08d5b6d08f5a372..aba0c99ba97dcaccab2583e30e872e994bd02d88 100644 (file)
@@ -31,6 +31,29 @@ LIBVER := $(shell echo $(LIBVER_SCRIPT))
 VERSION?= $(LIBVER)
 CCVER := $(shell $(CC) --version)
 
+# This is a helper variable that configures a bunch of other variables to new,
+# space-optimized defaults.
+ZSTD_LIB_MINIFY ?= 0
+ifneq ($(ZSTD_LIB_MINIFY), 0)
+       HAVE_CC_OZ ?= $(shell echo "" | $(CC) -Oz -x c -c - -o /dev/null 2> /dev/null && echo 1 || echo 0)
+       ZSTD_LEGACY_SUPPORT ?= 0
+       ZSTD_LIB_DEPRECATED ?= 0
+       HUF_FORCE_DECOMPRESS_X1 ?= 1
+       ZSTD_FORCE_DECOMPRESS_SHORT ?= 1
+       ZSTD_NO_INLINE ?= 1
+       ZSTD_STRIP_ERROR_STRINGS ?= 1
+       ifneq ($(HAVE_CC_OZ), 0)
+               # Some compilers (clang) support an even more space-optimized setting.
+               CFLAGS += -Oz
+       else
+               CFLAGS += -Os
+       endif
+       CFLAGS += -fno-stack-protector -fomit-frame-pointer -fno-ident \
+                 -DDYNAMIC_BMI2=0 -DNDEBUG
+else
+       CFLAGS += -O3
+endif
+
 CPPFLAGS+= -DXXH_NAMESPACE=ZSTD_
 ifeq ($(TARGET_SYSTEM),Windows_NT)   # MinGW assumed
 CPPFLAGS   += -D__USE_MINGW_ANSI_STDIO   # compatibility with %zu formatting
@@ -62,29 +85,6 @@ ifeq ($(findstring GCC,$(CCVER)),GCC)
 decompress/zstd_decompress_block.o :   CFLAGS+=-fno-tree-vectorize
 endif
 
-# This is a helper variable that configures a bunch of other variables to new,
-# space-optimized defaults.
-ZSTD_LIB_MINIFY ?= 0
-ifneq ($(ZSTD_LIB_MINIFY), 0)
-       HAVE_CC_OZ ?= $(shell echo "" | $(CC) -Oz -x c -c - -o /dev/null 2> /dev/null && echo 1 || echo 0)
-       ZSTD_LEGACY_SUPPORT ?= 0
-       ZSTD_LIB_DEPRECATED ?= 0
-       HUF_FORCE_DECOMPRESS_X1 ?= 1
-       ZSTD_FORCE_DECOMPRESS_SHORT ?= 1
-       ZSTD_NO_INLINE ?= 1
-       ZSTD_STRIP_ERROR_STRINGS ?= 1
-       ifneq ($(HAVE_CC_OZ), 0)
-               # Some compilers (clang) support an even more space-optimized setting.
-               CFLAGS += -Oz
-       else
-               CFLAGS += -Os
-       endif
-       CFLAGS += -fno-stack-protector -fomit-frame-pointer -fno-ident \
-                 -DDYNAMIC_BMI2=0 -DNDEBUG
-else
-       CFLAGS += -O3
-endif
-
 # Modules
 ZSTD_LIB_COMPRESSION ?= 1
 ZSTD_LIB_DECOMPRESSION ?= 1