2016-10-11 15:27:44 -07:00
|
|
|
# ################################################################
|
2022-12-20 12:49:47 -05:00
|
|
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
2016-10-11 15:27:44 -07:00
|
|
|
# All rights reserved.
|
2016-07-10 14:23:30 +02:00
|
|
|
#
|
2017-08-31 11:24:54 -07: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).
|
2020-03-26 15:19:05 -07:00
|
|
|
# You may select, at your option, one of the above-listed licenses.
|
2016-10-11 15:27:44 -07:00
|
|
|
# ################################################################
|
2016-07-10 14:23:30 +02:00
|
|
|
|
2020-12-15 02:06:01 -08:00
|
|
|
LIBDIR =../lib
|
|
|
|
|
CPPFLAGS += -I$(LIBDIR)
|
|
|
|
|
LIB = $(LIBDIR)/libzstd.a
|
2016-07-10 14:23:30 +02:00
|
|
|
|
|
|
|
|
|
2020-12-15 02:06:01 -08:00
|
|
|
.PHONY: default
|
2016-07-10 14:23:30 +02:00
|
|
|
default: all
|
|
|
|
|
|
2020-12-15 02:06:01 -08:00
|
|
|
.PHONY: all
|
2016-07-15 18:52:37 +02:00
|
|
|
all: simple_compression simple_decompression \
|
2018-12-16 21:09:21 -08:00
|
|
|
multiple_simple_compression\
|
2016-08-12 18:42:25 +02:00
|
|
|
dictionary_compression dictionary_decompression \
|
2016-10-26 18:10:43 -07:00
|
|
|
streaming_compression streaming_decompression \
|
2017-09-18 15:49:59 -07:00
|
|
|
multiple_streaming_compression streaming_memory_usage
|
2016-07-10 14:23:30 +02:00
|
|
|
|
2017-09-18 15:49:59 -07:00
|
|
|
$(LIB) :
|
2020-12-15 02:06:01 -08:00
|
|
|
$(MAKE) -C $(LIBDIR) libzstd.a
|
|
|
|
|
|
|
|
|
|
simple_compression.o: common.h
|
|
|
|
|
simple_compression : $(LIB)
|
2017-09-18 15:49:59 -07:00
|
|
|
|
2020-12-15 02:06:01 -08:00
|
|
|
simple_decompression.o: common.h
|
|
|
|
|
simple_decompression : $(LIB)
|
2017-09-18 15:49:59 -07:00
|
|
|
|
2020-12-15 02:06:01 -08:00
|
|
|
multiple_simple_compression.o: common.h
|
|
|
|
|
multiple_simple_compression : $(LIB)
|
2016-07-10 14:23:30 +02:00
|
|
|
|
2020-12-15 02:06:01 -08:00
|
|
|
dictionary_compression.o: common.h
|
|
|
|
|
dictionary_compression : $(LIB)
|
2018-12-14 18:12:05 -08:00
|
|
|
|
2020-12-15 02:06:01 -08:00
|
|
|
dictionary_decompression.o: common.h
|
|
|
|
|
dictionary_decompression : $(LIB)
|
2016-07-10 14:23:30 +02:00
|
|
|
|
2020-12-15 02:06:01 -08:00
|
|
|
streaming_compression.o: common.h
|
|
|
|
|
streaming_compression : $(LIB)
|
2016-07-15 18:52:37 +02:00
|
|
|
|
2020-12-15 02:06:01 -08:00
|
|
|
multiple_streaming_compression.o: common.h
|
|
|
|
|
multiple_streaming_compression : $(LIB)
|
2016-07-10 14:23:30 +02:00
|
|
|
|
2020-12-15 02:06:01 -08:00
|
|
|
streaming_decompression.o: common.h
|
|
|
|
|
streaming_decompression : $(LIB)
|
2016-08-12 18:42:25 +02:00
|
|
|
|
2020-12-15 02:06:01 -08:00
|
|
|
streaming_memory_usage.o: common.h
|
|
|
|
|
streaming_memory_usage : $(LIB)
|
2016-10-26 18:10:43 -07:00
|
|
|
|
2016-08-12 18:56:27 +02:00
|
|
|
|
2020-12-15 02:06:01 -08:00
|
|
|
.PHONY:clean
|
2016-07-10 14:23:30 +02:00
|
|
|
clean:
|
2020-12-15 02:06:01 -08:00
|
|
|
@$(RM) core *.o tmp* result* *.zst \
|
2016-07-15 18:52:37 +02:00
|
|
|
simple_compression simple_decompression \
|
2018-12-16 21:09:21 -08:00
|
|
|
multiple_simple_compression \
|
2016-09-08 19:29:04 +02:00
|
|
|
dictionary_compression dictionary_decompression \
|
2016-10-26 18:10:43 -07:00
|
|
|
streaming_compression streaming_decompression \
|
2017-09-18 15:49:59 -07:00
|
|
|
multiple_streaming_compression streaming_memory_usage
|
2016-07-10 14:23:30 +02:00
|
|
|
@echo Cleaning completed
|
|
|
|
|
|
2020-12-15 02:06:01 -08:00
|
|
|
.PHONY:test
|
2016-07-10 14:23:30 +02:00
|
|
|
test: all
|
|
|
|
|
cp README.md tmp
|
2016-09-09 19:33:56 +02:00
|
|
|
cp Makefile tmp2
|
2017-02-22 11:08:00 -08:00
|
|
|
@echo -- Simple compression tests
|
2016-07-10 14:23:30 +02:00
|
|
|
./simple_compression tmp
|
|
|
|
|
./simple_decompression tmp.zst
|
2018-12-16 21:09:21 -08:00
|
|
|
./multiple_simple_compression *.c
|
2016-09-08 19:29:04 +02:00
|
|
|
./streaming_decompression tmp.zst > /dev/null
|
2017-09-18 15:49:59 -07:00
|
|
|
@echo -- Streaming memory usage
|
|
|
|
|
./streaming_memory_usage
|
2017-02-22 11:08:00 -08:00
|
|
|
@echo -- Streaming compression tests
|
2016-08-12 18:42:25 +02:00
|
|
|
./streaming_compression tmp
|
2016-09-08 19:39:00 +02: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
|
|
|
|
|
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 19:33:56 +02: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 14:23:30 +02:00
|
|
|
@echo tests completed
|