2014-07-05 20:33:57 +08:00
|
|
|
# ##########################################################################
|
2014-01-08 02:47:50 +08:00
|
|
|
# LZ4 programs - Makefile
|
2016-06-30 02:25:10 +08:00
|
|
|
# Copyright (C) Yann Collet 2011-2016
|
2014-12-13 22:05:46 +08:00
|
|
|
#
|
2014-01-08 02:47:50 +08:00
|
|
|
# GPL v2 License
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License along
|
|
|
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
#
|
|
|
|
# You can contact the author at :
|
2016-06-30 02:25:10 +08:00
|
|
|
# - LZ4 homepage : http://www.lz4.org
|
2015-03-16 03:40:38 +08:00
|
|
|
# - LZ4 source repository : https://github.com/Cyan4973/lz4
|
2014-07-05 20:33:57 +08:00
|
|
|
# ##########################################################################
|
2014-01-08 02:47:50 +08:00
|
|
|
# lz4 : Command Line Utility, supporting gzip-like arguments
|
|
|
|
# lz4c : CLU, supporting also legacy lz4demo arguments
|
|
|
|
# lz4c32: Same as lz4c, but forced to compile in 32-bits mode
|
2014-07-05 20:33:57 +08:00
|
|
|
# ##########################################################################
|
2014-01-08 02:47:50 +08:00
|
|
|
|
2016-09-03 13:04:16 +08:00
|
|
|
DESTDIR ?=
|
|
|
|
PREFIX ?= /usr/local
|
2016-11-04 20:32:36 +08:00
|
|
|
VOID := /dev/null
|
2015-08-16 00:21:45 +08:00
|
|
|
BINDIR := $(PREFIX)/bin
|
|
|
|
MANDIR := $(PREFIX)/share/man/man1
|
|
|
|
LZ4DIR := ../lib
|
2014-05-21 02:14:53 +08:00
|
|
|
|
2016-06-30 02:25:10 +08:00
|
|
|
CFLAGS ?= -O3 # can select custom flags. For example : CFLAGS="-O2 -g" make
|
2016-11-04 00:27:35 +08:00
|
|
|
CFLAGS += -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wpointer-arith
|
2016-09-03 08:05:01 +08:00
|
|
|
CFLAGS += $(MOREFLAGS)
|
2016-09-22 23:21:04 +08:00
|
|
|
CPPFLAGS:= -I$(LZ4DIR) -DXXH_NAMESPACE=LZ4_ -DLZ4_DLL_EXPORT=1
|
2015-10-21 19:58:06 +08:00
|
|
|
FLAGS := $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
|
|
|
|
|
2014-01-08 02:47:50 +08:00
|
|
|
|
|
|
|
# Define *.exe as extension for Windows systems
|
|
|
|
ifneq (,$(filter Windows%,$(OS)))
|
|
|
|
EXT =.exe
|
|
|
|
else
|
|
|
|
EXT =
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2014-10-28 22:35:43 +08:00
|
|
|
|
2015-03-26 06:59:38 +08:00
|
|
|
default: lz4
|
2014-01-08 02:47:50 +08:00
|
|
|
|
2016-11-03 22:03:43 +08:00
|
|
|
m32: lz4c32
|
2015-03-26 06:59:38 +08:00
|
|
|
|
2016-11-03 22:03:43 +08:00
|
|
|
bins: lz4 lz4c
|
2015-03-26 06:59:38 +08:00
|
|
|
|
|
|
|
all: bins m32
|
2014-01-08 02:47:50 +08:00
|
|
|
|
2015-08-16 00:21:45 +08:00
|
|
|
lz4: $(LZ4DIR)/lz4.o $(LZ4DIR)/lz4hc.o $(LZ4DIR)/lz4frame.o $(LZ4DIR)/xxhash.o bench.o lz4io.o lz4cli.o
|
|
|
|
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
2014-01-08 02:47:50 +08:00
|
|
|
|
2015-08-16 00:21:45 +08:00
|
|
|
lz4c : $(LZ4DIR)/lz4.o $(LZ4DIR)/lz4hc.o $(LZ4DIR)/lz4frame.o $(LZ4DIR)/xxhash.o bench.o lz4io.o lz4cli.o
|
|
|
|
$(CC) $(FLAGS) -DENABLE_LZ4C_LEGACY_OPTIONS $^ -o $@$(EXT)
|
2014-01-08 02:47:50 +08:00
|
|
|
|
2014-12-01 00:59:31 +08:00
|
|
|
lz4c32: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c $(LZ4DIR)/lz4frame.c $(LZ4DIR)/xxhash.c bench.c lz4io.c lz4cli.c
|
2014-12-01 08:25:18 +08:00
|
|
|
$(CC) -m32 $(FLAGS) -DENABLE_LZ4C_LEGACY_OPTIONS $^ -o $@$(EXT)
|
2014-01-08 02:47:50 +08:00
|
|
|
|
|
|
|
clean:
|
2015-10-21 19:58:06 +08:00
|
|
|
@$(MAKE) -C $(LZ4DIR) $@ > $(VOID)
|
2016-09-17 17:59:13 +08:00
|
|
|
@$(RM) core *.o *.test tmp* \
|
2014-01-08 02:47:50 +08:00
|
|
|
lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) \
|
|
|
|
@echo Cleaning completed
|
|
|
|
|
|
|
|
|
2014-07-26 22:15:00 +08:00
|
|
|
#------------------------------------------------------------------------
|
2016-05-17 13:47:03 +08:00
|
|
|
#make install is validated only for Linux, OSX, kFreeBSD, Hurd and
|
|
|
|
#FreeBSD targets
|
|
|
|
ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD))
|
2014-01-08 02:47:50 +08:00
|
|
|
|
2016-01-10 17:09:14 +08:00
|
|
|
install: lz4$(EXT) lz4c$(EXT)
|
2014-04-15 22:47:48 +08:00
|
|
|
@echo Installing binaries
|
2014-01-08 02:47:50 +08:00
|
|
|
@install -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/
|
2016-01-10 17:09:14 +08:00
|
|
|
@install -m 755 lz4$(EXT) $(DESTDIR)$(BINDIR)/lz4$(EXT)
|
|
|
|
@ln -sf lz4$(EXT) $(DESTDIR)$(BINDIR)/lz4cat$(EXT)
|
|
|
|
@ln -sf lz4$(EXT) $(DESTDIR)$(BINDIR)/unlz4$(EXT)
|
|
|
|
@install -m 755 lz4c$(EXT) $(DESTDIR)$(BINDIR)/lz4c$(EXT)
|
2014-04-15 22:47:48 +08:00
|
|
|
@echo Installing man pages
|
2014-01-08 02:47:50 +08:00
|
|
|
@install -m 644 lz4.1 $(DESTDIR)$(MANDIR)/lz4.1
|
2015-03-22 20:42:00 +08:00
|
|
|
@ln -sf lz4.1 $(DESTDIR)$(MANDIR)/lz4c.1
|
|
|
|
@ln -sf lz4.1 $(DESTDIR)$(MANDIR)/lz4cat.1
|
|
|
|
@ln -sf lz4.1 $(DESTDIR)$(MANDIR)/unlz4.1
|
2014-01-08 02:47:50 +08:00
|
|
|
@echo lz4 installation completed
|
|
|
|
|
|
|
|
uninstall:
|
2016-09-17 17:59:13 +08:00
|
|
|
@$(RM) $(DESTDIR)$(BINDIR)/lz4cat$(EXT)
|
|
|
|
@$(RM) $(DESTDIR)$(BINDIR)/unlz4$(EXT)
|
|
|
|
@$(RM) $(DESTDIR)$(BINDIR)/lz4$(EXT)
|
|
|
|
@$(RM) $(DESTDIR)$(BINDIR)/lz4c$(EXT)
|
|
|
|
@$(RM) $(DESTDIR)$(MANDIR)/lz4.1
|
|
|
|
@$(RM) $(DESTDIR)$(MANDIR)/lz4c.1
|
|
|
|
@$(RM) $(DESTDIR)$(MANDIR)/lz4cat.1
|
|
|
|
@$(RM) $(DESTDIR)$(MANDIR)/unlz4.1
|
2014-11-24 01:36:04 +08:00
|
|
|
@echo lz4 programs successfully uninstalled
|
2014-01-08 02:47:50 +08:00
|
|
|
|
|
|
|
endif
|