Merge pull request #2423 from facebook/no-ln

replace links by actual copies
This commit is contained in:
Yann Collet 2020-12-10 19:04:11 -08:00 committed by GitHub
commit 94db6a1248
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 8 deletions

View File

@ -243,7 +243,7 @@ $(ZSTD_STATLIB): $(ZSTD_STATLIB_OBJ)
$(AR) $(ARFLAGS) $@ $^
libzstd.a: $(ZSTD_STATLIB)
ln -sf $< $@
cp -f $< $@
endif
@ -283,7 +283,7 @@ $(ZSTD_DYNLIB): $(ZSTD_DYNLIB_OBJ)
ln -sf $@ libzstd.$(SHARED_EXT)
$(LIBZSTD): $(ZSTD_DYNLIB)
ln -sf $< $@
cp -f $< $@
endif # ifndef BUILD_DIR
endif # if windows

View File

@ -98,8 +98,6 @@ ZSTD_ALL_SRC := $(ZSTDLIB_LOCAL_SRC) $(ZSTD_CLI_SRC)
ZSTD_ALL_OBJ := $(ZSTD_ALL_SRC:.c=.o)
UNAME := $(shell uname)
ifndef BUILD_DIR
ifeq ($(UNAME), Darwin)
HASH ?= md5
else ifeq ($(UNAME), FreeBSD)
@ -108,9 +106,10 @@ else ifeq ($(UNAME), OpenBSD)
HASH ?= md5
endif
HASH ?= md5sum
HASH_DIR = conf_$(shell echo $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ZSTD_FILES) | $(HASH) | cut -f 1 -d " ")
HAVE_HASH :=$(shell echo 1 | $(HASH) > /dev/null && echo 1 || echo 0)
ifndef BUILD_DIR
HASH_DIR = conf_$(shell echo $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ZSTD_FILES) | $(HASH) | cut -f 1 -d " ")
ifeq ($(HAVE_HASH),0)
$(info warning : could not find HASH ($(HASH)), needed to differentiate builds using different flags)
BUILD_DIR := obj/generic_noconf
@ -232,9 +231,21 @@ $(BUILD_DIR)/zstd : $(ZSTD_OBJ)
@echo LINK $@
$(CC) $(FLAGS) $^ -o $@$(EXT) $(LDFLAGS)
ifeq ($(HAVE_HASH),1)
SRCBIN_HASH = $(shell cat $(BUILD_DIR)/zstd 2> $(VOID) | $(HASH) | cut -f 1 -d " ")
DSTBIN_HASH = $(shell cat zstd 2> $(VOID) | $(HASH) | cut -f 1 -d " ")
BIN_ISDIFFERENT = $(if $(filter $(SRCBIN_HASH),$(DSTBIN_HASH)),0,1)
else
BIN_ISDIFFERENT = 1
endif
zstd : $(BUILD_DIR)/zstd
ln -sf $< $@
@echo zstd build completed
if [ $(BIN_ISDIFFERENT) -eq 1 ]; then \
cp -f $< $@; \
echo zstd build completed; \
else \
echo zstd already built; \
fi
endif # BUILD_DIR