diff options
author | Yann Collet <cyan@fb.com> | 2020-08-11 21:03:20 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2020-08-11 21:07:51 (GMT) |
commit | 3dd34df75185f132238451ef4fdb68b83f6fb91a (patch) | |
tree | f3687e83c61c0c5bee9b8a505bef19f58d20596b /programs/Makefile | |
parent | f328e329b3cec38ec8316d454279b79d19c36fdd (diff) | |
download | lz4-3dd34df75185f132238451ef4fdb68b83f6fb91a.zip lz4-3dd34df75185f132238451ef4fdb68b83f6fb91a.tar.gz lz4-3dd34df75185f132238451ef4fdb68b83f6fb91a.tar.bz2 |
added target lz4-wlib
variant of lz4 linking to liblz4 dynamic library
requires the dynamic library to expose static-only symbols (experimental API)
Example for #888
Diffstat (limited to 'programs/Makefile')
-rw-r--r-- | programs/Makefile | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/programs/Makefile b/programs/Makefile index 4994551..4256ae8 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -41,12 +41,13 @@ LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT)) LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT)) LIBVER := $(shell echo $(LIBVER_SCRIPT)) -SRCFILES := $(sort $(wildcard $(LZ4DIR)/*.c) $(wildcard *.c)) -OBJFILES := $(SRCFILES:.c=.o) +LIBFILES = $(wildcard $(LZ4DIR)/*.c) +SRCFILES = $(sort $(LIBFILES) $(wildcard *.c)) +OBJFILES = $(SRCFILES:.c=.o) CPPFLAGS += -I$(LZ4DIR) -DXXH_NAMESPACE=LZ4_ CFLAGS ?= -O3 -DEBUGFLAGS:=-Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow \ +DEBUGFLAGS= -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow \ -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes \ -Wpointer-arith -Wstrict-aliasing=1 CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) @@ -82,13 +83,25 @@ lz4: $(OBJFILES) lz4-exe.o $(CC) $(FLAGS) $^ -o $@$(EXT) else lz4: $(OBJFILES) - $(CC) $(FLAGS) $^ -o $@$(EXT) + $(CC) $(FLAGS) $(OBJFILES) -o $@$(EXT) $(LDLIBS) endif - +.PHONY: lz4-release lz4-release: DEBUGFLAGS= lz4-release: lz4 +lz4-wlib: LIBFILES = +lz4-wlib: SRCFILES+= $(LZ4DIR)/xxhash.c # benchmark unit needs XXH64() +lz4-wlib: LDFLAGS += -L $(LZ4DIR) +lz4-wlib: LDLIBS = -llz4 +lz4-wlib: liblz4 $(OBJFILES) + @echo WARNING: $@ must link to an extended variant of the dynamic library which also exposes unstable symbols + $(CC) $(FLAGS) $(OBJFILES) -o $@$(EXT) $(LDLIBS) + +.PHONY:liblz4 +liblz4: + CPPFLAGS="-DLZ4F_PUBLISH_STATIC_FUNCTIONS -DLZ4_PUBLISH_STATIC_FUNCTIONS" $(MAKE) -C $(LZ4DIR) liblz4 + lz4c: lz4 $(LN_SF) lz4$(EXT) lz4c$(EXT) @@ -113,7 +126,8 @@ ifeq ($(WINBASED),yes) endif @$(MAKE) -C $(LZ4DIR) $@ > $(VOID) @$(RM) core *.o *.test tmp* \ - lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) unlz4$(EXT) lz4cat$(EXT) + lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) lz4-wlib$(EXT) \ + unlz4$(EXT) lz4cat$(EXT) @echo Cleaning completed |