summaryrefslogtreecommitdiffstats
path: root/programs/Makefile
diff options
context:
space:
mode:
authorPrzemyslaw Skibinski <inikep@gmail.com>2016-12-06 12:44:42 (GMT)
committerPrzemyslaw Skibinski <inikep@gmail.com>2016-12-06 12:44:42 (GMT)
commit5ae0e789fc185dc760d05f17493f85386b515556 (patch)
tree6035003c4b7e089f730047212046292a704bd14b /programs/Makefile
parentde0cf5de640eb56775f44c0f4c7c7a065e00447c (diff)
parent5eb547a6080b8e63b5e522b448e31052fbc6b927 (diff)
downloadlz4-5ae0e789fc185dc760d05f17493f85386b515556.zip
lz4-5ae0e789fc185dc760d05f17493f85386b515556.tar.gz
lz4-5ae0e789fc185dc760d05f17493f85386b515556.tar.bz2
Merge remote-tracking branch 'refs/remotes/lz4/dev' into dev
Diffstat (limited to 'programs/Makefile')
-rw-r--r--programs/Makefile46
1 files changed, 37 insertions, 9 deletions
diff --git a/programs/Makefile b/programs/Makefile
index 9939a44..ffbcbf1 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -27,6 +27,17 @@
# lz4c32: Same as lz4c, but forced to compile in 32-bits mode
# ##########################################################################
+# Version numbers
+LIBVER_SRC := ../lib/lz4.h
+LIBVER_MAJOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
+LIBVER_MINOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
+LIBVER_PATCH_SCRIPT:=`sed -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
+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
BINDIR := $(PREFIX)/bin
@@ -34,14 +45,18 @@ MANDIR := $(PREFIX)/share/man/man1
LZ4DIR := ../lib
VOID := /dev/null
-CFLAGS ?= -O3 # allows custom optimization flags. For example : CFLAGS="-O2 -g" make
-CFLAGS += -g -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow \
+CPPFLAGS+= -I$(LZ4DIR) -DXXH_NAMESPACE=LZ4_
+CFLAGS ?= -O3
+DEBUGFLAGS:=-g -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow \
-Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes \
- -Wpointer-arith -Wstrict-aliasing=1
+ -Wpointer-arith -Wstrict-aliasing=1
CFLAGS += $(MOREFLAGS)
-CPPFLAGS:= -I$(LZ4DIR) -DXXH_NAMESPACE=LZ4_
FLAGS = $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
+LZ4_VERSION=$(LIBVER)
+MD2ROFF =ronn
+MD2ROFF_FLAGS = --roff --warnings --manual="User Commands" --organization="lz4 $(LZ4_VERSION)"
+
# Define *.exe as extension for Windows systems
ifneq (,$(filter Windows%,$(OS)))
@@ -54,17 +69,18 @@ endif
default: lz4-release
+lz4-release: $(LZ4DIR)/lz4.o $(LZ4DIR)/lz4hc.o $(LZ4DIR)/lz4frame.o $(LZ4DIR)/xxhash.o bench.o lz4io.o lz4cli.o datagen.o
+ $(CC) $(FLAGS) $^ -o lz4$(EXT)
+
all: lz4 lz4c
all32: CFLAGS+=-m32
all32: all
-lz4: $(LZ4DIR)/lz4.o $(LZ4DIR)/lz4hc.o $(LZ4DIR)/lz4frame.o $(LZ4DIR)/xxhash.o bench.o lz4io.o lz4cli.o datagen.o
- $(CC) $(FLAGS) $^ -o $@$(EXT)
-
-lz4-release: CFLAGS := -O3
-lz4-release: lz4
+lz4: CFLAGS += $(DEBUGFLAGS)
+lz4: lz4-release
+lz4c: CFLAGS += $(DEBUGFLAGS)
lz4c : $(LZ4DIR)/lz4.o $(LZ4DIR)/lz4hc.o $(LZ4DIR)/lz4frame.o $(LZ4DIR)/xxhash.o bench.o lz4io.o lz4cli.c datagen.o
$(CC) $(FLAGS) -DENABLE_LZ4C_LEGACY_OPTIONS $^ -o $@$(EXT)
@@ -79,6 +95,18 @@ clean:
@echo Cleaning completed
+lz4.1: lz4.1.md
+ cat $^ | $(MD2ROFF) $(MD2ROFF_FLAGS) | sed -n '/^\.\\\".*/!p' > $@
+
+man: lz4.1
+
+clean-man:
+ rm lz4.1
+
+preview-man: clean-man man
+ man ./lz4.1
+
+
#------------------------------------------------------------------------
#make install is validated only for Linux, OSX, kFreeBSD, Hurd and
#FreeBSD targets