648db22b |
1 | # ################################################################ |
2 | # Copyright (c) Meta Platforms, Inc. and affiliates. |
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 | |
10 | PROGDIR = ../../programs |
11 | LIBDIR = ../../lib |
12 | |
13 | LIBZSTD = $(LIBDIR)/libzstd.a |
14 | |
15 | CPPFLAGS+= -I$(LIBDIR) -I$(LIBDIR)/common -I$(LIBDIR)/dictBuilder -I$(PROGDIR) |
16 | |
17 | CFLAGS ?= -O3 -g |
18 | CFLAGS += -std=gnu99 |
19 | DEBUGFLAGS= -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 |
24 | CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) |
25 | |
26 | |
27 | default: seqBench |
28 | |
29 | all : seqBench |
30 | |
31 | seqBench: util.o timefn.o benchfn.o datagen.o xxhash.o seqBench.c $(LIBZSTD) |
32 | $(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@ |
33 | |
34 | .PHONY: $(LIBZSTD) |
35 | $(LIBZSTD): |
36 | $(MAKE) -C $(LIBDIR) libzstd.a CFLAGS="$(CFLAGS)" |
37 | |
38 | benchfn.o: $(PROGDIR)/benchfn.c |
39 | $(CC) $(CPPFLAGS) $(CFLAGS) $^ -c |
40 | |
41 | timefn.o: $(PROGDIR)/timefn.c |
42 | $(CC) $(CPPFLAGS) $(CFLAGS) $^ -c |
43 | |
44 | datagen.o: $(PROGDIR)/datagen.c |
45 | $(CC) $(CPPFLAGS) $(CFLAGS) $^ -c |
46 | |
47 | util.o: $(PROGDIR)/util.c |
48 | $(CC) $(CPPFLAGS) $(CFLAGS) $^ -c |
49 | |
50 | |
51 | xxhash.o : $(LIBDIR)/common/xxhash.c |
52 | $(CC) $(CPPFLAGS) $(CFLAGS) $^ -c |
53 | |
54 | |
55 | clean: |
56 | $(RM) *.o |
57 | $(MAKE) -C $(LIBDIR) clean > /dev/null |
58 | $(RM) seqBench |