blob: c4862395445376fe1ffc62705d374c8e7a62cc0a [file] [log] [blame]
yann.collet.73@gmail.com77994542013-09-09 09:06:21 +00001# ################################################################
Yann Collet96e328c2014-12-13 15:05:46 +01002# LZ4 - Makefile
3# Copyright (C) Yann Collet 2011-2015
yann.collet.73@gmail.com5748f622014-01-07 18:47:50 +00004# All rights reserved.
5#
6# BSD license
7# Redistribution and use in source and binary forms, with or without modification,
8# are permitted provided that the following conditions are met:
9#
10# * Redistributions of source code must retain the above copyright notice, this
11# list of conditions and the following disclaimer.
12#
13# * Redistributions in binary form must reproduce the above copyright notice, this
14# list of conditions and the following disclaimer in the documentation and/or
15# other materials provided with the distribution.
16#
17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
yann.collet.73@gmail.com77994542013-09-09 09:06:21 +000028# You can contact the author at :
29# - LZ4 source repository : http://code.google.com/p/lz4/
yann.collet.73@gmail.com47823a82013-09-25 09:00:37 +000030# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
yann.collet.73@gmail.com77994542013-09-09 09:06:21 +000031# ################################################################
yann.collet.73@gmail.com77994542013-09-09 09:06:21 +000032
Yann Collet96e328c2014-12-13 15:05:46 +010033# Version number
34export VERSION=126
Yann Collet4886a0e2014-07-20 17:18:48 +020035export RELEASE=r$(VERSION)
yann.collet.73@gmail.comb996d282014-03-12 14:51:59 +000036
Igor Gnatenkof6f82b02014-08-08 10:23:00 +020037DESTDIR?=
38PREFIX ?= /usr
yann.collet.73@gmail.com5748f622014-01-07 18:47:50 +000039
Yann Collet96e328c2014-12-13 15:05:46 +010040LIBDIR ?= $(PREFIX)/lib
yann.collet.73@gmail.com5748f622014-01-07 18:47:50 +000041INCLUDEDIR=$(PREFIX)/include
Yann Collet96e328c2014-12-13 15:05:46 +010042PRGDIR = programs
43LZ4DIR = lib
yann.collet.73@gmail.com5748f622014-01-07 18:47:50 +000044DISTRIBNAME=lz4-$(RELEASE).tar.gz
45
Yann Collet8d0008d2014-11-30 23:32:12 +010046TEXT = $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4.h $(LZ4DIR)/lz4hc.c $(LZ4DIR)/lz4hc.h \
Yann Collet96e328c2014-12-13 15:05:46 +010047 $(LZ4DIR)/lz4frame.c $(LZ4DIR)/lz4frame.h $(LZ4DIR)/lz4frame_static.h \
48 $(LZ4DIR)/xxhash.c $(LZ4DIR)/xxhash.h \
Yann Collet8d0008d2014-11-30 23:32:12 +010049 $(LZ4DIR)/liblz4.pc.in $(LZ4DIR)/Makefile $(LZ4DIR)/LICENSE \
Yann Colletc8b59072014-12-01 01:20:42 +010050 Makefile lz4_block_format.txt LZ4_Frame_Format.html NEWS README.md \
yann.collet.73@gmail.com5748f622014-01-07 18:47:50 +000051 cmake_unofficial/CMakeLists.txt \
Yann Collet690a7d12014-08-06 08:55:08 +010052 $(PRGDIR)/fullbench.c $(PRGDIR)/lz4cli.c \
53 $(PRGDIR)/datagen.c $(PRGDIR)/fuzzer.c \
yann.collet.73@gmail.com6875c272014-02-04 14:11:10 +000054 $(PRGDIR)/lz4io.c $(PRGDIR)/lz4io.h \
yann.collet.73@gmail.com5748f622014-01-07 18:47:50 +000055 $(PRGDIR)/bench.c $(PRGDIR)/bench.h \
Yann Collet87d09e32014-04-15 16:47:48 +020056 $(PRGDIR)/lz4.1 $(PRGDIR)/lz4c.1 $(PRGDIR)/lz4cat.1 \
Yann Colletc8b59072014-12-01 01:20:42 +010057 $(PRGDIR)/Makefile $(PRGDIR)/COPYING
Yann Colletfb0473e2014-10-06 01:10:29 +010058NONTEXT = images/image00.png images/image01.png images/image02.png \
59 images/image03.png images/image04.png images/image05.png \
60 images/image06.png
yann.collet.73@gmail.com34937662013-10-01 20:32:43 +000061SOURCES = $(TEXT) $(NONTEXT)
yann.collet.73@gmail.com47823a82013-09-25 09:00:37 +000062
63
Yann Colletde7f2ff2014-10-28 15:35:43 +010064# Select test target for Travis CI's Build Matrix
Yann Colletcf1bbff2014-11-04 20:56:38 +010065ifneq (,$(filter test-%,$(LZ4_TRAVIS_CI_ENV)))
66TRAVIS_TARGET=prg-travis
Yann Colletde7f2ff2014-10-28 15:35:43 +010067else
Yann Colletcf1bbff2014-11-04 20:56:38 +010068TRAVIS_TARGET=$(LZ4_TRAVIS_CI_ENV)
Yann Colletde7f2ff2014-10-28 15:35:43 +010069endif
70
71
Yann Collet8d0008d2014-11-30 23:32:12 +010072default: lz4programs
yann.collet.73@gmail.com868cc182012-07-24 17:12:23 +000073
Yann Colleta18d8b12014-12-03 23:19:11 +010074all:
75 @cd $(LZ4DIR); $(MAKE) -e all
76 @cd $(PRGDIR); $(MAKE) -e all
yann.collet.73@gmail.com51c9a832011-05-25 22:25:57 +000077
Yann Collet8d0008d2014-11-30 23:32:12 +010078lz4programs:
Yann Colleta18d8b12014-12-03 23:19:11 +010079 @cd $(PRGDIR); $(MAKE) -e
yann.collet.73@gmail.com51c9a832011-05-25 22:25:57 +000080
yann.collet.73@gmail.com51c9a832011-05-25 22:25:57 +000081clean:
Yann Collet8d0008d2014-11-30 23:32:12 +010082 @rm -f $(DISTRIBNAME) *.sha1
yann.collet.73@gmail.comf2684682014-03-23 11:15:37 +000083 @cd $(PRGDIR); $(MAKE) clean
Yann Collet8d0008d2014-11-30 23:32:12 +010084 @cd $(LZ4DIR); $(MAKE) clean
Yann Colleta9ec6b32014-08-26 14:39:09 +010085 @cd examples; $(MAKE) clean
yann.collet.73@gmail.com47823a82013-09-25 09:00:37 +000086 @echo Cleaning completed
87
88
Yann Collet4886a0e2014-07-20 17:18:48 +020089#------------------------------------------------------------------------
Yann Collet1d208792014-07-26 15:15:00 +010090#make install is validated only for Linux, OSX, kFreeBSD and Hurd targets
91ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU))
yann.collet.73@gmail.com47823a82013-09-25 09:00:37 +000092
Yann Collet8d0008d2014-11-30 23:32:12 +010093install:
Yann Collet96e328c2014-12-13 15:05:46 +010094 @cd $(LZ4DIR); $(MAKE) -e install
95 @cd $(PRGDIR); $(MAKE) -e install
yann.collet.73@gmail.com47823a82013-09-25 09:00:37 +000096
97uninstall:
Yann Collet8d0008d2014-11-30 23:32:12 +010098 @cd $(LZ4DIR); $(MAKE) uninstall
yann.collet.73@gmail.comf2684682014-03-23 11:15:37 +000099 @cd $(PRGDIR); $(MAKE) uninstall
yann.collet.73@gmail.com47823a82013-09-25 09:00:37 +0000100
Yann Colletde80e892014-12-13 16:41:05 +0100101travis-install:
102 sudo $(MAKE) install
103
yann.collet.73@gmail.com47823a82013-09-25 09:00:37 +0000104dist: clean
Yann Collet8d0008d2014-11-30 23:32:12 +0100105 @install -dD -m 700 lz4-$(RELEASE)/lib/
yann.collet.73@gmail.com5748f622014-01-07 18:47:50 +0000106 @install -dD -m 700 lz4-$(RELEASE)/programs/
107 @install -dD -m 700 lz4-$(RELEASE)/cmake_unofficial/
Yann Colletfb0473e2014-10-06 01:10:29 +0100108 @install -dD -m 700 lz4-$(RELEASE)/images/
yann.collet.73@gmail.com34937662013-10-01 20:32:43 +0000109 @for f in $(TEXT); do \
110 tr -d '\r' < $$f > .tmp; \
111 install -m 600 .tmp lz4-$(RELEASE)/$$f; \
112 done
113 @rm .tmp
114 @for f in $(NONTEXT); do \
yann.collet.73@gmail.com47823a82013-09-25 09:00:37 +0000115 install -m 600 $$f lz4-$(RELEASE)/$$f; \
116 done
yann.collet.73@gmail.com34937662013-10-01 20:32:43 +0000117 @tar -czf $(DISTRIBNAME) lz4-$(RELEASE)/
yann.collet.73@gmail.com47823a82013-09-25 09:00:37 +0000118 @rm -rf lz4-$(RELEASE)
yann.collet.73@gmail.comf2684682014-03-23 11:15:37 +0000119 @sha1sum $(DISTRIBNAME) > $(DISTRIBNAME).sha1
yann.collet.73@gmail.com34937662013-10-01 20:32:43 +0000120 @echo Distribution $(DISTRIBNAME) built
yann.collet.73@gmail.com47823a82013-09-25 09:00:37 +0000121
Yann Collet28199f52014-07-21 21:01:59 +0100122test:
Yann Collet96e328c2014-12-13 15:05:46 +0100123 @cd $(PRGDIR); $(MAKE) -e test
Takayuki MATSUOKA34eeba32014-04-16 23:26:15 +0900124
Yann Colletde7f2ff2014-10-28 15:35:43 +0100125test-travis: $(TRAVIS_TARGET)
126
Yann Collet5320eeb2014-11-04 10:50:17 +0100127cmake:
128 @cd cmake_unofficial; cmake CMakeLists.txt; $(MAKE)
129
Yann Colletcf1bbff2014-11-04 20:56:38 +0100130streaming-examples:
Yann Colletde7f2ff2014-10-28 15:35:43 +0100131 cd examples; $(MAKE) -e test
132
Yann Colletcf1bbff2014-11-04 20:56:38 +0100133prg-travis:
Yann Colletde7f2ff2014-10-28 15:35:43 +0100134 @cd $(PRGDIR); $(MAKE) -e test-travis
135
yann.collet.73@gmail.com47823a82013-09-25 09:00:37 +0000136endif