summaryrefslogtreecommitdiffstats
path: root/programs/Makefile
diff options
context:
space:
mode:
authorTakayuki MATSUOKA <takayuki.matsuoka@gmail.com>2016-11-27 14:40:53 (GMT)
committerTakayuki MATSUOKA <takayuki.matsuoka@gmail.com>2016-11-27 14:40:53 (GMT)
commit544290d587cd91261542d928f7e36192cf5e5df5 (patch)
tree46cff7172ede618c26035b4baa08c566cf994f4e /programs/Makefile
parent018ddf799917ee5c68b5266d6f42277fa6750080 (diff)
downloadlz4-544290d587cd91261542d928f7e36192cf5e5df5.zip
lz4-544290d587cd91261542d928f7e36192cf5e5df5.tar.gz
lz4-544290d587cd91261542d928f7e36192cf5e5df5.tar.bz2
Add "man" target to Makefile
- `make man` makes manpage lz4.1 from lz4.1.md - It needs `gem` and `ronn` which is same as xxhash.1.md is required.
Diffstat (limited to 'programs/Makefile')
-rw-r--r--programs/Makefile27
1 files changed, 27 insertions, 0 deletions
diff --git a/programs/Makefile b/programs/Makefile
index 504416f..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
@@ -42,6 +53,10 @@ DEBUGFLAGS:=-g -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow \
CFLAGS += $(MOREFLAGS)
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)))
@@ -80,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