10c16b537SWarner LoshHARNESS_FILES=*.c
20c16b537SWarner Losh
30c16b537SWarner LoshMULTITHREAD_LDFLAGS = -pthread
40c16b537SWarner LoshDEBUGFLAGS= -g -DZSTD_DEBUG=1
50c16b537SWarner LoshCPPFLAGS += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
60c16b537SWarner Losh            -I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(PRGDIR)
70c16b537SWarner LoshCFLAGS   ?= -O3
80c16b537SWarner LoshCFLAGS   += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow                 \
90c16b537SWarner Losh            -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
100c16b537SWarner Losh            -Wstrict-prototypes -Wundef -Wformat-security                   \
110c16b537SWarner Losh            -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings      \
120c16b537SWarner Losh            -Wredundant-decls
130c16b537SWarner LoshCFLAGS   += $(DEBUGFLAGS)
140c16b537SWarner LoshCFLAGS   += $(MOREFLAGS)
150c16b537SWarner LoshFLAGS     = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(MULTITHREAD_LDFLAGS)
160c16b537SWarner Losh
170c16b537SWarner Loshharness: $(HARNESS_FILES)
180c16b537SWarner Losh	$(CC) $(FLAGS) $^ -o $@
190c16b537SWarner Losh
200c16b537SWarner Loshclean:
210c16b537SWarner Losh	@$(RM) -f harness
220c16b537SWarner Losh	@$(RM) -rf harness.dSYM
230c16b537SWarner Losh
240c16b537SWarner Loshtest: harness
250c16b537SWarner Losh	@zstd README.md -o tmp.zst
260c16b537SWarner Losh	@./harness tmp.zst tmp
270c16b537SWarner Losh	@diff -s tmp README.md
280c16b537SWarner Losh	@$(RM) -f tmp*
290c16b537SWarner Losh	@zstd --train harness.c zstd_decompress.c zstd_decompress.h README.md
300c16b537SWarner Losh	@zstd -D dictionary README.md -o tmp.zst
310c16b537SWarner Losh	@./harness tmp.zst tmp dictionary
320c16b537SWarner Losh	@diff -s tmp README.md
330c16b537SWarner Losh	@$(RM) -f tmp* dictionary
340c16b537SWarner Losh	@make clean
35