2016-09-01 22:22:19 +00:00
|
|
|
# ##########################################################################
|
|
|
|
# Copyright (c) 2016-present, Facebook, Inc.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This source code is licensed under the BSD-style license found in the
|
|
|
|
# LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
# of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
# ##########################################################################
|
|
|
|
|
|
|
|
ZSTDDIR = ../../lib
|
|
|
|
PROGDIR = ../../programs
|
|
|
|
|
2016-09-02 19:23:49 +00:00
|
|
|
CPPFLAGS = -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(PROGDIR) -I.
|
2016-09-02 01:26:19 +00:00
|
|
|
CXXFLAGS ?= -O3
|
|
|
|
CXXFLAGS += -std=c++11
|
|
|
|
CXXFLAGS += $(MOREFLAGS)
|
|
|
|
FLAGS = $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS)
|
2016-09-01 22:22:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
ZSTDCOMMON_FILES := $(ZSTDDIR)/common/*.c
|
|
|
|
ZSTDCOMP_FILES := $(ZSTDDIR)/compress/zstd_compress.c $(ZSTDDIR)/compress/fse_compress.c $(ZSTDDIR)/compress/huf_compress.c
|
|
|
|
ZSTDDECOMP_FILES := $(ZSTDDIR)/decompress/huf_decompress.c
|
|
|
|
ZSTD_FILES := $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES)
|
|
|
|
|
|
|
|
|
|
|
|
# Define *.exe as extension for Windows systems
|
|
|
|
ifneq (,$(filter Windows%,$(OS)))
|
|
|
|
EXT =.exe
|
|
|
|
else
|
|
|
|
EXT =
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: default all test clean
|
|
|
|
|
|
|
|
default: pzstd
|
|
|
|
|
|
|
|
all: pzstd
|
|
|
|
|
|
|
|
|
|
|
|
libzstd.a: $(ZSTD_FILES)
|
|
|
|
$(MAKE) -C $(ZSTDDIR) libzstd
|
|
|
|
@cp $(ZSTDDIR)/libzstd.a .
|
|
|
|
|
|
|
|
|
|
|
|
Pzstd.o: Pzstd.h Pzstd.cpp ErrorHolder.h utils/*.h
|
|
|
|
$(CXX) $(FLAGS) -c Pzstd.cpp -o $@
|
|
|
|
|
|
|
|
SkippableFrame.o: SkippableFrame.h SkippableFrame.cpp utils/*.h
|
|
|
|
$(CXX) $(FLAGS) -c SkippableFrame.cpp -o $@
|
|
|
|
|
|
|
|
Options.o: Options.h Options.cpp
|
|
|
|
$(CXX) $(FLAGS) -c Options.cpp -o $@
|
|
|
|
|
|
|
|
main.o: main.cpp *.h utils/*.h
|
|
|
|
$(CXX) $(FLAGS) -c main.cpp -o $@
|
|
|
|
|
2016-09-02 04:12:39 +00:00
|
|
|
pzstd: Pzstd.o SkippableFrame.o Options.o main.o libzstd.a
|
2016-09-02 19:23:49 +00:00
|
|
|
$(CXX) $(FLAGS) $^ -o $@$(EXT) -lpthread
|
2016-09-01 22:22:19 +00:00
|
|
|
|
2016-09-01 23:21:19 +00:00
|
|
|
googletest:
|
|
|
|
@git clone https://github.com/google/googletest
|
|
|
|
@mkdir -p googletest/build
|
|
|
|
@cd googletest/build && cmake .. && make
|
|
|
|
|
2016-09-01 22:22:19 +00:00
|
|
|
test: libzstd.a Pzstd.o Options.o SkippableFrame.o
|
2016-09-03 03:11:22 +00:00
|
|
|
$(MAKE) -C utils/test clean
|
2016-09-01 22:22:19 +00:00
|
|
|
$(MAKE) -C utils/test test
|
2016-09-03 03:11:22 +00:00
|
|
|
$(MAKE) -C test clean
|
2016-09-01 22:22:19 +00:00
|
|
|
$(MAKE) -C test test
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(MAKE) -C $(ZSTDDIR) clean
|
|
|
|
$(MAKE) -C utils/test clean
|
|
|
|
$(MAKE) -C test clean
|
2016-09-02 20:53:23 +00:00
|
|
|
@$(RM) -rf libzstd.a *.o pzstd$(EXT)
|
2016-09-01 22:22:19 +00:00
|
|
|
@echo Cleaning completed
|