2013-09-09 09:06:21 +00:00
|
|
|
# ################################################################
|
2014-01-07 18:47:50 +00:00
|
|
|
# LZ4 library - Makefile
|
|
|
|
# Copyright (C) Yann Collet 2011-2014
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# BSD license
|
|
|
|
# Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
# are permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# * Redistributions of source code must retain the above copyright notice, this
|
|
|
|
# list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# * Redistributions in binary form must reproduce the above copyright notice, this
|
|
|
|
# list of conditions and the following disclaimer in the documentation and/or
|
|
|
|
# other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
|
|
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#
|
2013-09-09 09:06:21 +00:00
|
|
|
# You can contact the author at :
|
|
|
|
# - LZ4 source repository : http://code.google.com/p/lz4/
|
2013-09-25 09:00:37 +00:00
|
|
|
# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
|
2013-09-09 09:06:21 +00:00
|
|
|
# ################################################################
|
|
|
|
|
2014-01-08 18:50:11 +00:00
|
|
|
RELEASE=r112
|
2013-10-21 08:03:40 +00:00
|
|
|
DESTDIR=
|
2014-01-07 18:47:50 +00:00
|
|
|
PREFIX=/usr
|
2012-10-24 12:59:19 +00:00
|
|
|
CC=gcc
|
2014-01-07 18:47:50 +00:00
|
|
|
CFLAGS+= -I. -std=c99 -Wall -W -Wundef -DLZ4_VERSION=\"$(RELEASE)\"
|
|
|
|
|
|
|
|
LIBDIR=$(PREFIX)/lib
|
|
|
|
INCLUDEDIR=$(PREFIX)/include
|
|
|
|
PRGDIR=programs
|
|
|
|
DISTRIBNAME=lz4-$(RELEASE).tar.gz
|
|
|
|
|
2012-03-09 21:46:59 +00:00
|
|
|
|
2013-09-09 09:06:21 +00:00
|
|
|
# Define *.exe as extension for Windows systems
|
2013-09-25 09:00:37 +00:00
|
|
|
ifneq (,$(filter Windows%,$(OS)))
|
2012-10-24 12:59:19 +00:00
|
|
|
EXT =.exe
|
2013-09-25 09:00:37 +00:00
|
|
|
else
|
|
|
|
EXT =
|
2012-03-09 21:46:59 +00:00
|
|
|
endif
|
|
|
|
|
2014-01-07 18:47:50 +00:00
|
|
|
TEXT = lz4.c lz4.h lz4hc.c lz4hc.h \
|
|
|
|
lz4_format_description.txt Makefile NEWS LICENSE \
|
|
|
|
cmake_unofficial/CMakeLists.txt \
|
|
|
|
$(PRGDIR)/fullbench.c $(PRGDIR)/fuzzer.c $(PRGDIR)/lz4cli.c \
|
|
|
|
$(PRGDIR)/bench.c $(PRGDIR)/bench.h \
|
|
|
|
$(PRGDIR)/xxhash.c $(PRGDIR)/xxhash.h \
|
|
|
|
$(PRGDIR)/lz4.1 $(PRGDIR)/Makefile $(PRGDIR)/COPYING
|
2013-10-01 20:32:43 +00:00
|
|
|
NONTEXT = LZ4_Streaming_Format.odt
|
|
|
|
SOURCES = $(TEXT) $(NONTEXT)
|
2013-09-25 09:00:37 +00:00
|
|
|
|
|
|
|
|
2014-01-07 18:47:50 +00:00
|
|
|
default: liblz4
|
2014-01-08 18:50:11 +00:00
|
|
|
@cd $(PRGDIR); make
|
2013-07-01 07:50:40 +00:00
|
|
|
|
2014-01-07 18:47:50 +00:00
|
|
|
all: liblz4 lz4programs
|
2011-05-25 22:25:57 +00:00
|
|
|
|
2014-01-07 18:47:50 +00:00
|
|
|
liblz4: liblz4.a liblz4.so
|
2013-09-09 09:06:21 +00:00
|
|
|
|
2014-01-07 18:47:50 +00:00
|
|
|
lz4programs: lz4.c lz4hc.c
|
|
|
|
@cd $(PRGDIR); make all
|
2013-08-12 08:35:52 +00:00
|
|
|
|
2014-01-07 18:47:50 +00:00
|
|
|
liblz4.a: lz4.c lz4hc.c
|
|
|
|
$(CC) -O3 -c $(CFLAGS) $^
|
|
|
|
ar rcs liblz4.a lz4.o lz4hc.o
|
2013-06-10 17:29:13 +00:00
|
|
|
|
2014-01-08 18:50:11 +00:00
|
|
|
liblz4.so: lz4.c lz4hc.c
|
|
|
|
$(CC) -shared -fPIC -Wl,--soname=liblz4.so.1 $(CFLAGS) $^ -o $@
|
2013-08-12 08:35:52 +00:00
|
|
|
|
2011-05-25 22:25:57 +00:00
|
|
|
clean:
|
2014-01-07 18:47:50 +00:00
|
|
|
@rm -f core *.o *.a *.so $(DISTRIBNAME)
|
|
|
|
@cd $(PRGDIR); make clean
|
2013-09-25 09:00:37 +00:00
|
|
|
@echo Cleaning completed
|
|
|
|
|
|
|
|
|
2014-01-07 18:47:50 +00:00
|
|
|
#ifeq ($(shell uname),Linux)
|
|
|
|
ifneq (,$(filter $(shell uname),Linux Darwin))
|
2013-09-25 09:00:37 +00:00
|
|
|
|
2014-01-07 18:47:50 +00:00
|
|
|
install: liblz4
|
|
|
|
@install -d -m 755 $(DESTDIR)$(LIBDIR)/ $(DESTDIR)$(INCLUDEDIR)/
|
|
|
|
@install -m 755 liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a
|
|
|
|
@install -m 755 liblz4.so $(DESTDIR)$(LIBDIR)/liblz4.so
|
|
|
|
@install -m 755 lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h
|
|
|
|
@install -m 755 lz4hc.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h
|
|
|
|
@echo lz4 static and shared library installed
|
|
|
|
@cd $(PRGDIR); make install
|
2013-09-25 09:00:37 +00:00
|
|
|
|
|
|
|
uninstall:
|
2014-01-07 18:47:50 +00:00
|
|
|
[ -x $(DESTDIR)$(LIBDIR)/liblz4.a ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.a
|
|
|
|
[ -x $(DESTDIR)$(LIBDIR)/liblz4.so ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.so
|
2014-01-08 18:50:11 +00:00
|
|
|
[ -f $(DESTDIR)$(INCLUDEDIR)/lz4.h ] && rm -f $(DESTDIR)$(INCLUDEDIR)/lz4.h
|
|
|
|
[ -f $(DESTDIR)$(INCLUDEDIR)/lz4hc.h ] && rm -f $(DESTDIR)$(INCLUDEDIR)/lz4hc.h
|
2014-01-07 18:47:50 +00:00
|
|
|
@echo lz4 libraries successfully uninstalled
|
|
|
|
@cd $(PRGDIR); make uninstall
|
2013-09-25 09:00:37 +00:00
|
|
|
|
|
|
|
dist: clean
|
2014-01-07 18:47:50 +00:00
|
|
|
@install -dD -m 700 lz4-$(RELEASE)/programs/
|
|
|
|
@install -dD -m 700 lz4-$(RELEASE)/cmake_unofficial/
|
2013-10-01 20:32:43 +00:00
|
|
|
@for f in $(TEXT); do \
|
|
|
|
tr -d '\r' < $$f > .tmp; \
|
|
|
|
install -m 600 .tmp lz4-$(RELEASE)/$$f; \
|
|
|
|
done
|
|
|
|
@rm .tmp
|
|
|
|
@for f in $(NONTEXT); do \
|
2013-09-25 09:00:37 +00:00
|
|
|
install -m 600 $$f lz4-$(RELEASE)/$$f; \
|
|
|
|
done
|
2013-10-01 20:32:43 +00:00
|
|
|
@tar -czf $(DISTRIBNAME) lz4-$(RELEASE)/
|
2013-09-25 09:00:37 +00:00
|
|
|
@rm -rf lz4-$(RELEASE)
|
2013-10-01 20:32:43 +00:00
|
|
|
@echo Distribution $(DISTRIBNAME) built
|
2013-09-25 09:00:37 +00:00
|
|
|
|
|
|
|
endif
|