2016-10-11 15:27:44 -07:00
|
|
|
# ################################################################
|
|
|
|
# Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
|
|
|
|
# All rights reserved.
|
2016-07-10 05:23:30 -07:00
|
|
|
#
|
2016-10-11 15:27:44 -07:00
|
|
|
# This source code is licensed under the BSD-style license found in the
|
|
|
|
# LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
# of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
# ################################################################
|
2016-07-10 05:23:30 -07:00
|
|
|
|
|
|
|
# This Makefile presumes libzstd is installed, using `sudo make install`
|
|
|
|
|
2017-02-22 11:08:00 -08:00
|
|
|
LDFLAGS += -lzstd
|
2016-07-10 05:23:30 -07:00
|
|
|
|
|
|
|
.PHONY: default all clean test
|
|
|
|
|
|
|
|
default: all
|
|
|
|
|
2016-07-15 09:52:37 -07:00
|
|
|
all: simple_compression simple_decompression \
|
2016-08-12 09:42:25 -07:00
|
|
|
dictionary_compression dictionary_decompression \
|
2016-10-26 18:10:43 -07:00
|
|
|
streaming_compression streaming_decompression \
|
|
|
|
multiple_streaming_compression
|
2016-07-10 05:23:30 -07:00
|
|
|
|
|
|
|
simple_compression : simple_compression.c
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@
|
|
|
|
|
|
|
|
simple_decompression : simple_decompression.c
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@
|
|
|
|
|
2016-07-15 09:52:37 -07:00
|
|
|
dictionary_compression : dictionary_compression.c
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@
|
|
|
|
|
2016-07-10 05:23:30 -07:00
|
|
|
dictionary_decompression : dictionary_decompression.c
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@
|
|
|
|
|
2016-08-12 09:42:25 -07:00
|
|
|
streaming_compression : streaming_compression.c
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@
|
|
|
|
|
2016-10-26 18:10:43 -07:00
|
|
|
multiple_streaming_compression : multiple_streaming_compression.c
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@
|
|
|
|
|
2016-08-12 09:56:27 -07:00
|
|
|
streaming_decompression : streaming_decompression.c
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@
|
|
|
|
|
2016-07-10 05:23:30 -07:00
|
|
|
clean:
|
|
|
|
@rm -f core *.o tmp* result* *.zst \
|
2016-07-15 09:52:37 -07:00
|
|
|
simple_compression simple_decompression \
|
2016-09-08 10:29:04 -07:00
|
|
|
dictionary_compression dictionary_decompression \
|
2016-10-26 18:10:43 -07:00
|
|
|
streaming_compression streaming_decompression \
|
2017-05-15 17:15:46 -07:00
|
|
|
multiple_streaming_compression
|
2016-07-10 05:23:30 -07:00
|
|
|
@echo Cleaning completed
|
|
|
|
|
|
|
|
test: all
|
|
|
|
cp README.md tmp
|
2016-09-09 10:33:56 -07:00
|
|
|
cp Makefile tmp2
|
2017-02-22 11:08:00 -08:00
|
|
|
@echo -- Simple compression tests
|
2016-07-10 05:23:30 -07:00
|
|
|
./simple_compression tmp
|
|
|
|
./simple_decompression tmp.zst
|
2016-09-08 10:29:04 -07:00
|
|
|
./streaming_decompression tmp.zst > /dev/null
|
2017-02-22 11:08:00 -08:00
|
|
|
@echo -- Streaming compression tests
|
2016-08-12 09:42:25 -07:00
|
|
|
./streaming_compression tmp
|
2016-09-08 10:39:00 -07:00
|
|
|
./streaming_decompression tmp.zst > /dev/null
|
2017-02-22 11:08:00 -08: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-26 18:10:43 -07:00
|
|
|
./multiple_streaming_compression *.c
|
2017-02-22 11:08:00 -08:00
|
|
|
@echo -- Dictionary compression tests
|
2016-09-09 10:33:56 -07:00
|
|
|
./dictionary_compression tmp2 tmp README.md
|
|
|
|
./dictionary_decompression tmp2.zst tmp.zst README.md
|
2016-10-26 18:10:43 -07:00
|
|
|
$(RM) tmp* *.zst
|
2016-07-10 05:23:30 -07:00
|
|
|
@echo tests completed
|