1# ################################################################
2# Copyright (c) 2018-present, 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# ################################################################
9
10PROGDIR = ../../programs
11LIBDIR  = ../../lib
12
13LIBZSTD = $(LIBDIR)/libzstd.a
14
15CPPFLAGS+= -I$(LIBDIR) -I$(LIBDIR)/common -I$(LIBDIR)/dictBuilder -I$(PROGDIR)
16
17CFLAGS  ?= -O3
18CFLAGS  += -std=gnu99
19DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
20            -Wstrict-aliasing=1 -Wswitch-enum \
21            -Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security \
22            -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
23            -Wredundant-decls
24CFLAGS  += $(DEBUGFLAGS) $(MOREFLAGS)
25
26
27default: largeNbDicts
28
29all : largeNbDicts
30
31largeNbDicts: util.o benchfn.o datagen.o xxhash.o largeNbDicts.c $(LIBZSTD)
32	$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@
33
34.PHONY: $(LIBZSTD)
35$(LIBZSTD):
36	$(MAKE) -C $(LIBDIR) libzstd.a CFLAGS="$(CFLAGS)"
37
38benchfn.o  : $(PROGDIR)/benchfn.c
39	$(CC) $(CPPFLAGS) $(CFLAGS) $^ -c
40
41datagen.o: $(PROGDIR)/datagen.c
42	$(CC) $(CPPFLAGS) $(CFLAGS) $^ -c
43
44util.o: $(PROGDIR)/util.c
45	$(CC) $(CPPFLAGS) $(CFLAGS) $^ -c
46
47
48xxhash.o : $(LIBDIR)/common/xxhash.c
49	$(CC) $(CPPFLAGS) $(CFLAGS) $^ -c
50
51clean:
52	$(RM) *.o
53	$(MAKE) -C $(LIBDIR) clean > /dev/null
54	$(RM) largeNbDicts
55