aboutsummaryrefslogtreecommitdiff
path: root/doc/educational_decoder/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'doc/educational_decoder/Makefile')
-rw-r--r--doc/educational_decoder/Makefile56
1 files changed, 42 insertions, 14 deletions
diff --git a/doc/educational_decoder/Makefile b/doc/educational_decoder/Makefile
index c1d2c4cc42fa1..704f867661a74 100644
--- a/doc/educational_decoder/Makefile
+++ b/doc/educational_decoder/Makefile
@@ -1,15 +1,33 @@
+# ################################################################
+# Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
+# All rights reserved.
+#
+# 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).
+# ################################################################
+
+ZSTD ?= zstd # note: requires zstd installation on local system
+
+UNAME?= $(shell uname)
+ifeq ($(UNAME), SunOS)
+DIFF ?= gdiff
+else
+DIFF ?= diff
+endif
+
HARNESS_FILES=*.c
MULTITHREAD_LDFLAGS = -pthread
DEBUGFLAGS= -g -DZSTD_DEBUG=1
CPPFLAGS += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
-I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(PRGDIR)
-CFLAGS ?= -O3
+CFLAGS ?= -O2
CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
- -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
- -Wstrict-prototypes -Wundef \
+ -Wstrict-aliasing=1 -Wswitch-enum \
+ -Wredundant-decls -Wstrict-prototypes -Wundef \
-Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
- -Wredundant-decls
+ -std=c99
CFLAGS += $(DEBUGFLAGS)
CFLAGS += $(MOREFLAGS)
FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(MULTITHREAD_LDFLAGS)
@@ -18,17 +36,27 @@ harness: $(HARNESS_FILES)
$(CC) $(FLAGS) $^ -o $@
clean:
- @$(RM) -f harness
- @$(RM) -rf harness.dSYM
+ @$(RM) harness
+ @$(RM) -rf harness.dSYM # MacOS specific
test: harness
- @zstd README.md -o tmp.zst
+ #
+ # Testing single-file decompression with educational decoder
+ #
+ @$(ZSTD) -f README.md -o tmp.zst
@./harness tmp.zst tmp
- @diff -s tmp README.md
- @$(RM) -f tmp*
- @zstd --train harness.c zstd_decompress.c zstd_decompress.h README.md
- @zstd -D dictionary README.md -o tmp.zst
+ @$(DIFF) -s tmp README.md
+ @$(RM) tmp*
+ #
+ # Testing dictionary decompression with education decoder
+ #
+ # note : files are presented multiple for training, to reach minimum threshold
+ @$(ZSTD) --train harness.c zstd_decompress.c zstd_decompress.h README.md \
+ harness.c zstd_decompress.c zstd_decompress.h README.md \
+ harness.c zstd_decompress.c zstd_decompress.h README.md \
+ -o dictionary
+ @$(ZSTD) -f README.md -D dictionary -o tmp.zst
@./harness tmp.zst tmp dictionary
- @diff -s tmp README.md
- @$(RM) -f tmp* dictionary
- @make clean
+ @$(DIFF) -s tmp README.md
+ @$(RM) tmp* dictionary
+ @$(MAKE) clean