| 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 | # You may select, at your option, one of the above-listed licenses. |
| 9 | # ################################################################ |
| 10 | |
| 11 | CFLAGS ?= -O3 |
| 12 | |
| 13 | CURL_CFLAGS := $(shell curl-config --cflags) |
| 14 | CURL_LDFLAGS := $(shell curl-config --libs) -pthread |
| 15 | |
| 16 | PROGDIR := ../../programs |
| 17 | LIBDIR := ../../lib |
| 18 | ZSTD_CPPFLAGS := -I$(PROGDIR) -I$(LIBDIR) -I$(LIBDIR)/common -Wno-deprecated-declarations |
| 19 | |
| 20 | REGRESSION_CFLAGS = $(CFLAGS) $(CURL_CFLAGS) |
| 21 | REGRESSION_CPPFLAGS = $(CPPFLAGS) $(ZSTD_CPPFLAGS) |
| 22 | REGRESSION_LDFLAGS = $(LDFLAGS) $(CURL_LDFLAGS) |
| 23 | |
| 24 | all: test |
| 25 | |
| 26 | xxhash.o: $(LIBDIR)/common/xxhash.c $(LIBDIR)/common/xxhash.h |
| 27 | $(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@ |
| 28 | |
| 29 | util.o: $(PROGDIR)/util.c $(PROGDIR)/util.h |
| 30 | $(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@ |
| 31 | |
| 32 | data.o: data.c data.h $(PROGDIR)/util.h $(LIBDIR)/common/xxhash.h |
| 33 | $(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@ |
| 34 | |
| 35 | config.o: config.c config.h levels.h |
| 36 | $(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@ |
| 37 | |
| 38 | method.h: data.h config.h result.h |
| 39 | |
| 40 | method.o: method.c method.h |
| 41 | $(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@ |
| 42 | |
| 43 | result.o: result.c result.h |
| 44 | $(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@ |
| 45 | |
| 46 | test.o: test.c data.h config.h method.h |
| 47 | $(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@ |
| 48 | |
| 49 | .PHONY: libzstd.a |
| 50 | libzstd.a: |
| 51 | $(MAKE) -C $(LIBDIR) libzstd.a-mt |
| 52 | cp $(LIBDIR)/libzstd.a . |
| 53 | |
| 54 | test: test.o data.o config.o util.o method.o result.o xxhash.o libzstd.a |
| 55 | $(CC) $^ $(REGRESSION_LDFLAGS) -o $@ |
| 56 | |
| 57 | .PHONY: clean |
| 58 | clean: |
| 59 | $(MAKE) -C $(LIBDIR) clean |
| 60 | $(RM) *.o *.a test |