1 # ################################################################
2 # Copyright (c) Meta Platforms, Inc. and affiliates.
5 # This source code is licensed under both the BSD-style license (found in the
6 # LICENSE file in the root directory of this source tree) and the GPLv2 (found
7 # in the COPYING file in the root directory of this source tree).
8 # You may select, at your option, one of the above-listed licenses.
9 # ################################################################
12 CPPFLAGS += -I$(LIBDIR)
13 LIB = $(LIBDIR)/libzstd.a
20 all: simple_compression simple_decompression \
21 multiple_simple_compression\
22 dictionary_compression dictionary_decompression \
23 streaming_compression streaming_decompression \
24 multiple_streaming_compression streaming_memory_usage
27 $(MAKE) -C $(LIBDIR) libzstd.a
29 simple_compression.o: common.h
30 simple_compression : $(LIB)
32 simple_decompression.o: common.h
33 simple_decompression : $(LIB)
35 multiple_simple_compression.o: common.h
36 multiple_simple_compression : $(LIB)
38 dictionary_compression.o: common.h
39 dictionary_compression : $(LIB)
41 dictionary_decompression.o: common.h
42 dictionary_decompression : $(LIB)
44 streaming_compression.o: common.h
45 streaming_compression : $(LIB)
47 multiple_streaming_compression.o: common.h
48 multiple_streaming_compression : $(LIB)
50 streaming_decompression.o: common.h
51 streaming_decompression : $(LIB)
53 streaming_memory_usage.o: common.h
54 streaming_memory_usage : $(LIB)
59 @$(RM) core *.o tmp* result* *.zst \
60 simple_compression simple_decompression \
61 multiple_simple_compression \
62 dictionary_compression dictionary_decompression \
63 streaming_compression streaming_decompression \
64 multiple_streaming_compression streaming_memory_usage
65 @echo Cleaning completed
71 @echo -- Simple compression tests
72 ./simple_compression tmp
73 ./simple_decompression tmp.zst
74 ./multiple_simple_compression *.c
75 ./streaming_decompression tmp.zst > /dev/null
76 @echo -- Streaming memory usage
77 ./streaming_memory_usage
78 @echo -- Streaming compression tests
79 ./streaming_compression tmp
80 ./streaming_decompression tmp.zst > /dev/null
81 @echo -- Edge cases detection
82 ! ./streaming_decompression tmp # invalid input, must fail
83 ! ./simple_decompression tmp # invalid input, must fail
84 touch tmpNull # create 0-size file
85 ./simple_compression tmpNull
86 ./simple_decompression tmpNull.zst # 0-size frame : must work
87 @echo -- Multiple streaming tests
88 ./multiple_streaming_compression *.c
89 @echo -- Dictionary compression tests
90 ./dictionary_compression tmp2 tmp README.md
91 ./dictionary_decompression tmp2.zst tmp.zst README.md