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-06-21 14:57:05 +00:00
|
|
|
MAINSRCS = main.c 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-08-05 17:05:51 +00:00
|
|
|
lz4_compress.c none_compress.c
|
2012-06-21 14:57:05 +00:00
|
|
|
MAINHDRS = allocator.h pcompress.h utils.h
|
2012-05-28 14:49:29 +00:00
|
|
|
MAINOBJS = $(MAINSRCS:.c=.o)
|
|
|
|
|
2012-06-21 14:57:05 +00:00
|
|
|
RABINSRCS = rabin/rabin_polynomial.c
|
|
|
|
RABINHDRS = rabin/rabin_polynomial.h utils.h
|
|
|
|
RABINOBJS = $(RABINSRCS:.c=.o)
|
|
|
|
|
2012-07-19 16:11:07 +00:00
|
|
|
BSDIFFSRCS = bsdiff/bsdiff.c bsdiff/bspatch.c bsdiff/rle_encoder.c
|
|
|
|
BSDIFFHDRS = bsdiff/bscommon.h utils.h allocator.h
|
|
|
|
BSDIFFOBJS = $(BSDIFFSRCS:.c=.o)
|
|
|
|
|
2012-05-28 14:49:29 +00:00
|
|
|
LZMASRCS = lzma/LzmaEnc.c lzma/LzFind.c lzma/LzmaDec.c
|
2012-06-21 14:57:05 +00:00
|
|
|
LZMAHDRS = lzma/CpuArch.h lzma/LzFind.h lzma/LzmaEnc.h lzma/Types.h \
|
|
|
|
lzma/LzHash.h lzma/LzmaDec.h utils.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)
|
|
|
|
|
|
|
|
CRCSRCS = lzma/crc64_fast.c lzma/crc64_table.c
|
2012-06-21 14:57:05 +00:00
|
|
|
CRCHDRS = lzma/crc64_table_le.h lzma/crc64_table_be.h lzma/crc_macros.h
|
2012-05-28 14:49:29 +00:00
|
|
|
CRCOBJS = $(CRCSRCS:.c=.o)
|
|
|
|
|
2012-07-25 15:37:36 +00:00
|
|
|
BAKFILES = *~ lzma/*~ lzfx/*~ lz4/*~ rabin/*~ bsdiff/*~
|
2012-05-28 14:49:29 +00:00
|
|
|
|
|
|
|
RM = rm -f
|
2012-07-25 15:37:36 +00:00
|
|
|
CPPFLAGS = -I. -I./lzma -I./lzfx -I./lz4 -I./rabin -I./bsdiff -D_7ZIP_ST -DNODEFAULT_PROPS \
|
2012-07-22 18:45:08 +00:00
|
|
|
-DFILE_OFFSET_BITS=64 -D_REENTRANT -D__USE_SSE_INTRIN__ -D_LZMA_PROB32
|
2012-05-28 14:49:29 +00:00
|
|
|
VEC_FLAGS = -ftree-vectorize
|
|
|
|
LOOP_OPTFLAGS = $(VEC_FLAGS) -floop-interchange -floop-block
|
2012-08-08 17:10:58 +00:00
|
|
|
GEN_OPT = -O3
|
|
|
|
RABIN_OPT = -O2
|
2012-05-28 14:49:29 +00:00
|
|
|
LDLIBS = -ldl -lbz2 $(ZLIB_DIR) -lz -lm
|
|
|
|
|
2012-05-31 07:36:40 +00:00
|
|
|
ifdef DEBUG
|
2012-06-21 14:57:05 +00:00
|
|
|
LINK = g++ -m64 -pthread -msse3
|
2012-06-29 12:53:55 +00:00
|
|
|
COMPILE = gcc -m64 -O -g -msse3 -c
|
|
|
|
COMPILE_cpp = g++ -m64 -O -g -msse3 -c
|
2012-07-19 16:11:07 +00:00
|
|
|
VEC_FLAGS =
|
2012-06-29 12:53:55 +00:00
|
|
|
ifdef DEBUG_NO_SLAB
|
|
|
|
CPPFLAGS += -DDEBUG_NO_SLAB
|
|
|
|
endif
|
2012-05-31 07:36:40 +00:00
|
|
|
else
|
2012-06-21 14:57:05 +00:00
|
|
|
LINK = g++ -m64 -pthread -msse3
|
2012-08-08 17:10:58 +00:00
|
|
|
COMPILE = gcc -m64 -msse3 -c
|
|
|
|
COMPILE_cpp = g++ -m64 -msse3 -c
|
2012-05-31 07:36:40 +00:00
|
|
|
CPPFLAGS += -DNDEBUG
|
2012-07-01 16:14:02 +00:00
|
|
|
ifdef DEBUG_NO_SLAB
|
|
|
|
CPPFLAGS += -DDEBUG_NO_SLAB
|
|
|
|
endif
|
2012-05-31 07:36:40 +00:00
|
|
|
endif
|
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-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-07-25 15:37:36 +00:00
|
|
|
$(PROG): $(MAINOBJS) $(LZMAOBJS) $(PPMDOBJS) $(LZFXOBJS) $(LZ4OBJS) \
|
|
|
|
$(CRCOBJS) $(RABINOBJS) $(BSDIFFOBJS)
|
2012-07-22 18:45:08 +00:00
|
|
|
$(LINK) -o $@ $(MAINOBJS) $(LZMAOBJS) $(PPMDOBJS) $(CRCOBJS) \
|
2012-07-25 15:37:36 +00:00
|
|
|
$(LZFXOBJS) $(LZ4OBJS) $(RABINOBJS) $(BSDIFFOBJS) \
|
|
|
|
$(LDLIBS)
|
2012-05-28 14:49:29 +00:00
|
|
|
|
|
|
|
clean:
|
2012-07-25 15:37:36 +00:00
|
|
|
$(RM) $(PROG) $(MAINOBJS) $(LZMAOBJS) $(PPMDOBJS) $(CRCOBJS) $(LZFXOBJS) $(LZ4OBJS) \
|
2012-07-22 18:45:08 +00:00
|
|
|
$(RABINOBJS) $(BSDIFFOBJS) $(BAKFILES)
|
2012-05-28 14:49:29 +00:00
|
|
|
|