2016-10-11 22:27:44 +00:00
|
|
|
# ################################################################
|
|
|
|
# Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
|
|
|
|
# All rights reserved.
|
2016-07-10 12:23:30 +00:00
|
|
|
#
|
2017-08-31 18:24:54 +00:00
|
|
|
# This source code is licensed under both the BSD-style license (found in the
|
|
|
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
|
|
|
# in the COPYING file in the root directory of this source tree).
|
2016-10-11 22:27:44 +00:00
|
|
|
# ################################################################
|
2016-07-10 12:23:30 +00:00
|
|
|
|
|
|
|
# This Makefile presumes libzstd is installed, using `sudo make install`
|
|
|
|
|
2018-02-08 07:13:19 +00:00
|
|
|
CPPFLAGS += -I../lib
|
2017-09-18 22:49:59 +00:00
|
|
|
LIB = ../lib/libzstd.a
|
2016-07-10 12:23:30 +00:00
|
|
|
|
|
|
|
.PHONY: default all clean test
|
|
|
|
|
|
|
|
default: all
|
|
|
|
|
2016-07-15 16:52:37 +00:00
|
|
|
all: simple_compression simple_decompression \
|
2018-12-17 05:09:21 +00:00
|
|
|
multiple_simple_compression\
|
2016-08-12 16:42:25 +00:00
|
|
|
dictionary_compression dictionary_decompression \
|
2016-10-27 01:10:43 +00:00
|
|
|
streaming_compression streaming_decompression \
|
2017-09-18 22:49:59 +00:00
|
|
|
multiple_streaming_compression streaming_memory_usage
|
2016-07-10 12:23:30 +00:00
|
|
|
|
2017-09-18 22:49:59 +00:00
|
|
|
$(LIB) :
|
2018-03-31 08:25:07 +00:00
|
|
|
$(MAKE) -C ../lib libzstd.a
|
2017-09-18 22:49:59 +00:00
|
|
|
|
2018-12-16 23:36:28 +00:00
|
|
|
simple_compression : simple_compression.c utils.h $(LIB)
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
|
2017-09-18 22:49:59 +00:00
|
|
|
|
2018-12-16 23:36:28 +00:00
|
|
|
simple_decompression : simple_decompression.c utils.h $(LIB)
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
|
2016-07-10 12:23:30 +00:00
|
|
|
|
2018-12-17 05:09:21 +00:00
|
|
|
multiple_simple_compression : multiple_simple_compression.c utils.h $(LIB)
|
2018-12-16 23:36:28 +00:00
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
|
2018-12-15 02:12:05 +00:00
|
|
|
|
2018-12-16 23:36:28 +00:00
|
|
|
dictionary_compression : dictionary_compression.c utils.h $(LIB)
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
|
2016-07-10 12:23:30 +00:00
|
|
|
|
2018-12-16 23:36:28 +00:00
|
|
|
dictionary_decompression : dictionary_decompression.c utils.h $(LIB)
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
|
2016-07-15 16:52:37 +00:00
|
|
|
|
2018-12-16 23:36:28 +00:00
|
|
|
streaming_compression : streaming_compression.c utils.h $(LIB)
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
|
2016-07-10 12:23:30 +00:00
|
|
|
|
2018-12-16 23:36:28 +00:00
|
|
|
multiple_streaming_compression : multiple_streaming_compression.c utils.h $(LIB)
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
|
2016-08-12 16:42:25 +00:00
|
|
|
|
2018-12-16 23:36:28 +00:00
|
|
|
streaming_decompression : streaming_decompression.c utils.h $(LIB)
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
|
2016-10-27 01:10:43 +00:00
|
|
|
|
2017-09-18 22:49:59 +00:00
|
|
|
streaming_memory_usage : streaming_memory_usage.c $(LIB)
|
2018-12-16 23:36:28 +00:00
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
|
2016-08-12 16:56:27 +00:00
|
|
|
|
2016-07-10 12:23:30 +00:00
|
|
|
clean:
|
|
|
|
@rm -f core *.o tmp* result* *.zst \
|
2016-07-15 16:52:37 +00:00
|
|
|
simple_compression simple_decompression \
|
2018-12-17 05:09:21 +00:00
|
|
|
multiple_simple_compression \
|
2016-09-08 17:29:04 +00:00
|
|
|
dictionary_compression dictionary_decompression \
|
2016-10-27 01:10:43 +00:00
|
|
|
streaming_compression streaming_decompression \
|
2017-09-18 22:49:59 +00:00
|
|
|
multiple_streaming_compression streaming_memory_usage
|
2016-07-10 12:23:30 +00:00
|
|
|
@echo Cleaning completed
|
|
|
|
|
|
|
|
test: all
|
|
|
|
cp README.md tmp
|
2016-09-09 17:33:56 +00:00
|
|
|
cp Makefile tmp2
|
2017-02-22 19:08:00 +00:00
|
|
|
@echo -- Simple compression tests
|
2016-07-10 12:23:30 +00:00
|
|
|
./simple_compression tmp
|
|
|
|
./simple_decompression tmp.zst
|
2018-12-17 05:09:21 +00:00
|
|
|
./multiple_simple_compression *.c
|
2016-09-08 17:29:04 +00:00
|
|
|
./streaming_decompression tmp.zst > /dev/null
|
2017-09-18 22:49:59 +00:00
|
|
|
@echo -- Streaming memory usage
|
|
|
|
./streaming_memory_usage
|
2017-02-22 19:08:00 +00:00
|
|
|
@echo -- Streaming compression tests
|
2016-08-12 16:42:25 +00:00
|
|
|
./streaming_compression tmp
|
2016-09-08 17:39:00 +00:00
|
|
|
./streaming_decompression tmp.zst > /dev/null
|
2017-02-22 19:08:00 +00:00
|
|
|
@echo -- Edge cases detection
|
|
|
|
! ./streaming_decompression tmp # invalid input, must fail
|
|
|
|
! ./simple_decompression tmp # invalid input, must fail
|
|
|
|
! ./simple_decompression tmp.zst # unknown input size, must fail
|
|
|
|
touch tmpNull # create 0-size file
|
|
|
|
./simple_compression tmpNull
|
|
|
|
./simple_decompression tmpNull.zst # 0-size frame : must work
|
|
|
|
@echo -- Multiple streaming tests
|
2016-10-27 01:10:43 +00:00
|
|
|
./multiple_streaming_compression *.c
|
2017-02-22 19:08:00 +00:00
|
|
|
@echo -- Dictionary compression tests
|
2016-09-09 17:33:56 +00:00
|
|
|
./dictionary_compression tmp2 tmp README.md
|
|
|
|
./dictionary_decompression tmp2.zst tmp.zst README.md
|
2016-10-27 01:10:43 +00:00
|
|
|
$(RM) tmp* *.zst
|
2016-07-10 12:23:30 +00:00
|
|
|
@echo tests completed
|