1*0c16b537SWarner LoshHARNESS_FILES=*.c
2*0c16b537SWarner Losh
3*0c16b537SWarner LoshMULTITHREAD_LDFLAGS = -pthread
4*0c16b537SWarner LoshDEBUGFLAGS= -g -DZSTD_DEBUG=1
5*0c16b537SWarner LoshCPPFLAGS += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
6*0c16b537SWarner Losh            -I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(PRGDIR)
7*0c16b537SWarner LoshCFLAGS   ?= -O3
8*0c16b537SWarner LoshCFLAGS   += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow                 \
9*0c16b537SWarner Losh            -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
10*0c16b537SWarner Losh            -Wstrict-prototypes -Wundef -Wformat-security                   \
11*0c16b537SWarner Losh            -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings      \
12*0c16b537SWarner Losh            -Wredundant-decls
13*0c16b537SWarner LoshCFLAGS   += $(DEBUGFLAGS)
14*0c16b537SWarner LoshCFLAGS   += $(MOREFLAGS)
15*0c16b537SWarner LoshFLAGS     = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(MULTITHREAD_LDFLAGS)
16*0c16b537SWarner Losh
17*0c16b537SWarner Loshharness: $(HARNESS_FILES)
18*0c16b537SWarner Losh	$(CC) $(FLAGS) $^ -o $@
19*0c16b537SWarner Losh
20*0c16b537SWarner Loshclean:
21*0c16b537SWarner Losh	@$(RM) -f harness
22*0c16b537SWarner Losh	@$(RM) -rf harness.dSYM
23*0c16b537SWarner Losh
24*0c16b537SWarner Loshtest: harness
25*0c16b537SWarner Losh	@zstd README.md -o tmp.zst
26*0c16b537SWarner Losh	@./harness tmp.zst tmp
27*0c16b537SWarner Losh	@diff -s tmp README.md
28*0c16b537SWarner Losh	@$(RM) -f tmp*
29*0c16b537SWarner Losh	@zstd --train harness.c zstd_decompress.c zstd_decompress.h README.md
30*0c16b537SWarner Losh	@zstd -D dictionary README.md -o tmp.zst
31*0c16b537SWarner Losh	@./harness tmp.zst tmp dictionary
32*0c16b537SWarner Losh	@diff -s tmp README.md
33*0c16b537SWarner Losh	@$(RM) -f tmp* dictionary
34*0c16b537SWarner Losh	@make clean
35