blob: 1f7e6e82346214ed78d38f5d5f21f3fb4e359c14 [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 Colletf44b2b02015-08-25 23:32:45 +010035export VERSION=0.1.1
Yann Collet4856a002015-01-24 01:58:16 +010036
Yann Collet4856a002015-01-24 01:58:16 +010037PRGDIR = programs
38ZSTDDIR = lib
39
Yann Collet213089c2015-06-18 07:43:16 -080040.PHONY: clean
41
Yann Colletbf504092015-08-26 00:19:06 +010042default: zstdprogram
Yann Collet4856a002015-01-24 01:58:16 +010043
44all:
Yann Colletbf504092015-08-26 00:19:06 +010045 $(MAKE) -C $(ZSTDDIR) $@
46 $(MAKE) -C $(PRGDIR) $@
Yann Collet4856a002015-01-24 01:58:16 +010047
Yann Colletbf504092015-08-26 00:19:06 +010048zstdprogram:
49 $(MAKE) -C $(PRGDIR)
Yann Collet4856a002015-01-24 01:58:16 +010050
51clean:
Yann Colletbf504092015-08-26 00:19:06 +010052 $(MAKE) -C $(ZSTDDIR) $@
53 $(MAKE) -C $(PRGDIR) $@
Yann Collet4856a002015-01-24 01:58:16 +010054 @echo Cleaning completed
55
56
57#------------------------------------------------------------------------
58#make install is validated only for Linux, OSX, kFreeBSD and Hurd targets
59ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU))
60
61install:
Yann Colletbf504092015-08-26 00:19:06 +010062 $(MAKE) -C $(ZSTDDIR) $@
63 $(MAKE) -C $(PRGDIR) $@
Yann Collet4856a002015-01-24 01:58:16 +010064
65uninstall:
Yann Colletbf504092015-08-26 00:19:06 +010066 $(MAKE) -C $(ZSTDDIR) $@
67 $(MAKE) -C $(PRGDIR) $@
Yann Collet4856a002015-01-24 01:58:16 +010068
69travis-install:
70 sudo $(MAKE) install
71
72test:
Yann Colletbf504092015-08-26 00:19:06 +010073 $(MAKE) -C $(PRGDIR) $@
Yann Collet4856a002015-01-24 01:58:16 +010074
Yann Collet213089c2015-06-18 07:43:16 -080075clangtest: clean
Yann Colletf4ce8912015-08-11 14:18:45 +010076 clang -v
Yann Collet213089c2015-06-18 07:43:16 -080077 $(MAKE) all CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion"
78
79gpptest: clean
80 $(MAKE) all CC=g++ CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror"
81
Yann Collet7083b8a2015-07-06 23:58:59 -080082armtest: clean
Yann Colletbf504092015-08-26 00:19:06 +010083 $(MAKE) -C $(ZSTDDIR) -e all CC=arm-linux-gnueabi-gcc MOREFLAGS="-Werror"
84 $(MAKE) -C $(PRGDIR) -e CC=arm-linux-gnueabi-gcc MOREFLAGS="-Werror"
Yann Collet7083b8a2015-07-06 23:58:59 -080085
86sanitize: clean
Yann Collet674d91b2015-07-07 00:36:49 -080087 $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=undefined"
Yann Collet213089c2015-06-18 07:43:16 -080088
Yann Collet4856a002015-01-24 01:58:16 +010089endif