Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 1 | # ################################################################ |
| 2 | # zstd - Makefile |
Yann Collet | 648959a | 2016-02-07 23:58:32 +0100 | [diff] [blame] | 3 | # Copyright (C) Yann Collet 2014-2016 |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 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 : |
Yann Collet | 4f0a393 | 2016-02-07 04:00:27 +0100 | [diff] [blame] | 30 | # - zstd homepage : http://www.zstd.net/ |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 31 | # ################################################################ |
| 32 | |
Yann Collet | 722504c | 2015-12-31 18:32:15 +0100 | [diff] [blame] | 33 | # force a version number : uncomment below export (otherwise, default to the one declared into zstd.h) |
| 34 | #export VERSION := 0.4.6 |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 35 | |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 36 | PRGDIR = programs |
| 37 | ZSTDDIR = lib |
Yann Collet | 9cadd08 | 2016-01-28 15:39:52 +0100 | [diff] [blame] | 38 | DICTDIR = dictBuilder |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 39 | |
Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 40 | # Define nul output |
| 41 | ifneq (,$(filter Windows%,$(OS))) |
| 42 | VOID = nul |
| 43 | else |
| 44 | VOID = /dev/null |
| 45 | endif |
| 46 | |
| 47 | .PHONY: default all zstdprogram clean install uninstall travis-install test clangtest gpptest armtest usan asan uasan |
Yann Collet | 213089c | 2015-06-18 07:43:16 -0800 | [diff] [blame] | 48 | |
Yann Collet | bf50409 | 2015-08-26 00:19:06 +0100 | [diff] [blame] | 49 | default: zstdprogram |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 50 | |
| 51 | all: |
Yann Collet | bf50409 | 2015-08-26 00:19:06 +0100 | [diff] [blame] | 52 | $(MAKE) -C $(ZSTDDIR) $@ |
| 53 | $(MAKE) -C $(PRGDIR) $@ |
Yann Collet | 9cadd08 | 2016-01-28 15:39:52 +0100 | [diff] [blame] | 54 | $(MAKE) -C $(DICTDIR) $@ |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 55 | |
Yann Collet | bf50409 | 2015-08-26 00:19:06 +0100 | [diff] [blame] | 56 | zstdprogram: |
| 57 | $(MAKE) -C $(PRGDIR) |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 58 | |
| 59 | clean: |
Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 60 | @$(MAKE) -C $(ZSTDDIR) $@ > $(VOID) |
| 61 | @$(MAKE) -C $(PRGDIR) $@ > $(VOID) |
Yann Collet | 9cadd08 | 2016-01-28 15:39:52 +0100 | [diff] [blame] | 62 | @$(MAKE) -C $(DICTDIR) $@ > $(VOID) |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 63 | @echo Cleaning completed |
| 64 | |
| 65 | |
| 66 | #------------------------------------------------------------------------ |
| 67 | #make install is validated only for Linux, OSX, kFreeBSD and Hurd targets |
| 68 | ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU)) |
| 69 | |
| 70 | install: |
Yann Collet | bf50409 | 2015-08-26 00:19:06 +0100 | [diff] [blame] | 71 | $(MAKE) -C $(ZSTDDIR) $@ |
| 72 | $(MAKE) -C $(PRGDIR) $@ |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 73 | |
| 74 | uninstall: |
Yann Collet | bf50409 | 2015-08-26 00:19:06 +0100 | [diff] [blame] | 75 | $(MAKE) -C $(ZSTDDIR) $@ |
| 76 | $(MAKE) -C $(PRGDIR) $@ |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 77 | |
| 78 | travis-install: |
Yann Collet | c620b48 | 2015-12-01 01:56:02 +0100 | [diff] [blame] | 79 | $(MAKE) install PREFIX=~/install_test_dir |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 80 | |
| 81 | test: |
Yann Collet | bf50409 | 2015-08-26 00:19:06 +0100 | [diff] [blame] | 82 | $(MAKE) -C $(PRGDIR) $@ |
Yann Collet | 9cadd08 | 2016-01-28 15:39:52 +0100 | [diff] [blame] | 83 | $(MAKE) -C $(DICTDIR) $@ |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 84 | |
Yann Collet | 3e5b73b | 2016-01-10 20:46:20 +0100 | [diff] [blame] | 85 | cmaketest: |
| 86 | cd contrib/cmake ; cmake . ; $(MAKE) |
| 87 | |
Yann Collet | 213089c | 2015-06-18 07:43:16 -0800 | [diff] [blame] | 88 | clangtest: clean |
Yann Collet | f4ce891 | 2015-08-11 14:18:45 +0100 | [diff] [blame] | 89 | clang -v |
Yann Collet | 213089c | 2015-06-18 07:43:16 -0800 | [diff] [blame] | 90 | $(MAKE) all CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion" |
| 91 | |
| 92 | gpptest: clean |
| 93 | $(MAKE) all CC=g++ CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror" |
| 94 | |
Yann Collet | 7083b8a | 2015-07-06 23:58:59 -0800 | [diff] [blame] | 95 | armtest: clean |
Yann Collet | 648959a | 2016-02-07 23:58:32 +0100 | [diff] [blame] | 96 | # $(MAKE) -C $(ZSTDDIR) all CC=arm-linux-gnueabi-gcc MOREFLAGS="-Werror" |
| 97 | $(MAKE) -C $(PRGDIR) datagen # use native, faster |
Yann Collet | 521b010 | 2016-02-08 01:27:59 +0100 | [diff] [blame] | 98 | $(MAKE) -C $(PRGDIR) test CC=arm-linux-gnueabi-gcc ZSTDRTTEST= MOREFLAGS=-static # MOREFLAGS="-Werror -static" |
| 99 | |
| 100 | # for Travis CI |
| 101 | arminstall: clean |
| 102 | sudo apt-get install -q qemu |
| 103 | sudo apt-get install -q binfmt-support |
| 104 | sudo apt-get install -q qemu-user-static |
| 105 | sudo apt-get install -q gcc-arm-linux-gnueabi |
| 106 | |
| 107 | # for Travis CI |
| 108 | armtest-w-install: clean arminstall armtest |
| 109 | |
| 110 | ppctest: clean |
| 111 | $(MAKE) -C $(PRGDIR) datagen # use native, faster |
| 112 | $(MAKE) -C $(PRGDIR) test CC=powerpc-linux-gnu-gcc ZSTDRTTEST= MOREFLAGS=-static # MOREFLAGS="-Werror -static" |
| 113 | |
| 114 | # for Travis CI |
| 115 | ppcinstall: clean |
| 116 | sudo apt-get install -q qemu |
| 117 | sudo apt-get install -q binfmt-support |
| 118 | sudo apt-get install -q qemu-user-static |
Yann Collet | 991b390 | 2016-02-08 20:58:37 +0100 | [diff] [blame^] | 119 | sudo apt-get update -q |
| 120 | sudo apt-get install -q gcc-powerpc-linux-gnu # unfortunately, doesn't work on Travis CI (package not available) |
Yann Collet | 521b010 | 2016-02-08 01:27:59 +0100 | [diff] [blame] | 121 | |
| 122 | # for Travis CI |
| 123 | ppctest-w-install: clean ppcinstall ppctest |
Yann Collet | 7083b8a | 2015-07-06 23:58:59 -0800 | [diff] [blame] | 124 | |
Yann Collet | 83fae97 | 2015-10-23 15:21:53 +0100 | [diff] [blame] | 125 | usan: clean |
Yann Collet | 674d91b | 2015-07-07 00:36:49 -0800 | [diff] [blame] | 126 | $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=undefined" |
Yann Collet | 213089c | 2015-06-18 07:43:16 -0800 | [diff] [blame] | 127 | |
Yann Collet | 83fae97 | 2015-10-23 15:21:53 +0100 | [diff] [blame] | 128 | asan: clean |
| 129 | $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address" |
| 130 | |
Yann Collet | 6c3e2e7 | 2015-12-11 10:44:07 +0100 | [diff] [blame] | 131 | asan32: clean |
| 132 | $(MAKE) -C $(PRGDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address" |
| 133 | |
Yann Collet | 83fae97 | 2015-10-23 15:21:53 +0100 | [diff] [blame] | 134 | uasan: clean |
| 135 | $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address -fsanitize=undefined" |
| 136 | |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 137 | endif |