2015-01-23 16:58:16 -08:00
|
|
|
# ##########################################################################
|
|
|
|
# ZSTD programs - Makefile
|
|
|
|
# Copyright (C) Yann Collet 2015
|
|
|
|
#
|
|
|
|
# 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 :
|
|
|
|
# - ZSTD source repository : http://code.google.com/p/zstd/
|
|
|
|
# - Public forum : https://groups.google.com/forum/#!forum/lz4c
|
|
|
|
# ##########################################################################
|
|
|
|
# zstd : Command Line Utility, supporting gzip-like arguments
|
|
|
|
# datagen : Synthetic and parametrable data generator, for tests
|
|
|
|
# fuzzer : Test tool, to check zstd integrity on target platform
|
|
|
|
# fuzzer32: Same as fuzzer, but forced to compile in 32-bits mode
|
|
|
|
# fullbench : Precisely measure speed for each zstd inner function
|
|
|
|
# fullbench32: Same as fullbench, but forced to compile in 32-bits mode
|
|
|
|
# ##########################################################################
|
|
|
|
|
2015-06-20 20:37:53 -07:00
|
|
|
RELEASE?= v0.0.2
|
2015-01-23 16:58:16 -08:00
|
|
|
|
|
|
|
DESTDIR?=
|
|
|
|
PREFIX ?= /usr
|
|
|
|
CFLAGS ?= -O3
|
2015-06-20 20:37:53 -07:00
|
|
|
CFLAGS += -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -DZSTD_VERSION=\"$(RELEASE)\"
|
2015-01-23 16:58:16 -08:00
|
|
|
FLAGS = -I../lib $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
|
|
|
|
|
|
|
|
BINDIR=$(PREFIX)/bin
|
|
|
|
MANDIR=$(PREFIX)/share/man/man1
|
|
|
|
ZSTDDIR=../lib
|
|
|
|
|
|
|
|
TEST_FILES = COPYING
|
|
|
|
TEST_TARGETS=test-native
|
|
|
|
|
|
|
|
|
|
|
|
# Define *.exe as extension for Windows systems
|
|
|
|
ifneq (,$(filter Windows%,$(OS)))
|
|
|
|
EXT =.exe
|
|
|
|
VOID = nul
|
|
|
|
else
|
|
|
|
EXT =
|
|
|
|
VOID = /dev/null
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
default: zstd
|
|
|
|
|
|
|
|
all: zstd zstd32 fullbench fullbench32 fuzzer fuzzer32
|
|
|
|
|
|
|
|
zstd: $(ZSTDDIR)/zstd.c xxhash.c bench.c fileio.c zstdcli.c
|
|
|
|
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
|
|
|
|
|
|
|
zstd32: $(ZSTDDIR)/zstd.c xxhash.c bench.c fileio.c zstdcli.c
|
|
|
|
$(CC) -m32 $(FLAGS) $^ -o $@$(EXT)
|
|
|
|
|
2015-02-10 23:19:57 -08:00
|
|
|
fullbench : $(ZSTDDIR)/zstd.c datagen.c fullbench.c
|
2015-01-23 16:58:16 -08:00
|
|
|
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
|
|
|
|
2015-02-10 23:19:57 -08:00
|
|
|
fullbench32: $(ZSTDDIR)/zstd.c datagen.c fullbench.c
|
2015-01-23 16:58:16 -08:00
|
|
|
$(CC) -m32 $(FLAGS) $^ -o $@$(EXT)
|
|
|
|
|
|
|
|
fuzzer : $(ZSTDDIR)/zstd.c xxhash.c fuzzer.c
|
|
|
|
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
|
|
|
|
|
|
|
fuzzer32: $(ZSTDDIR)/zstd.c xxhash.c fuzzer.c
|
|
|
|
$(CC) -m32 $(FLAGS) $^ -o $@$(EXT)
|
|
|
|
|
2015-02-08 23:00:26 -08:00
|
|
|
datagen : datagen.c datagencli.c
|
2015-01-23 16:58:16 -08:00
|
|
|
$(CC) $(FLAGS) $^ -o $@$(EXT)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@rm -f core *.o tmp \
|
|
|
|
zstd$(EXT) zstd32$(EXT) \
|
|
|
|
fullbench$(EXT) fullbench32$(EXT) \
|
|
|
|
fuzzer$(EXT) fuzzer32$(EXT) \
|
|
|
|
datagen$(EXT)
|
|
|
|
@echo Cleaning completed
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#make install is validated only for Linux, OSX, kFreeBSD and Hurd targets
|
|
|
|
ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU))
|
|
|
|
|
|
|
|
install: zstd
|
|
|
|
@echo Installing binaries
|
|
|
|
@install -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/
|
|
|
|
@install -m 755 zstd$(EXT) $(DESTDIR)$(BINDIR)/zstd$(EXT)
|
|
|
|
@ln -sf zstd$(EXT) $(DESTDIR)$(BINDIR)/zstdcat
|
2015-03-24 12:15:56 -07:00
|
|
|
@ln -sf zstd$(EXT) $(DESTDIR)$(BINDIR)/unzstd
|
2015-01-23 16:58:16 -08:00
|
|
|
@echo Installing man pages
|
|
|
|
@install -m 644 zstd.1 $(DESTDIR)$(MANDIR)/zstd.1
|
|
|
|
@install -m 644 zstdcat.1 $(DESTDIR)$(MANDIR)/zstdcat.1
|
2015-03-24 12:15:56 -07:00
|
|
|
@install -m 644 unzstd.1 $(DESTDIR)$(MANDIR)/unzstd.1
|
2015-01-23 16:58:16 -08:00
|
|
|
@echo zstd installation completed
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
rm -f $(DESTDIR)$(BINDIR)/zstdcat
|
2015-03-24 12:15:56 -07:00
|
|
|
rm -f $(DESTDIR)$(BINDIR)/unzstd
|
2015-01-23 16:58:16 -08:00
|
|
|
[ -x $(DESTDIR)$(BINDIR)/zstd$(EXT) ] && rm -f $(DESTDIR)$(BINDIR)/zstd$(EXT)
|
|
|
|
[ -f $(DESTDIR)$(MANDIR)/zstd.1 ] && rm -f $(DESTDIR)$(MANDIR)/zstd.1
|
|
|
|
[ -f $(DESTDIR)$(MANDIR)/zstdcat.1 ] && rm -f $(DESTDIR)$(MANDIR)/zstdcat.1
|
2015-03-24 12:15:56 -07:00
|
|
|
[ -f $(DESTDIR)$(MANDIR)/unzstd.1 ] && rm -f $(DESTDIR)$(MANDIR)/unzstd.1
|
2015-01-23 16:58:16 -08:00
|
|
|
@echo zstd programs successfully uninstalled
|
|
|
|
|
|
|
|
test: test-zstd test-fullbench test-fuzzer test-mem
|
|
|
|
|
|
|
|
test32: test-zstd32 test-fullbench32 test-fuzzer32
|
|
|
|
|
|
|
|
test-all: test test32
|
|
|
|
|
|
|
|
test-zstd: zstd datagen
|
2015-07-07 00:58:59 -07:00
|
|
|
./datagen | ./zstd -v | ./zstd -d > $(VOID)
|
|
|
|
./datagen -g256MB | ./zstd -v | ./zstd -d > $(VOID)
|
|
|
|
./datagen -g6GB -P99 | ./zstd -vq | ./zstd -d > $(VOID)
|
2015-01-23 16:58:16 -08:00
|
|
|
|
|
|
|
test-zstd32: zstd32 datagen
|
2015-07-07 00:58:59 -07:00
|
|
|
./datagen | ./zstd32 -v | ./zstd32 -d > $(VOID)
|
|
|
|
./datagen -g256MB | ./zstd32 -v | ./zstd32 -d > $(VOID)
|
|
|
|
./datagen -g6GB -P99 | ./zstd32 -vq | ./zstd32 -d > $(VOID)
|
2015-01-23 16:58:16 -08:00
|
|
|
|
2015-01-24 04:31:55 -08:00
|
|
|
test-fullbench: fullbench datagen
|
2015-01-23 16:58:16 -08:00
|
|
|
./fullbench -i1
|
2015-02-10 23:34:50 -08:00
|
|
|
./fullbench -i1 -P0
|
2015-01-23 16:58:16 -08:00
|
|
|
|
2015-01-24 04:31:55 -08:00
|
|
|
test-fullbench32: fullbench32 datagen
|
2015-01-23 16:58:16 -08:00
|
|
|
./fullbench32 -i1
|
2015-02-10 23:34:50 -08:00
|
|
|
./fullbench32 -i1 -P0
|
2015-01-23 16:58:16 -08:00
|
|
|
|
|
|
|
test-fuzzer: fuzzer
|
|
|
|
./fuzzer
|
|
|
|
|
|
|
|
test-fuzzer32: fuzzer32
|
|
|
|
./fuzzer32
|
|
|
|
|
|
|
|
test-mem: zstd datagen fuzzer fullbench
|
2015-06-20 20:37:53 -07:00
|
|
|
@echo "\n ---- valgrind tests : memory analyzer ----"
|
|
|
|
valgrind --leak-check=yes --error-exitcode=1 ./datagen -g50M > /dev/null
|
2015-01-23 16:58:16 -08:00
|
|
|
./datagen -g16KB > tmp
|
2015-06-20 20:37:53 -07:00
|
|
|
valgrind --leak-check=yes --error-exitcode=1 ./zstd -vf tmp /dev/null
|
2015-01-23 16:58:16 -08:00
|
|
|
./datagen -g128MB > tmp
|
2015-06-20 20:37:53 -07:00
|
|
|
valgrind --leak-check=yes --error-exitcode=1 ./zstd -vf tmp /dev/null
|
2015-01-28 22:00:43 -08:00
|
|
|
@rm tmp
|
2015-06-20 20:37:53 -07:00
|
|
|
valgrind --leak-check=yes --error-exitcode=1 ./fuzzer -i128 -t1
|
|
|
|
valgrind --leak-check=yes --error-exitcode=1 ./fullbench -i1
|
2015-01-23 16:58:16 -08:00
|
|
|
|
|
|
|
endif
|