renamed STATLIB into STATICLIB

for improved clarity
This commit is contained in:
Yann Collet
2023-09-12 13:46:03 -07:00
parent 4edfaa93b7
commit feaa8ac50d
2 changed files with 22 additions and 18 deletions
+20 -18
View File
@@ -8,6 +8,9 @@
# You may select, at your option, one of the above-listed licenses. # You may select, at your option, one of the above-listed licenses.
# ################################################################ # ################################################################
# default target (when runing `make` with no argument)
lib-release:
# Modules # Modules
ZSTD_LIB_COMPRESSION ?= 1 ZSTD_LIB_COMPRESSION ?= 1
ZSTD_LIB_DECOMPRESSION ?= 1 ZSTD_LIB_DECOMPRESSION ?= 1
@@ -54,12 +57,11 @@ VERSION := $(ZSTD_VERSION)
# Note: by default, the static library is built single-threaded and dynamic library is built # Note: by default, the static library is built single-threaded and dynamic library is built
# multi-threaded. It is possible to force multi or single threaded builds by appending # multi-threaded. It is possible to force multi or single threaded builds by appending
# -mt or -nomt to the build target (like lib-mt for multi-threaded, lib-nomt for single-threaded). # -mt or -nomt to the build target (like lib-mt for multi-threaded, lib-nomt for single-threaded).
.PHONY: default
default: lib-release
CPPFLAGS_DYNLIB += -DZSTD_MULTITHREAD # dynamic library build defaults to multi-threaded CPPFLAGS_DYNLIB += -DZSTD_MULTITHREAD # dynamic library build defaults to multi-threaded
LDFLAGS_DYNLIB += -pthread LDFLAGS_DYNLIB += -pthread
CPPFLAGS_STATLIB += # static library build defaults to single-threaded CPPFLAGS_STATICLIB += # static library build defaults to single-threaded
ifeq ($(findstring GCC,$(CCVER)),GCC) ifeq ($(findstring GCC,$(CCVER)),GCC)
@@ -91,7 +93,7 @@ all: lib
.PHONY: libzstd.a # must be run every time .PHONY: libzstd.a # must be run every time
libzstd.a: CPPFLAGS += $(CPPFLAGS_STATLIB) libzstd.a: CPPFLAGS += $(CPPFLAGS_STATICLIB)
SET_CACHE_DIRECTORY = \ SET_CACHE_DIRECTORY = \
+$(MAKE) --no-print-directory $@ \ +$(MAKE) --no-print-directory $@ \
@@ -109,19 +111,19 @@ libzstd.a:
else else
# BUILD_DIR is defined # BUILD_DIR is defined
ZSTD_STATLIB_DIR := $(BUILD_DIR)/static ZSTD_STATICLIB_DIR := $(BUILD_DIR)/static
ZSTD_STATLIB := $(ZSTD_STATLIB_DIR)/libzstd.a ZSTD_STATICLIB := $(ZSTD_STATICLIB_DIR)/libzstd.a
ZSTD_STATLIB_OBJ := $(addprefix $(ZSTD_STATLIB_DIR)/,$(ZSTD_LOCAL_OBJ)) ZSTD_STATICLIB_OBJ := $(addprefix $(ZSTD_STATICLIB_DIR)/,$(ZSTD_LOCAL_OBJ))
$(ZSTD_STATLIB): ARFLAGS = rcs $(ZSTD_STATICLIB): ARFLAGS = rcs
$(ZSTD_STATLIB): | $(ZSTD_STATLIB_DIR) $(ZSTD_STATICLIB): | $(ZSTD_STATICLIB_DIR)
$(ZSTD_STATLIB): $(ZSTD_STATLIB_OBJ) $(ZSTD_STATICLIB): $(ZSTD_STATICLIB_OBJ)
# Check for multithread flag at target execution time # Check for multithread flag at target execution time
$(if $(filter -DZSTD_MULTITHREAD,$(CPPFLAGS)),\ $(if $(filter -DZSTD_MULTITHREAD,$(CPPFLAGS)),\
@echo compiling multi-threaded static library $(LIBVER),\ @echo compiling multi-threaded static library $(LIBVER),\
@echo compiling single-threaded static library $(LIBVER)) @echo compiling single-threaded static library $(LIBVER))
$(AR) $(ARFLAGS) $@ $^ $(AR) $(ARFLAGS) $@ $^
libzstd.a: $(ZSTD_STATLIB) libzstd.a: $(ZSTD_STATICLIB)
cp -f $< $@ cp -f $< $@
endif endif
@@ -182,14 +184,14 @@ lib : libzstd.a libzstd
# make does not consider implicit pattern rule for .PHONY target # make does not consider implicit pattern rule for .PHONY target
%-mt : CPPFLAGS_DYNLIB := -DZSTD_MULTITHREAD %-mt : CPPFLAGS_DYNLIB := -DZSTD_MULTITHREAD
%-mt : CPPFLAGS_STATLIB := -DZSTD_MULTITHREAD %-mt : CPPFLAGS_STATICLIB := -DZSTD_MULTITHREAD
%-mt : LDFLAGS_DYNLIB := -pthread %-mt : LDFLAGS_DYNLIB := -pthread
%-mt : % %-mt : %
@echo multi-threaded build completed @echo multi-threaded build completed
%-nomt : CPPFLAGS_DYNLIB := %-nomt : CPPFLAGS_DYNLIB :=
%-nomt : LDFLAGS_DYNLIB := %-nomt : LDFLAGS_DYNLIB :=
%-nomt : CPPFLAGS_STATLIB := %-nomt : CPPFLAGS_STATICLIB :=
%-nomt : % %-nomt : %
@echo single-threaded build completed @echo single-threaded build completed
@@ -206,23 +208,23 @@ $(ZSTD_DYNLIB_DIR)/%.o : %.c $(ZSTD_DYNLIB_DIR)/%.d | $(ZSTD_DYNLIB_DIR)
@echo CC $@ @echo CC $@
$(COMPILE.c) $(DEPFLAGS) $(ZSTD_DYNLIB_DIR)/$*.d $(OUTPUT_OPTION) $< $(COMPILE.c) $(DEPFLAGS) $(ZSTD_DYNLIB_DIR)/$*.d $(OUTPUT_OPTION) $<
$(ZSTD_STATLIB_DIR)/%.o : %.c $(ZSTD_STATLIB_DIR)/%.d | $(ZSTD_STATLIB_DIR) $(ZSTD_STATICLIB_DIR)/%.o : %.c $(ZSTD_STATICLIB_DIR)/%.d | $(ZSTD_STATICLIB_DIR)
@echo CC $@ @echo CC $@
$(COMPILE.c) $(DEPFLAGS) $(ZSTD_STATLIB_DIR)/$*.d $(OUTPUT_OPTION) $< $(COMPILE.c) $(DEPFLAGS) $(ZSTD_STATICLIB_DIR)/$*.d $(OUTPUT_OPTION) $<
$(ZSTD_DYNLIB_DIR)/%.o : %.S | $(ZSTD_DYNLIB_DIR) $(ZSTD_DYNLIB_DIR)/%.o : %.S | $(ZSTD_DYNLIB_DIR)
@echo AS $@ @echo AS $@
$(COMPILE.S) $(OUTPUT_OPTION) $< $(COMPILE.S) $(OUTPUT_OPTION) $<
$(ZSTD_STATLIB_DIR)/%.o : %.S | $(ZSTD_STATLIB_DIR) $(ZSTD_STATICLIB_DIR)/%.o : %.S | $(ZSTD_STATICLIB_DIR)
@echo AS $@ @echo AS $@
$(COMPILE.S) $(OUTPUT_OPTION) $< $(COMPILE.S) $(OUTPUT_OPTION) $<
MKDIR ?= mkdir MKDIR ?= mkdir
$(BUILD_DIR) $(ZSTD_DYNLIB_DIR) $(ZSTD_STATLIB_DIR): $(BUILD_DIR) $(ZSTD_DYNLIB_DIR) $(ZSTD_STATICLIB_DIR):
$(MKDIR) -p $@ $(MKDIR) -p $@
DEPFILES := $(ZSTD_DYNLIB_OBJ:.o=.d) $(ZSTD_STATLIB_OBJ:.o=.d) DEPFILES := $(ZSTD_DYNLIB_OBJ:.o=.d) $(ZSTD_STATICLIB_OBJ:.o=.d)
$(DEPFILES): $(DEPFILES):
include $(wildcard $(DEPFILES)) include $(wildcard $(DEPFILES))
+2
View File
@@ -9,6 +9,7 @@
# ################################################################ # ################################################################
# Ensure the file is not included twice # Ensure the file is not included twice
# Note : must be included after setting the default target
ifndef LIBZSTD_MK_INCLUDED ifndef LIBZSTD_MK_INCLUDED
LIBZSTD_MK_INCLUDED := 1 LIBZSTD_MK_INCLUDED := 1
@@ -64,6 +65,7 @@ VOID ?= /dev/null
NUM_SYMBOL := \# NUM_SYMBOL := \#
# define silent mode as default (verbose mode with V=1 or VERBOSE=1) # define silent mode as default (verbose mode with V=1 or VERBOSE=1)
# Note : must be defined _after_ the default target
$(V)$(VERBOSE).SILENT: $(V)$(VERBOSE).SILENT:
# When cross-compiling from linux to windows, # When cross-compiling from linux to windows,