1 # ################################################################
2 # Copyright (c) 2016-present, 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 # ################################################################
10 ZSTD ?= zstd # note: requires zstd installation on local system
12 UNAME?= $(shell uname)
13 ifeq ($(UNAME), SunOS)
21 MULTITHREAD_LDFLAGS = -pthread
22 DEBUGFLAGS= -g -DZSTD_DEBUG=1
23 CPPFLAGS += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
24 -I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(PRGDIR)
26 CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
27 -Wstrict-aliasing=1 -Wswitch-enum \
28 -Wredundant-decls -Wstrict-prototypes -Wundef \
29 -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
31 CFLAGS += $(DEBUGFLAGS)
32 CFLAGS += $(MOREFLAGS)
33 FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(MULTITHREAD_LDFLAGS)
35 harness: $(HARNESS_FILES)
36 $(CC) $(FLAGS) $^ -o $@
40 @$(RM) -rf harness.dSYM # MacOS specific
44 # Testing single-file decompression with educational decoder
46 @$(ZSTD) -f README.md -o tmp.zst
47 @./harness tmp.zst tmp
48 @$(DIFF) -s tmp README.md
51 # Testing dictionary decompression with education decoder
53 # note : files are presented multiple for training, to reach minimum threshold
54 @$(ZSTD) --train harness.c zstd_decompress.c zstd_decompress.h README.md \
55 harness.c zstd_decompress.c zstd_decompress.h README.md \
56 harness.c zstd_decompress.c zstd_decompress.h README.md \
58 @$(ZSTD) -f README.md -D dictionary -o tmp.zst
59 @./harness tmp.zst tmp dictionary
60 @$(DIFF) -s tmp README.md
61 @$(RM) tmp* dictionary