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 \
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 timefn.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
41timefn.o: $(PROGDIR)/timefn.c
42	$(CC) $(CPPFLAGS) $(CFLAGS) $^ -c
43
44datagen.o: $(PROGDIR)/datagen.c
45	$(CC) $(CPPFLAGS) $(CFLAGS) $^ -c
46
47util.o: $(PROGDIR)/util.c
48	$(CC) $(CPPFLAGS) $(CFLAGS) $^ -c
49
50
51xxhash.o : $(LIBDIR)/common/xxhash.c
52	$(CC) $(CPPFLAGS) $(CFLAGS) $^ -c
53
54
55clean:
56	$(RM) *.o
57	$(MAKE) -C $(LIBDIR) clean > /dev/null
58	$(RM) largeNbDicts
59