]> git.proxmox.com Git - ceph.git/blob - ceph/src/zstd/examples/Makefile
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / zstd / examples / Makefile
1 # ################################################################
2 # Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
3 # All rights reserved.
4 #
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 # ################################################################
10
11 # This Makefile presumes libzstd is installed, using `sudo make install`
12
13 CPPFLAGS += -I../lib
14 LIB = ../lib/libzstd.a
15
16 .PHONY: default all clean test
17
18 default: all
19
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
25
26 $(LIB) :
27 $(MAKE) -C ../lib libzstd.a
28
29 simple_compression : simple_compression.c common.h $(LIB)
30 $(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
31
32 simple_decompression : simple_decompression.c common.h $(LIB)
33 $(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
34
35 multiple_simple_compression : multiple_simple_compression.c common.h $(LIB)
36 $(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
37
38 dictionary_compression : dictionary_compression.c common.h $(LIB)
39 $(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
40
41 dictionary_decompression : dictionary_decompression.c common.h $(LIB)
42 $(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
43
44 streaming_compression : streaming_compression.c common.h $(LIB)
45 $(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
46
47 multiple_streaming_compression : multiple_streaming_compression.c common.h $(LIB)
48 $(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
49
50 streaming_decompression : streaming_decompression.c common.h $(LIB)
51 $(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
52
53 streaming_memory_usage : streaming_memory_usage.c $(LIB)
54 $(CC) $(CPPFLAGS) $(CFLAGS) $< $(LIB) $(LDFLAGS) -o $@
55
56 clean:
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
64
65 test: all
66 cp README.md tmp
67 cp Makefile tmp2
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
89 $(RM) tmp* *.zst
90 @echo tests completed