blob: 8049649d697f40434347442ad609607f44a960c0 [file] [log] [blame]
Yann Collet4856a002015-01-24 01:58:16 +01001# ################################################################
2# zstd - Makefile
3# Copyright (C) Yann Collet 2014-2015
4# All rights reserved.
5#
6# BSD license
7#
8# Redistribution and use in source and binary forms, with or without modification,
9# are permitted provided that the following conditions are met:
10#
11# * Redistributions of source code must retain the above copyright notice, this
12# list of conditions and the following disclaimer.
13#
14# * Redistributions in binary form must reproduce the above copyright notice, this
15# list of conditions and the following disclaimer in the documentation and/or
16# other materials provided with the distribution.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28#
29# You can contact the author at :
30# - zstd source repository : https://github.com/Cyan4973/zstd
31# - Public forum : https://groups.google.com/forum/#!forum/lz4c
32# ################################################################
33
34# Version number
Yann Collet213089c2015-06-18 07:43:16 -080035export VERSION=0.0.2
Yann Collet4856a002015-01-24 01:58:16 +010036export RELEASE=r$(VERSION)
37
38DESTDIR?=
39PREFIX ?= /usr
40
41LIBDIR ?= $(PREFIX)/lib
42INCLUDEDIR=$(PREFIX)/include
43PRGDIR = programs
44ZSTDDIR = lib
45
46# Select test target for Travis CI's Build Matrix
47ifneq (,$(filter test-%,$(ZSTD_TRAVIS_CI_ENV)))
48TRAVIS_TARGET=prg-travis
49else
50TRAVIS_TARGET=$(ZSTD_TRAVIS_CI_ENV)
51endif
52
53
Yann Collet213089c2015-06-18 07:43:16 -080054.PHONY: clean
55
Yann Collet4856a002015-01-24 01:58:16 +010056default: zstdprograms
57
58all:
59 @cd $(ZSTDDIR); $(MAKE) -e all
60 @cd $(PRGDIR); $(MAKE) -e all
61
62zstdprograms:
63 @cd $(PRGDIR); $(MAKE) -e
64
65clean:
66 @cd $(PRGDIR); $(MAKE) clean
67 @cd $(ZSTDDIR); $(MAKE) clean
68# @cd examples; $(MAKE) clean
69 @echo Cleaning completed
70
71
72#------------------------------------------------------------------------
73#make install is validated only for Linux, OSX, kFreeBSD and Hurd targets
74ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU))
75
76install:
77 @cd $(ZSTDDIR); $(MAKE) -e install
78 @cd $(PRGDIR); $(MAKE) -e install
79
80uninstall:
81 @cd $(ZSTDDIR); $(MAKE) uninstall
82 @cd $(PRGDIR); $(MAKE) uninstall
83
84travis-install:
85 sudo $(MAKE) install
86
87test:
88 @cd $(PRGDIR); $(MAKE) -e test
89
90test-travis: $(TRAVIS_TARGET)
91
92prg-travis:
Yann Collet0e9d92c2015-01-24 11:20:08 +010093 @cd $(PRGDIR); $(MAKE) -e $(ZSTD_TRAVIS_CI_ENV)
Yann Collet4856a002015-01-24 01:58:16 +010094
Yann Collet213089c2015-06-18 07:43:16 -080095clangtest: clean
96 $(MAKE) all CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion"
97
98gpptest: clean
99 $(MAKE) all CC=g++ CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror"
100
Yann Collet7083b8a2015-07-06 23:58:59 -0800101armtest: clean
102 cd $(ZSTDDIR); $(MAKE) -e all CC=arm-linux-gnueabi-gcc MOREFLAGS="-Werror"
Yann Collet674d91b2015-07-07 00:36:49 -0800103 cd $(PRGDIR); $(MAKE) -e CC=arm-linux-gnueabi-gcc MOREFLAGS="-Werror"
Yann Collet7083b8a2015-07-06 23:58:59 -0800104
105sanitize: clean
Yann Collet674d91b2015-07-07 00:36:49 -0800106 $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=undefined"
Yann Collet213089c2015-06-18 07:43:16 -0800107
Yann Collet4856a002015-01-24 01:58:16 +0100108endif