1 # ################################################################
2 # Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
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 # ################################################################
11 # This Makefile presumes libzstd is installed, using `sudo make install`
14 LIB
= ..
/lib
/libzstd.a
16 .PHONY
: default
all clean test
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 ..
/lib libzstd.a
29 simple_compression
: simple_compression.c common.h
$(LIB
)
30 $(CC
) $(CPPFLAGS
) $(CFLAGS
) $< $(LIB
) $(LDFLAGS
) -o
$@
32 simple_decompression
: simple_decompression.c common.h
$(LIB
)
33 $(CC
) $(CPPFLAGS
) $(CFLAGS
) $< $(LIB
) $(LDFLAGS
) -o
$@
35 multiple_simple_compression
: multiple_simple_compression.c common.h
$(LIB
)
36 $(CC
) $(CPPFLAGS
) $(CFLAGS
) $< $(LIB
) $(LDFLAGS
) -o
$@
38 dictionary_compression
: dictionary_compression.c common.h
$(LIB
)
39 $(CC
) $(CPPFLAGS
) $(CFLAGS
) $< $(LIB
) $(LDFLAGS
) -o
$@
41 dictionary_decompression
: dictionary_decompression.c common.h
$(LIB
)
42 $(CC
) $(CPPFLAGS
) $(CFLAGS
) $< $(LIB
) $(LDFLAGS
) -o
$@
44 streaming_compression
: streaming_compression.c common.h
$(LIB
)
45 $(CC
) $(CPPFLAGS
) $(CFLAGS
) $< $(LIB
) $(LDFLAGS
) -o
$@
47 multiple_streaming_compression
: multiple_streaming_compression.c common.h
$(LIB
)
48 $(CC
) $(CPPFLAGS
) $(CFLAGS
) $< $(LIB
) $(LDFLAGS
) -o
$@
50 streaming_decompression
: streaming_decompression.c common.h
$(LIB
)
51 $(CC
) $(CPPFLAGS
) $(CFLAGS
) $< $(LIB
) $(LDFLAGS
) -o
$@
53 streaming_memory_usage
: streaming_memory_usage.c
$(LIB
)
54 $(CC
) $(CPPFLAGS
) $(CFLAGS
) $< $(LIB
) $(LDFLAGS
) -o
$@
57 @
rm -f core
*.o tmp
* result
* *.zst \
58 simple_compression simple_decompression \
59 multiple_simple_compression \
60 dictionary_compression dictionary_decompression \
61 streaming_compression streaming_decompression \
62 multiple_streaming_compression streaming_memory_usage
63 @echo Cleaning completed
68 @echo
-- Simple compression tests
69 .
/simple_compression tmp
70 .
/simple_decompression tmp.zst
71 .
/multiple_simple_compression
*.c
72 .
/streaming_decompression tmp.zst
> /dev
/null
73 @echo
-- Streaming memory usage
74 .
/streaming_memory_usage
75 @echo
-- Streaming compression tests
76 .
/streaming_compression tmp
77 .
/streaming_decompression tmp.zst
> /dev
/null
78 @echo
-- Edge cases detection
79 ! .
/streaming_decompression tmp
# invalid input, must fail
80 ! .
/simple_decompression tmp
# invalid input, must fail
81 touch tmpNull
# create 0-size file
82 .
/simple_compression tmpNull
83 .
/simple_decompression tmpNull.zst
# 0-size frame : must work
84 @echo
-- Multiple streaming tests
85 .
/multiple_streaming_compression
*.c
86 @echo
-- Dictionary compression tests
87 .
/dictionary_compression tmp2 tmp README.md
88 .
/dictionary_decompression tmp2.zst tmp.zst README.md