lz4 version source from lz4.h

This commit is contained in:
Yann Collet 2016-09-02 22:04:16 -07:00
parent dd51ca6300
commit 28f98647e3
5 changed files with 20 additions and 19 deletions

View File

@ -30,10 +30,6 @@
# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
# ################################################################
# Version number
export VERSION=132
export RELEASE=r$(VERSION)
DESTDIR?=
PREFIX ?= /usr/local

2
lib/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# make install artefact
liblz4.pc

View File

@ -31,17 +31,21 @@
# ################################################################
# Version numbers
VERSION?= 132
LIBVER_MAJOR:=`sed -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lz4.h`
LIBVER_MINOR:=`sed -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lz4.h`
LIBVER_PATCH:=`sed -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lz4.h`
LIBVER := $(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH)
LIBVER_MAJOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./lz4.h`
LIBVER_MINOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./lz4.h`
LIBVER_PATCH_SCRIPT:=`sed -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./lz4.h`
LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT)
LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT))
LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT))
LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT))
LIBVER := $(shell echo $(LIBVER_SCRIPT))
DESTDIR?=
PREFIX ?= /usr/local
CPPFLAGS= -DXXH_NAMESPACE=LZ4_
CFLAGS ?= -O3
CFLAGS += -std=gnu99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wcast-qual -Wstrict-prototypes -pedantic
CFLAGS += -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wcast-qual -Wstrict-prototypes
FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
LIBDIR?= $(PREFIX)/lib
@ -66,9 +70,10 @@ default: liblz4
all: liblz4
liblz4: lz4.c lz4hc.c lz4frame.c xxhash.c # need to compile once with -fPIC, and once without -fPIC
liblz4: *.c
@echo compiling static library
@$(AR) rcs $@.a $^
@$(CC) $(FLAGS) -c $^
@$(AR) rcs $@.a *.o
@echo compiling dynamic library $(LIBVER)
@$(CC) $(FLAGS) -shared $^ -fPIC $(SONAME_FLAGS) -o $@.$(SHARED_EXT_VER)
@echo creating versioned links
@ -90,7 +95,7 @@ liblz4.pc: liblz4.pc.in Makefile
@sed -e 's|@PREFIX@|$(PREFIX)|' \
-e 's|@LIBDIR@|$(LIBDIR)|' \
-e 's|@INCLUDEDIR@|$(INCLUDEDIR)|' \
-e 's|@VERSION@|$(VERSION)|' \
-e 's|@VERSION@|$(LIBVER)|' \
$< >$@
install: liblz4 liblz4.pc

View File

@ -7,7 +7,7 @@ libdir=@LIBDIR@
includedir=@INCLUDEDIR@
Name: lz4
Description: fast lossless compression algorithm library
Description: extremely fast lossless compression algorithm library
URL: http://www.lz4.org/
Version: @VERSION@
Libs: -L@LIBDIR@ -llz4

View File

@ -34,17 +34,15 @@
# datagen : generates synthetic data samples for tests & benchmarks
# ##########################################################################
RELEASE ?= r132
DESTDIR ?=
PREFIX ?= /usr/local
BINDIR := $(PREFIX)/bin
MANDIR := $(PREFIX)/share/man/man1
LZ4DIR := ../lib
DESTDIR ?=
PREFIX ?= /usr/local
CFLAGS ?= -O3 # can select custom flags. For example : CFLAGS="-O2 -g" make
CFLAGS += -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes
CPPFLAGS:= -I$(LZ4DIR) -DXXH_NAMESPACE=LZ4_ -DLZ4_VERSION=\"$(RELEASE)\"
CPPFLAGS:= -I$(LZ4DIR) -DXXH_NAMESPACE=LZ4_
FLAGS := $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)