2012-05-28 14:49:29 +00:00
|
|
|
#
|
|
|
|
# This file is a part of Pcompress, a chunked parallel multi-
|
|
|
|
# algorithm lossless compression and decompression program.
|
|
|
|
#
|
|
|
|
# Copyright (C) 2012 Moinak Ghosh. All rights reserved.
|
|
|
|
# Use is subject to license terms.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
2012-07-07 16:48:29 +00:00
|
|
|
# version 3 of the License, or (at your option) any later version.
|
2012-05-28 14:49:29 +00:00
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# moinakg@belenix.org, http://moinakg.wordpress.com/
|
|
|
|
#
|
|
|
|
# This program includes partly-modified public domain source
|
|
|
|
# code from the LZMA SDK: http://www.7-zip.org/sdk.html
|
|
|
|
#
|
|
|
|
|
|
|
|
PROG= pcompress
|
2012-09-02 15:10:32 +00:00
|
|
|
MAINSRCS = main.c utils/utils.c allocator.c zlib_compress.c bzip2_compress.c \
|
2012-07-25 15:37:36 +00:00
|
|
|
lzma_compress.c ppmd_compress.c adaptive_compress.c lzfx_compress.c \
|
2012-10-15 06:40:00 +00:00
|
|
|
lz4_compress.c none_compress.c utils/xxhash.c utils/heapq.c utils/cpuid.c \
|
|
|
|
crypto/aes/crypto_aes.c crypto/scrypt/crypto_scrypt-nosse.c \
|
2012-10-17 18:02:35 +00:00
|
|
|
crypto/scrypt/sha256.c crypto/scrypt/crypto_aesctr.c crypto/crypto_utils.c
|
2012-10-06 15:21:23 +00:00
|
|
|
MAINHDRS = allocator.h pcompress.h utils/utils.h utils/xxhash.h utils/heapq.h \
|
2012-10-17 18:02:35 +00:00
|
|
|
utils/cpuid.h crypto/crypto_utils.h crypto/scrypt/crypto_scrypt.h \
|
|
|
|
crypto/scrypt/sha256.h crypto/scrypt/crypto_aesctr.h crypto/aes/crypto_aes.h
|
2012-05-28 14:49:29 +00:00
|
|
|
MAINOBJS = $(MAINSRCS:.c=.o)
|
|
|
|
|
2012-09-02 15:10:32 +00:00
|
|
|
RABINSRCS = rabin/rabin_dedup.c
|
|
|
|
RABINHDRS = rabin/rabin_dedup.h utils/utils.h
|
2012-06-21 14:57:05 +00:00
|
|
|
RABINOBJS = $(RABINSRCS:.c=.o)
|
|
|
|
|
2012-07-19 16:11:07 +00:00
|
|
|
BSDIFFSRCS = bsdiff/bsdiff.c bsdiff/bspatch.c bsdiff/rle_encoder.c
|
2012-09-02 15:10:32 +00:00
|
|
|
BSDIFFHDRS = bsdiff/bscommon.h utils/utils.h allocator.h
|
2012-07-19 16:11:07 +00:00
|
|
|
BSDIFFOBJS = $(BSDIFFSRCS:.c=.o)
|
|
|
|
|
2012-08-18 04:50:52 +00:00
|
|
|
LZMASRCS = lzma/LzmaEnc.c lzma/LzFind.c lzma/LzmaDec.c lzma/Threads.c lzma/LzFindMt.c
|
2012-06-21 14:57:05 +00:00
|
|
|
LZMAHDRS = lzma/CpuArch.h lzma/LzFind.h lzma/LzmaEnc.h lzma/Types.h \
|
2012-09-02 15:10:32 +00:00
|
|
|
lzma/LzHash.h lzma/LzmaDec.h utils/utils.h lzma/LzFindMt.h lzma/Threads.h lzma/windows.h \
|
2012-08-18 04:50:52 +00:00
|
|
|
lzma/Common/MyWindows.h lzma/Common/MyGuidDef.h lzma/basetyps.h
|
2012-05-28 14:49:29 +00:00
|
|
|
LZMAOBJS = $(LZMASRCS:.c=.o)
|
|
|
|
|
2012-07-22 18:45:08 +00:00
|
|
|
LZFXSRCS = lzfx/lzfx.c
|
|
|
|
LZFXHDRS = lzfx/lzfx.h
|
|
|
|
LZFXOBJS = $(LZFXSRCS:.c=.o)
|
|
|
|
|
2012-07-25 15:37:36 +00:00
|
|
|
LZ4SRCS = lz4/lz4.c lz4/lz4hc.c
|
|
|
|
LZ4HDRS = lz4/lz4.h lz4/lz4hc.h
|
|
|
|
LZ4OBJS = $(LZ4SRCS:.c=.o)
|
|
|
|
|
2012-05-28 14:49:29 +00:00
|
|
|
PPMDSRCS = lzma/Ppmd8.c lzma/Ppmd8Enc.c lzma/Ppmd8Dec.c
|
|
|
|
PPMDHDRS = lzma/Ppmd.h lzma/Ppmd8.h
|
|
|
|
PPMDOBJS = $(PPMDSRCS:.c=.o)
|
|
|
|
|
2012-11-22 18:30:39 +00:00
|
|
|
CRCSRCS = lzma/crc64_fast.c lzma/crc64_table.c lzma/crc32_fast.c lzma/crc32_table.c
|
|
|
|
CRCHDRS = lzma/crc64_table_le.h lzma/crc64_table_be.h lzma/crc_macros.h \
|
|
|
|
lzma/crc32_table_le.h lzma/crc32_table_be.h
|
2012-05-28 14:49:29 +00:00
|
|
|
CRCOBJS = $(CRCSRCS:.c=.o)
|
|
|
|
|
2012-08-23 17:28:44 +00:00
|
|
|
LZPSRCS = lzp/lzp.c
|
|
|
|
LZPHDRS = lzp/lzp.h
|
|
|
|
LZPOBJS = $(LZPSRCS:.c=.o)
|
|
|
|
|
2012-09-01 09:10:15 +00:00
|
|
|
SKEIN_BLOCK_C = crypto/skein/skein_block.c
|
|
|
|
SKEIN_BLOCK_ASM = crypto/skein/skein_block_x64.s
|
|
|
|
SKEIN_BLOCK_SRC = @SKEIN_BLOCK@
|
|
|
|
SKEIN_BLOCK_OBJ = crypto/skein/skein_block.o
|
|
|
|
SKEINSRCS = crypto/skein/SHA3api_ref.c crypto/skein/skein.c crypto/skein/skein_debug.c
|
2012-08-31 17:06:06 +00:00
|
|
|
SKEINHDRS = crypto/skein/brg_endian.h crypto/skein/SHA3api_ref.h \
|
|
|
|
crypto/skein/skein.h crypto/skein/skein_port.h crypto/skein/brg_types.h \
|
|
|
|
crypto/skein/skein_debug.h crypto/skein/skein_iv.h
|
|
|
|
SKEINOBJS = $(SKEINSRCS:.c=.o)
|
|
|
|
|
2012-10-06 15:21:23 +00:00
|
|
|
SHA256_SRCS = crypto/sha2/sha256.c
|
|
|
|
SHA256_HDRS = crypto/sha2/sha256.h
|
|
|
|
SHA256ASM_SRCS = crypto/sha2/intel/sha256_avx1.asm \
|
|
|
|
crypto/sha2/intel/sha256_sse4.asm
|
|
|
|
SHA256ASM_OBJS = $(SHA256ASM_SRCS:.asm=.o)
|
|
|
|
SHA256_OBJS = $(SHA256_SRCS:.c=.o)
|
|
|
|
|
|
|
|
YASM = @YASM@ -f x64 -f elf64 -X gnu -g dwarf2 -D LINUX
|
2012-08-27 16:21:55 +00:00
|
|
|
LIBBSCWRAP = libbsc_compress.c
|
|
|
|
LIBBSCWRAPOBJ = libbsc_compress.o
|
|
|
|
LIBBSCDIR = @LIBBSCDIR@
|
|
|
|
LIBBSCLFLAGS = -L$(LIBBSCDIR) -lbsc
|
|
|
|
LIBBSCLIB = @LIBBSCLIB@
|
|
|
|
LIBBSCGEN_OPT = -fopenmp
|
|
|
|
LIBBSCCPPFLAGS = -I$(LIBBSCDIR)/libbsc -DENABLE_PC_LIBBSC
|
|
|
|
|
2012-10-06 15:21:23 +00:00
|
|
|
BAKFILES = *~ lzma/*~ lzfx/*~ lz4/*~ rabin/*~ bsdiff/*~ lzp/*~ utils/*~ crypto/sha2/*~ \
|
2012-10-17 18:02:35 +00:00
|
|
|
crypto/sha2/intel/*~ crypto/aes/*~ crypto/scrypt/*~ crypto/*~
|
2012-05-28 14:49:29 +00:00
|
|
|
|
|
|
|
RM = rm -f
|
2012-11-08 16:52:37 +00:00
|
|
|
RM_RF = rm -rf
|
2012-08-26 08:39:24 +00:00
|
|
|
COMMON_CPPFLAGS = -I. -I./lzma -I./lzfx -I./lz4 -I./rabin -I./bsdiff -DNODEFAULT_PROPS \
|
2012-08-23 17:28:44 +00:00
|
|
|
-DFILE_OFFSET_BITS=64 -D_REENTRANT -D__USE_SSE_INTRIN__ -D_LZMA_PROB32 \
|
2012-10-06 15:21:23 +00:00
|
|
|
-I./lzp @LIBBSCCPPFLAGS@ -I./crypto/skein -I./utils -I@OPENSSL_INCDIR@ \
|
2012-10-21 15:33:07 +00:00
|
|
|
-I./crypto/sha2 -I./crypto/scrypt -I./crypto/aes -I./crypto @KEYLEN@ \
|
|
|
|
@LIBBZ2_INC@ @LIBZ_INC@
|
2012-08-26 08:39:24 +00:00
|
|
|
COMMON_VEC_FLAGS = -ftree-vectorize
|
|
|
|
COMMON_LOOP_OPTFLAGS = $(VEC_FLAGS) -floop-interchange -floop-block
|
2012-10-21 15:33:07 +00:00
|
|
|
LDLIBS = -ldl -L@LIBBZ2_DIR@ -lbz2 -L@LIBZ_DIR@ -lz -lm @LIBBSCLFLAGS@ \
|
|
|
|
-L@OPENSSL_LIBDIR@ -lcrypto -lrt
|
2012-08-23 17:28:44 +00:00
|
|
|
OBJS = $(MAINOBJS) $(LZMAOBJS) $(PPMDOBJS) $(LZFXOBJS) $(LZ4OBJS) $(CRCOBJS) \
|
2012-10-06 15:21:23 +00:00
|
|
|
$(RABINOBJS) $(BSDIFFOBJS) $(LZPOBJS) @LIBBSCWRAPOBJ@ $(SKEINOBJS) $(SKEIN_BLOCK_OBJ) \
|
|
|
|
@SHA256ASM_OBJS@ @SHA256_OBJS@
|
2012-05-28 14:49:29 +00:00
|
|
|
|
2012-08-27 16:21:55 +00:00
|
|
|
DEBUG_LINK = g++ -m64 -pthread -msse3 @LIBBSCGEN_OPT@
|
2012-08-26 08:39:24 +00:00
|
|
|
DEBUG_COMPILE = gcc -m64 -g -msse3 -c
|
|
|
|
DEBUG_COMPILE_cpp = g++ -m64 -g -msse3 -c
|
|
|
|
DEBUG_VEC_FLAGS =
|
|
|
|
DEBUG_LOOP_OPTFLAGS =
|
2012-08-27 16:21:55 +00:00
|
|
|
DEBUG_GEN_OPT = -O -fno-omit-frame-pointer @LIBBSCGEN_OPT@
|
2012-08-26 08:39:24 +00:00
|
|
|
DEBUG_RABIN_OPT = -O -fno-omit-frame-pointer
|
|
|
|
DEBUG_CPPFLAGS = $(COMMON_CPPFLAGS)
|
|
|
|
|
2012-08-27 16:21:55 +00:00
|
|
|
RELEASE_LINK = g++ -m64 -pthread -msse3 @LIBBSCGEN_OPT@
|
2012-08-26 08:39:24 +00:00
|
|
|
RELEASE_COMPILE = gcc -m64 -msse3 -c
|
|
|
|
RELEASE_COMPILE_cpp = g++ -m64 -msse3 -c
|
|
|
|
RELEASE_VEC_FLAGS = $(COMMON_VEC_FLAGS)
|
|
|
|
RELEASE_LOOP_OPTFLAGS = $(COMMON_LOOP_OPTFLAGS)
|
|
|
|
RELEASE_CPPFLAGS = $(COMMON_CPPFLAGS) -DNDEBUG
|
2012-08-27 16:21:55 +00:00
|
|
|
RELEASE_GEN_OPT = -O3 @LIBBSCGEN_OPT@
|
2012-08-26 08:39:24 +00:00
|
|
|
RELEASE_RABIN_OPT = -O2
|
|
|
|
|
|
|
|
NO_SLAB_CPPFLAGS = -DDEBUG_NO_SLAB
|
|
|
|
DEBUG_STATS_CPPFLAGS = -DDEBUG_STATS
|
|
|
|
|
|
|
|
LINK = @LINK@
|
|
|
|
COMPILE = @COMPILE@
|
|
|
|
COMPILE_cpp = @COMPILE_cpp@
|
|
|
|
VEC_FLAGS = @VEC_FLAGS@
|
|
|
|
LOOP_OPTFLAGS = @LOOP_OPTFLAGS@
|
|
|
|
CPPFLAGS = @CPPFLAGS@ @NO_SLAB_CPPFLAGS@ @DEBUG_STATS_CPPFLAGS@
|
|
|
|
GEN_OPT = @GEN_OPT@
|
|
|
|
RABIN_OPT = @RABIN_OPT@
|
|
|
|
PREFIX=@PREFIX@
|
2012-05-28 14:49:29 +00:00
|
|
|
|
|
|
|
all: $(PROG)
|
|
|
|
|
2012-06-21 14:57:05 +00:00
|
|
|
$(LZMAOBJS): $(LZMASRCS) $(LZMAHDRS)
|
2012-08-08 17:10:58 +00:00
|
|
|
$(COMPILE) $(GEN_OPT) $(CPPFLAGS) $(@:.o=.c) -o $@
|
2012-05-28 14:49:29 +00:00
|
|
|
|
2012-06-21 14:57:05 +00:00
|
|
|
$(CRCOBJS): $(CRCSRCS) $(CRCHDRS)
|
2012-08-08 17:10:58 +00:00
|
|
|
$(COMPILE) $(GEN_OPT) $(VEC_FLAGS) $(CPPFLAGS) $(@:.o=.c) -o $@
|
2012-05-28 14:49:29 +00:00
|
|
|
|
|
|
|
$(PPMDOBJS): $(PPMDSRCS) $(PPMDHDRS)
|
2012-08-08 17:10:58 +00:00
|
|
|
$(COMPILE) $(GEN_OPT) $(VEC_FLAGS) $(CPPFLAGS) $(@:.o=.c) -o $@
|
2012-05-28 14:49:29 +00:00
|
|
|
|
2012-06-21 14:57:05 +00:00
|
|
|
$(RABINOBJS): $(RABINSRCS) $(RABINHDRS)
|
2012-08-08 17:10:58 +00:00
|
|
|
$(COMPILE) $(RABIN_OPT) $(VEC_FLAGS) $(CPPFLAGS) $(@:.o=.c) -o $@
|
2012-06-21 14:57:05 +00:00
|
|
|
|
2012-07-19 16:11:07 +00:00
|
|
|
$(BSDIFFOBJS): $(BSDIFFSRCS) $(BSDIFFHDRS)
|
2012-08-08 17:10:58 +00:00
|
|
|
$(COMPILE) $(GEN_OPT) $(VEC_FLAGS) $(CPPFLAGS) $(@:.o=.c) -o $@
|
2012-07-19 16:11:07 +00:00
|
|
|
|
2012-07-22 18:45:08 +00:00
|
|
|
$(LZFXOBJS): $(LZFXSRCS) $(LZFXHDRS)
|
2012-08-08 17:10:58 +00:00
|
|
|
$(COMPILE) $(GEN_OPT) $(VEC_FLAGS) $(CPPFLAGS) $(@:.o=.c) -o $@
|
2012-07-25 15:37:36 +00:00
|
|
|
|
|
|
|
$(LZ4OBJS): $(LZ4SRCS) $(LZ4HDRS)
|
2012-08-08 17:10:58 +00:00
|
|
|
$(COMPILE) $(GEN_OPT) $(VEC_FLAGS) $(CPPFLAGS) $(@:.o=.c) -o $@
|
2012-07-22 18:45:08 +00:00
|
|
|
|
2012-08-23 17:28:44 +00:00
|
|
|
$(LZPOBJS): $(LZPSRCS) $(LZPHDRS)
|
|
|
|
$(COMPILE) $(GEN_OPT) $(VEC_FLAGS) $(CPPFLAGS) $(@:.o=.c) -o $@
|
|
|
|
|
2012-09-01 09:10:15 +00:00
|
|
|
$(SKEIN_BLOCK_OBJ): $(SKEIN_BLOCK_SRC)
|
|
|
|
$(COMPILE) $(GEN_OPT) $(VEC_FLAGS) $(CPPFLAGS) $(SKEIN_BLOCK_SRC) -o $@
|
|
|
|
|
2012-08-31 17:06:06 +00:00
|
|
|
$(SKEINOBJS): $(SKEINSRCS) $(SKEINHDRS)
|
|
|
|
$(COMPILE) $(GEN_OPT) $(VEC_FLAGS) $(CPPFLAGS) $(@:.o=.c) -o $@
|
|
|
|
|
2012-10-06 15:21:23 +00:00
|
|
|
$(SHA256_OBJS): $(SHA256_SRCS) $(SHA256_HDRS)
|
|
|
|
$(COMPILE) $(GEN_OPT) $(VEC_FLAGS) $(CPPFLAGS) $(@:.o=.c) -o $@
|
|
|
|
|
|
|
|
$(SHA256ASM_OBJS): $(SHA256ASM_SRCS)
|
|
|
|
$(YASM) -o $@ $(@:.o=.asm)
|
|
|
|
|
2012-08-27 16:21:55 +00:00
|
|
|
$(LIBBSCLIB):
|
|
|
|
(cd $(LIBBSCDIR); make)
|
|
|
|
|
|
|
|
$(LIBBSCWRAPOBJ): $(LIBBSCWRAP) $(LIBBSCLIB)
|
|
|
|
$(COMPILE) $(GEN_OPT) $(VEC_FLAGS) $(CPPFLAGS) $(@:.o=.c) -o $@
|
|
|
|
|
2012-06-21 14:57:05 +00:00
|
|
|
$(MAINOBJS): $(MAINSRCS) $(MAINHDRS)
|
2012-08-08 17:10:58 +00:00
|
|
|
$(COMPILE) $(GEN_OPT) $(LOOP_OPTFLAGS) $(CPPFLAGS) $(@:.o=.c) -o $@
|
2012-05-28 14:49:29 +00:00
|
|
|
|
2012-08-23 17:28:44 +00:00
|
|
|
$(PROG): $(OBJS)
|
|
|
|
$(LINK) -o $@ $(OBJS) $(LDLIBS)
|
2012-05-28 14:49:29 +00:00
|
|
|
|
2012-11-08 16:52:37 +00:00
|
|
|
test: all
|
|
|
|
(cd test; sh ./run_test.sh) 2>&1 | tee test.log
|
|
|
|
|
2012-05-28 14:49:29 +00:00
|
|
|
clean:
|
2012-08-23 17:28:44 +00:00
|
|
|
$(RM) $(PROG) $(OBJS) $(BAKFILES)
|
2012-11-08 16:52:37 +00:00
|
|
|
$(RM) test.log
|
|
|
|
$(RM_RF) test/datafiles
|
2012-05-28 14:49:29 +00:00
|
|
|
|
2012-08-26 08:39:24 +00:00
|
|
|
distclean: clean
|
|
|
|
$(RM) Makefile
|
|
|
|
|
|
|
|
install: $(PROG)
|
|
|
|
@mkdir -p $(PREFIX)/bin
|
|
|
|
@chmod 0755 $(PREFIX)/bin
|
|
|
|
@cp $(PROG) $(PREFIX)/bin
|
|
|
|
@chmod 0555 $(PREFIX)/bin/$(PROG)
|
|
|
|
@mkdir -p $(PREFIX)/share/doc/$(PROG)
|
|
|
|
@chmod 0755 $(PREFIX)/share $(PREFIX)/share/doc $(PREFIX)/share/doc/$(PROG)
|
|
|
|
@cp README.md $(PREFIX)/share/doc/$(PROG)/README
|
|
|
|
@chmod 0444 $(PREFIX)/share/doc/$(PROG)/README
|
|
|
|
|
|
|
|
|