| 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 |
# This Makefile presumes libzstd is built, using `make` in / or /lib/ |
| 11 |
|
| 12 |
ZSTDLIB_PATH = ../../../lib |
| 13 |
ZSTDLIB_NAME = libzstd.a |
| 14 |
ZSTDLIB = $(ZSTDLIB_PATH)/$(ZSTDLIB_NAME) |
| 15 |
|
| 16 |
CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -I../ -I../../../lib -I../../../lib/common |
| 17 |
|
| 18 |
CFLAGS ?= -O3 |
| 19 |
CFLAGS += -g |
| 20 |
|
| 21 |
SEEKABLE_OBJS = ../zstdseek_compress.c ../zstdseek_decompress.c $(ZSTDLIB) |
| 22 |
|
| 23 |
.PHONY: default all clean test |
| 24 |
|
| 25 |
default: all |
| 26 |
|
| 27 |
all: seekable_compression seekable_decompression seekable_decompression_mem \ |
| 28 |
parallel_processing |
| 29 |
|
| 30 |
$(ZSTDLIB): |
| 31 |
make -C $(ZSTDLIB_PATH) $(ZSTDLIB_NAME) |
| 32 |
|
| 33 |
seekable_compression : seekable_compression.c $(SEEKABLE_OBJS) |
| 34 |
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@ |
| 35 |
|
| 36 |
seekable_decompression : seekable_decompression.c $(SEEKABLE_OBJS) |
| 37 |
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@ |
| 38 |
|
| 39 |
seekable_decompression_mem : seekable_decompression_mem.c $(SEEKABLE_OBJS) |
| 40 |
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@ |
| 41 |
|
| 42 |
parallel_processing : parallel_processing.c $(SEEKABLE_OBJS) |
| 43 |
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@ -pthread |
| 44 |
|
| 45 |
parallel_compression : parallel_compression.c $(SEEKABLE_OBJS) |
| 46 |
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@ -pthread |
| 47 |
|
| 48 |
clean: |
| 49 |
@rm -f core *.o tmp* result* *.zst \ |
| 50 |
seekable_compression seekable_decompression \ |
| 51 |
seekable_decompression_mem \ |
| 52 |
parallel_processing parallel_compression |
| 53 |
@echo Cleaning completed |