Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 1 | # ################################################################ |
Yann Collet | e9dc204 | 2017-08-31 11:24:54 -0700 | [diff] [blame] | 2 | # Copyright (c) 2015-present, Yann Collet, Facebook, Inc. |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 3 | # All rights reserved. |
Yann Collet | 118bfc4 | 2016-05-30 18:50:28 +0200 | [diff] [blame] | 4 | # |
Yann Collet | e9dc204 | 2017-08-31 11:24:54 -0700 | [diff] [blame] | 5 | # This source code is licensed under both the BSD-style license (found in the |
| 6 | # LICENSE file in the root directory of this source tree) and the GPLv2 (found |
| 7 | # in the COPYING file in the root directory of this source tree). |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 8 | # ################################################################ |
| 9 | |
Yann Collet | 4c9a4c1 | 2016-09-19 14:58:14 +0200 | [diff] [blame] | 10 | PRGDIR = programs |
| 11 | ZSTDDIR = lib |
| 12 | BUILDIR = build |
inikep | e9dfdf6 | 2016-05-27 11:56:15 +0200 | [diff] [blame] | 13 | ZWRAPDIR = zlibWrapper |
inikep | a1c8115 | 2016-08-18 13:35:36 +0200 | [diff] [blame] | 14 | TESTDIR = tests |
Nick Terrell | 6bb781e | 2017-09-25 13:29:50 -0700 | [diff] [blame] | 15 | FUZZDIR = $(TESTDIR)/fuzz |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 16 | |
Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 17 | # Define nul output |
Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 18 | VOID = /dev/null |
Przemyslaw Skibinski | 3a41559 | 2016-11-03 12:59:20 +0100 | [diff] [blame] | 19 | |
| 20 | ifneq (,$(filter Windows%,$(OS))) |
| 21 | EXT =.exe |
| 22 | else |
| 23 | EXT = |
Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 24 | endif |
| 25 | |
Yann Collet | f3f1321 | 2016-11-02 17:02:45 -0700 | [diff] [blame] | 26 | .PHONY: default |
Yann Collet | 8b1d004 | 2017-03-05 21:17:32 -0800 | [diff] [blame] | 27 | default: lib-release zstd-release |
Yann Collet | 213089c | 2015-06-18 07:43:16 -0800 | [diff] [blame] | 28 | |
Yann Collet | f3f1321 | 2016-11-02 17:02:45 -0700 | [diff] [blame] | 29 | .PHONY: all |
Yann Collet | 9781640 | 2018-03-15 16:39:59 -0700 | [diff] [blame] | 30 | all: | allmost examples manual contrib |
Yann Collet | a86a09e | 2016-12-22 11:31:39 +0100 | [diff] [blame] | 31 | |
| 32 | .PHONY: allmost |
Yann Collet | 8e29838 | 2017-08-31 14:30:52 -0700 | [diff] [blame] | 33 | allmost: allzstd |
Yann Collet | 7cedbd1 | 2016-12-22 12:43:00 +0100 | [diff] [blame] | 34 | $(MAKE) -C $(ZWRAPDIR) all |
| 35 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 36 | #skip zwrapper, can't build that on alternate architectures without the proper zlib installed |
Yann Collet | 8e29838 | 2017-08-31 14:30:52 -0700 | [diff] [blame] | 37 | .PHONY: allzstd |
| 38 | allzstd: |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 39 | $(MAKE) -C $(ZSTDDIR) all |
| 40 | $(MAKE) -C $(PRGDIR) all |
| 41 | $(MAKE) -C $(TESTDIR) all |
| 42 | |
Yann Collet | 7cedbd1 | 2016-12-22 12:43:00 +0100 | [diff] [blame] | 43 | .PHONY: all32 |
| 44 | all32: |
| 45 | $(MAKE) -C $(PRGDIR) zstd32 |
| 46 | $(MAKE) -C $(TESTDIR) all32 |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 47 | |
Yann Collet | f3f1321 | 2016-11-02 17:02:45 -0700 | [diff] [blame] | 48 | .PHONY: lib |
| 49 | lib: |
Yann Collet | 8b1d004 | 2017-03-05 21:17:32 -0800 | [diff] [blame] | 50 | @$(MAKE) -C $(ZSTDDIR) $@ |
| 51 | |
| 52 | .PHONY: lib-release |
| 53 | lib-release: |
Yann Collet | e19111c | 2016-10-12 11:09:36 -0700 | [diff] [blame] | 54 | @$(MAKE) -C $(ZSTDDIR) |
| 55 | |
Yann Collet | d41380e | 2016-11-07 14:55:12 -0800 | [diff] [blame] | 56 | .PHONY: zstd |
Yann Collet | 32faf6c | 2016-07-22 04:45:06 +0200 | [diff] [blame] | 57 | zstd: |
Yann Collet | d41380e | 2016-11-07 14:55:12 -0800 | [diff] [blame] | 58 | @$(MAKE) -C $(PRGDIR) $@ |
Przemyslaw Skibinski | 3a41559 | 2016-11-03 12:59:20 +0100 | [diff] [blame] | 59 | cp $(PRGDIR)/zstd$(EXT) . |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 60 | |
Yann Collet | c2a4632 | 2017-02-02 20:54:14 -0800 | [diff] [blame] | 61 | .PHONY: zstd-release |
| 62 | zstd-release: |
| 63 | @$(MAKE) -C $(PRGDIR) |
| 64 | cp $(PRGDIR)/zstd$(EXT) . |
| 65 | |
Yann Collet | 563ef8a | 2017-01-18 12:12:10 -0800 | [diff] [blame] | 66 | .PHONY: zstdmt |
| 67 | zstdmt: |
| 68 | @$(MAKE) -C $(PRGDIR) $@ |
| 69 | cp $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT) |
| 70 | |
Yann Collet | f3f1321 | 2016-11-02 17:02:45 -0700 | [diff] [blame] | 71 | .PHONY: zlibwrapper |
inikep | e9dfdf6 | 2016-05-27 11:56:15 +0200 | [diff] [blame] | 72 | zlibwrapper: |
inikep | 68cd476 | 2016-09-23 12:42:21 +0200 | [diff] [blame] | 73 | $(MAKE) -C $(ZWRAPDIR) test |
inikep | e9dfdf6 | 2016-05-27 11:56:15 +0200 | [diff] [blame] | 74 | |
Yann Collet | cb5eba8 | 2018-01-19 11:26:35 -0800 | [diff] [blame] | 75 | .PHONY: test |
| 76 | test: |
Yann Collet | f4e5845 | 2018-01-16 11:50:16 -0800 | [diff] [blame] | 77 | $(MAKE) -C $(PRGDIR) allVariants MOREFLAGS+="-g -DZSTD_DEBUG=1" |
inikep | a1c8115 | 2016-08-18 13:35:36 +0200 | [diff] [blame] | 78 | $(MAKE) -C $(TESTDIR) $@ |
Yann Collet | 6f9c056 | 2016-05-01 10:26:30 +0200 | [diff] [blame] | 79 | |
Yann Collet | cb5eba8 | 2018-01-19 11:26:35 -0800 | [diff] [blame] | 80 | .PHONY: shortest |
| 81 | shortest: |
| 82 | $(MAKE) -C $(TESTDIR) $@ |
| 83 | |
| 84 | .PHONY: check |
| 85 | check: shortest |
| 86 | |
Yann Collet | 7757577 | 2017-02-22 01:10:43 -0800 | [diff] [blame] | 87 | .PHONY: examples |
| 88 | examples: |
| 89 | CPPFLAGS=-I../lib LDFLAGS=-L../lib $(MAKE) -C examples/ all |
| 90 | |
| 91 | .PHONY: manual |
| 92 | manual: |
| 93 | $(MAKE) -C contrib/gen_html $@ |
| 94 | |
Yann Collet | 9781640 | 2018-03-15 16:39:59 -0700 | [diff] [blame] | 95 | .PHONY: contrib |
| 96 | contrib: lib |
| 97 | $(MAKE) -C contrib/pzstd all |
| 98 | $(MAKE) -C contrib/seekable_format/examples all |
Yann Collet | 5373e44 | 2018-03-15 17:10:15 -0700 | [diff] [blame] | 99 | $(MAKE) -C contrib/adaptive-compression all |
Yann Collet | 9781640 | 2018-03-15 16:39:59 -0700 | [diff] [blame] | 100 | |
Yann Collet | 6851db4 | 2017-03-30 12:42:44 -0700 | [diff] [blame] | 101 | .PHONY: cleanTabs |
| 102 | cleanTabs: |
| 103 | cd contrib; ./cleanTabs |
| 104 | |
Yann Collet | f3f1321 | 2016-11-02 17:02:45 -0700 | [diff] [blame] | 105 | .PHONY: clean |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 106 | clean: |
Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 107 | @$(MAKE) -C $(ZSTDDIR) $@ > $(VOID) |
| 108 | @$(MAKE) -C $(PRGDIR) $@ > $(VOID) |
inikep | a1c8115 | 2016-08-18 13:35:36 +0200 | [diff] [blame] | 109 | @$(MAKE) -C $(TESTDIR) $@ > $(VOID) |
inikep | e9dfdf6 | 2016-05-27 11:56:15 +0200 | [diff] [blame] | 110 | @$(MAKE) -C $(ZWRAPDIR) $@ > $(VOID) |
Yann Collet | 1f57c2e | 2016-12-21 16:20:11 +0100 | [diff] [blame] | 111 | @$(MAKE) -C examples/ $@ > $(VOID) |
Yann Collet | 88ba647 | 2017-02-22 10:52:36 -0800 | [diff] [blame] | 112 | @$(MAKE) -C contrib/gen_html $@ > $(VOID) |
Yann Collet | 9781640 | 2018-03-15 16:39:59 -0700 | [diff] [blame] | 113 | @$(MAKE) -C contrib/pzstd $@ > $(VOID) |
| 114 | @$(MAKE) -C contrib/seekable_format/examples $@ > $(VOID) |
Yann Collet | 5373e44 | 2018-03-15 17:10:15 -0700 | [diff] [blame] | 115 | @$(MAKE) -C contrib/adaptive-compression $@ > $(VOID) |
Yann Collet | 900f39e | 2017-01-20 16:36:29 -0800 | [diff] [blame] | 116 | @$(RM) zstd$(EXT) zstdmt$(EXT) tmp* |
W. Felix Handte | 5705d9f | 2017-09-21 17:30:43 -0700 | [diff] [blame] | 117 | @$(RM) -r lz4 |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 118 | @echo Cleaning completed |
| 119 | |
Yann Collet | e405c7a | 2016-10-12 15:29:22 -0700 | [diff] [blame] | 120 | #------------------------------------------------------------------------------ |
| 121 | # make install is validated only for Linux, OSX, Hurd and some BSD targets |
| 122 | #------------------------------------------------------------------------------ |
cyan4973 | 8bcbf42 | 2017-06-04 23:52:00 -0700 | [diff] [blame] | 123 | ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD DragonFly NetBSD MSYS_NT)) |
Yann Collet | b402f1e | 2017-04-18 14:34:24 -0700 | [diff] [blame] | 124 | |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 125 | HOST_OS = POSIX |
Milan Ševčík | f49f760 | 2017-04-19 19:25:53 +0200 | [diff] [blame] | 126 | CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON |
Yann Collet | f3f1321 | 2016-11-02 17:02:45 -0700 | [diff] [blame] | 127 | |
Yann Collet | b402f1e | 2017-04-18 14:34:24 -0700 | [diff] [blame] | 128 | .PHONY: list |
| 129 | list: |
| 130 | @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs |
| 131 | |
Yann Collet | 763f8b5 | 2017-09-27 12:09:52 -0700 | [diff] [blame] | 132 | .PHONY: install clangtest armtest usan asan uasan |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 133 | install: |
Yann Collet | e19111c | 2016-10-12 11:09:36 -0700 | [diff] [blame] | 134 | @$(MAKE) -C $(ZSTDDIR) $@ |
| 135 | @$(MAKE) -C $(PRGDIR) $@ |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 136 | |
Yann Collet | afb0aca | 2017-06-29 18:19:09 -0700 | [diff] [blame] | 137 | .PHONY: uninstall |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 138 | uninstall: |
Yann Collet | e19111c | 2016-10-12 11:09:36 -0700 | [diff] [blame] | 139 | @$(MAKE) -C $(ZSTDDIR) $@ |
| 140 | @$(MAKE) -C $(PRGDIR) $@ |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 141 | |
Yann Collet | afb0aca | 2017-06-29 18:19:09 -0700 | [diff] [blame] | 142 | .PHONY: travis-install |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 143 | travis-install: |
Yann Collet | c620b48 | 2015-12-01 01:56:02 +0100 | [diff] [blame] | 144 | $(MAKE) install PREFIX=~/install_test_dir |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 145 | |
Yann Collet | afb0aca | 2017-06-29 18:19:09 -0700 | [diff] [blame] | 146 | .PHONY: gcc5build |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 147 | gcc5build: clean |
| 148 | gcc-5 -v |
| 149 | CC=gcc-5 $(MAKE) all MOREFLAGS="-Werror" |
| 150 | |
Yann Collet | afb0aca | 2017-06-29 18:19:09 -0700 | [diff] [blame] | 151 | .PHONY: gcc6build |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 152 | gcc6build: clean |
| 153 | gcc-6 -v |
| 154 | CC=gcc-6 $(MAKE) all MOREFLAGS="-Werror" |
| 155 | |
Nick Terrell | 9ba9718 | 2017-08-08 12:32:26 -0700 | [diff] [blame] | 156 | .PHONY: gcc7build |
| 157 | gcc7build: clean |
| 158 | gcc-7 -v |
| 159 | CC=gcc-7 $(MAKE) all MOREFLAGS="-Werror" |
| 160 | |
Yann Collet | afb0aca | 2017-06-29 18:19:09 -0700 | [diff] [blame] | 161 | .PHONY: clangbuild |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 162 | clangbuild: clean |
| 163 | clang -v |
| 164 | CXX=clang++ CC=clang $(MAKE) all MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation" |
| 165 | |
| 166 | m32build: clean |
| 167 | gcc -v |
| 168 | $(MAKE) all32 |
| 169 | |
| 170 | armbuild: clean |
Yann Collet | 8e29838 | 2017-08-31 14:30:52 -0700 | [diff] [blame] | 171 | CC=arm-linux-gnueabi-gcc CFLAGS="-Werror" $(MAKE) allzstd |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 172 | |
| 173 | aarch64build: clean |
Yann Collet | 8e29838 | 2017-08-31 14:30:52 -0700 | [diff] [blame] | 174 | CC=aarch64-linux-gnu-gcc CFLAGS="-Werror" $(MAKE) allzstd |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 175 | |
| 176 | ppcbuild: clean |
Yann Collet | c6f5bf0 | 2017-12-01 17:35:19 -0800 | [diff] [blame] | 177 | CC=powerpc-linux-gnu-gcc CFLAGS="-m32 -Wno-attributes -Werror" $(MAKE) allzstd |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 178 | |
| 179 | ppc64build: clean |
Yann Collet | 8e29838 | 2017-08-31 14:30:52 -0700 | [diff] [blame] | 180 | CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) allzstd |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 181 | |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 182 | armfuzz: clean |
Sean Purcell | 0b0b10e | 2017-03-20 11:32:24 -0700 | [diff] [blame] | 183 | CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 184 | |
| 185 | aarch64fuzz: clean |
Sean Purcell | 0b0b10e | 2017-03-20 11:32:24 -0700 | [diff] [blame] | 186 | CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 187 | |
| 188 | ppcfuzz: clean |
Sean Purcell | 0b0b10e | 2017-03-20 11:32:24 -0700 | [diff] [blame] | 189 | CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 190 | |
| 191 | ppc64fuzz: clean |
Sean Purcell | 0b0b10e | 2017-03-20 11:32:24 -0700 | [diff] [blame] | 192 | CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 193 | |
Yann Collet | 60ca44b | 2017-09-27 12:24:13 -0700 | [diff] [blame] | 194 | .PHONY: cxxtest |
| 195 | cxxtest: CXXFLAGS += -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror |
| 196 | cxxtest: clean |
Yann Collet | 763f8b5 | 2017-09-27 12:09:52 -0700 | [diff] [blame] | 197 | $(MAKE) -C $(PRGDIR) all CC="$(CXX) -Wno-deprecated" CFLAGS="$(CXXFLAGS)" # adding -Wno-deprecated to avoid clang++ warning on dealing with C files directly |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 198 | |
inikep | c9bb102 | 2016-06-21 18:04:13 +0200 | [diff] [blame] | 199 | gcc5test: clean |
| 200 | gcc-5 -v |
| 201 | $(MAKE) all CC=gcc-5 MOREFLAGS="-Werror" |
| 202 | |
| 203 | gcc6test: clean |
| 204 | gcc-6 -v |
| 205 | $(MAKE) all CC=gcc-6 MOREFLAGS="-Werror" |
| 206 | |
Yann Collet | 213089c | 2015-06-18 07:43:16 -0800 | [diff] [blame] | 207 | clangtest: clean |
Yann Collet | f4ce891 | 2015-08-11 14:18:45 +0100 | [diff] [blame] | 208 | clang -v |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 209 | $(MAKE) all CXX=clang-++ CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation" |
Yann Collet | 213089c | 2015-06-18 07:43:16 -0800 | [diff] [blame] | 210 | |
Yann Collet | 7083b8a | 2015-07-06 23:58:59 -0800 | [diff] [blame] | 211 | armtest: clean |
inikep | 2d5eb2b | 2016-08-18 13:53:26 +0200 | [diff] [blame] | 212 | $(MAKE) -C $(TESTDIR) datagen # use native, faster |
Sean Purcell | 0b0b10e | 2017-03-20 11:32:24 -0700 | [diff] [blame] | 213 | $(MAKE) -C $(TESTDIR) test CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static" FUZZER_FLAGS=--no-big-tests |
Przemyslaw Skibinski | e579ab5 | 2016-11-14 12:57:05 +0100 | [diff] [blame] | 214 | |
| 215 | aarch64test: |
| 216 | $(MAKE) -C $(TESTDIR) datagen # use native, faster |
Sean Purcell | 0b0b10e | 2017-03-20 11:32:24 -0700 | [diff] [blame] | 217 | $(MAKE) -C $(TESTDIR) test CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static" FUZZER_FLAGS=--no-big-tests |
Yann Collet | 521b010 | 2016-02-08 01:27:59 +0100 | [diff] [blame] | 218 | |
Yann Collet | 521b010 | 2016-02-08 01:27:59 +0100 | [diff] [blame] | 219 | ppctest: clean |
inikep | 2d5eb2b | 2016-08-18 13:53:26 +0200 | [diff] [blame] | 220 | $(MAKE) -C $(TESTDIR) datagen # use native, faster |
Sean Purcell | 0b0b10e | 2017-03-20 11:32:24 -0700 | [diff] [blame] | 221 | $(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static" FUZZER_FLAGS=--no-big-tests |
Yann Collet | 521b010 | 2016-02-08 01:27:59 +0100 | [diff] [blame] | 222 | |
inikep | 1981d5a | 2016-05-30 10:18:56 +0200 | [diff] [blame] | 223 | ppc64test: clean |
inikep | 2d5eb2b | 2016-08-18 13:53:26 +0200 | [diff] [blame] | 224 | $(MAKE) -C $(TESTDIR) datagen # use native, faster |
Sean Purcell | 0b0b10e | 2017-03-20 11:32:24 -0700 | [diff] [blame] | 225 | $(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests |
inikep | 1981d5a | 2016-05-30 10:18:56 +0200 | [diff] [blame] | 226 | |
Przemyslaw Skibinski | d41c048 | 2017-02-22 11:07:28 +0100 | [diff] [blame] | 227 | arm-ppc-compilation: |
| 228 | $(MAKE) -C $(PRGDIR) clean zstd CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static" |
| 229 | $(MAKE) -C $(PRGDIR) clean zstd CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static" |
| 230 | $(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static" |
| 231 | $(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static" |
| 232 | |
Nick Terrell | 6bb781e | 2017-09-25 13:29:50 -0700 | [diff] [blame] | 233 | regressiontest: |
| 234 | $(MAKE) -C $(FUZZDIR) regressiontest |
| 235 | |
| 236 | uasanregressiontest: |
| 237 | $(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=address,undefined" CXXFLAGS="-O3 -fsanitize=address,undefined" |
| 238 | |
| 239 | msanregressiontest: |
| 240 | $(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=memory" CXXFLAGS="-O3 -fsanitize=memory" |
| 241 | |
Sean Purcell | caf0ee8 | 2017-03-09 17:28:08 -0800 | [diff] [blame] | 242 | # run UBsan with -fsanitize-recover=signed-integer-overflow |
| 243 | # due to a bug in UBsan when doing pointer subtraction |
| 244 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63303 |
| 245 | |
Yann Collet | 83fae97 | 2015-10-23 15:21:53 +0100 | [diff] [blame] | 246 | usan: clean |
Yann Collet | 19cb37f | 2018-01-16 11:40:42 -0800 | [diff] [blame] | 247 | $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=undefined -Werror" |
Yann Collet | 213089c | 2015-06-18 07:43:16 -0800 | [diff] [blame] | 248 | |
Yann Collet | 83fae97 | 2015-10-23 15:21:53 +0100 | [diff] [blame] | 249 | asan: clean |
Yann Collet | 19cb37f | 2018-01-16 11:40:42 -0800 | [diff] [blame] | 250 | $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address -Werror" |
Yann Collet | 83fae97 | 2015-10-23 15:21:53 +0100 | [diff] [blame] | 251 | |
Sean Purcell | caf0ee8 | 2017-03-09 17:28:08 -0800 | [diff] [blame] | 252 | asan-%: clean |
Yann Collet | 19cb37f | 2018-01-16 11:40:42 -0800 | [diff] [blame] | 253 | LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=address -Werror" $(MAKE) -C $(TESTDIR) $* |
Sean Purcell | caf0ee8 | 2017-03-09 17:28:08 -0800 | [diff] [blame] | 254 | |
Yann Collet | d996743 | 2016-05-18 14:16:49 +0200 | [diff] [blame] | 255 | msan: clean |
Yann Collet | 19cb37f | 2018-01-16 11:40:42 -0800 | [diff] [blame] | 256 | $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=memory -fno-omit-frame-pointer -Werror" HAVE_LZMA=0 # datagen.c fails this test for no obvious reason |
Yann Collet | d996743 | 2016-05-18 14:16:49 +0200 | [diff] [blame] | 257 | |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 258 | msan-%: clean |
Yann Collet | 19cb37f | 2018-01-16 11:40:42 -0800 | [diff] [blame] | 259 | LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=memory -fno-omit-frame-pointer -Werror" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) HAVE_LZMA=0 $* |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 260 | |
Yann Collet | 6c3e2e7 | 2015-12-11 10:44:07 +0100 | [diff] [blame] | 261 | asan32: clean |
inikep | 2d5eb2b | 2016-08-18 13:53:26 +0200 | [diff] [blame] | 262 | $(MAKE) -C $(TESTDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address" |
Yann Collet | 6c3e2e7 | 2015-12-11 10:44:07 +0100 | [diff] [blame] | 263 | |
Yann Collet | 83fae97 | 2015-10-23 15:21:53 +0100 | [diff] [blame] | 264 | uasan: clean |
Yann Collet | 19cb37f | 2018-01-16 11:40:42 -0800 | [diff] [blame] | 265 | $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined -Werror" |
Yann Collet | 83fae97 | 2015-10-23 15:21:53 +0100 | [diff] [blame] | 266 | |
Przemyslaw Skibinski | 8a51c69 | 2017-02-21 22:48:04 +0100 | [diff] [blame] | 267 | uasan-%: clean |
Yann Collet | 19cb37f | 2018-01-16 11:40:42 -0800 | [diff] [blame] | 268 | LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined -Werror" $(MAKE) -C $(TESTDIR) $* |
Przemyslaw Skibinski | 8a51c69 | 2017-02-21 22:48:04 +0100 | [diff] [blame] | 269 | |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 270 | tsan-%: clean |
Yann Collet | 19cb37f | 2018-01-16 11:40:42 -0800 | [diff] [blame] | 271 | LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=thread -Werror" $(MAKE) -C $(TESTDIR) $* FUZZER_FLAGS=--no-big-tests |
Yann Collet | bfc2f00 | 2017-06-21 17:57:14 -0700 | [diff] [blame] | 272 | |
Przemyslaw Skibinski | 21911ad | 2017-02-22 08:54:56 +0100 | [diff] [blame] | 273 | apt-install: |
| 274 | sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install $(APT_PACKAGES) |
| 275 | |
| 276 | apt-add-repo: |
| 277 | sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test |
| 278 | sudo apt-get update -y -qq |
| 279 | |
| 280 | ppcinstall: |
| 281 | APT_PACKAGES="qemu-system-ppc qemu-user-static gcc-powerpc-linux-gnu" $(MAKE) apt-install |
| 282 | |
| 283 | arminstall: |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 284 | APT_PACKAGES="qemu-system-arm qemu-user-static gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross" $(MAKE) apt-install |
Przemyslaw Skibinski | 21911ad | 2017-02-22 08:54:56 +0100 | [diff] [blame] | 285 | |
Yann Collet | 27526c7 | 2017-03-01 17:02:49 -0800 | [diff] [blame] | 286 | valgrindinstall: |
Przemyslaw Skibinski | 21911ad | 2017-02-22 08:54:56 +0100 | [diff] [blame] | 287 | APT_PACKAGES="valgrind" $(MAKE) apt-install |
| 288 | |
| 289 | libc6install: |
| 290 | APT_PACKAGES="libc6-dev-i386 gcc-multilib" $(MAKE) apt-install |
| 291 | |
| 292 | gcc6install: apt-add-repo |
| 293 | APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-6 gcc-6-multilib" $(MAKE) apt-install |
| 294 | |
Yann Collet | 19cb37f | 2018-01-16 11:40:42 -0800 | [diff] [blame] | 295 | gcc7install: apt-add-repo |
| 296 | APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-7 gcc-7-multilib" $(MAKE) apt-install |
| 297 | |
Przemyslaw Skibinski | 21911ad | 2017-02-22 08:54:56 +0100 | [diff] [blame] | 298 | gpp6install: apt-add-repo |
| 299 | APT_PACKAGES="libc6-dev-i386 g++-multilib gcc-6 g++-6 g++-6-multilib" $(MAKE) apt-install |
| 300 | |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 301 | clang38install: |
| 302 | APT_PACKAGES="clang-3.8" $(MAKE) apt-install |
| 303 | |
W. Felix Handte | 5705d9f | 2017-09-21 17:30:43 -0700 | [diff] [blame] | 304 | # Ubuntu 14.04 ships a too-old lz4 |
| 305 | lz4install: |
| 306 | [ -e lz4 ] || git clone https://github.com/lz4/lz4 && sudo $(MAKE) -C lz4 install |
| 307 | |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 308 | endif |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 309 | |
| 310 | |
| 311 | ifneq (,$(filter MSYS%,$(shell uname))) |
| 312 | HOST_OS = MSYS |
Milan Ševčík | 0d09c77 | 2017-03-20 15:57:08 +0100 | [diff] [blame] | 313 | CMAKE_PARAMS = -G"MSYS Makefiles" -DZSTD_MULTITHREAD_SUPPORT:BOOL=OFF -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 314 | endif |
| 315 | |
| 316 | |
| 317 | #------------------------------------------------------------------------ |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 318 | # target specific tests |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 319 | #------------------------------------------------------------------------ |
| 320 | ifneq (,$(filter $(HOST_OS),MSYS POSIX)) |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 321 | cmakebuild: |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 322 | cmake --version |
Yann Collet | 0704df3 | 2016-09-19 16:55:35 +0200 | [diff] [blame] | 323 | $(RM) -r $(BUILDIR)/cmake/build |
| 324 | mkdir $(BUILDIR)/cmake/build |
Milan Ševčík | a8c0c2a | 2017-03-16 22:59:11 +0100 | [diff] [blame] | 325 | cd $(BUILDIR)/cmake/build ; cmake -DCMAKE_INSTALL_PREFIX:PATH=~/install_test_dir $(CMAKE_PARAMS) .. ; $(MAKE) install ; $(MAKE) uninstall |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 326 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 327 | c90build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 328 | $(CC) -v |
Yann Collet | 88ba647 | 2017-02-22 10:52:36 -0800 | [diff] [blame] | 329 | CFLAGS="-std=c90" $(MAKE) allmost # will fail, due to missing support for `long long` |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 330 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 331 | gnu90build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 332 | $(CC) -v |
Yann Collet | 88ba647 | 2017-02-22 10:52:36 -0800 | [diff] [blame] | 333 | CFLAGS="-std=gnu90" $(MAKE) allmost |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 334 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 335 | c99build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 336 | $(CC) -v |
Yann Collet | a86a09e | 2016-12-22 11:31:39 +0100 | [diff] [blame] | 337 | CFLAGS="-std=c99" $(MAKE) allmost |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 338 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 339 | gnu99build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 340 | $(CC) -v |
Yann Collet | 88ba647 | 2017-02-22 10:52:36 -0800 | [diff] [blame] | 341 | CFLAGS="-std=gnu99" $(MAKE) allmost |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 342 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 343 | c11build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 344 | $(CC) -v |
Yann Collet | a86a09e | 2016-12-22 11:31:39 +0100 | [diff] [blame] | 345 | CFLAGS="-std=c11" $(MAKE) allmost |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 346 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 347 | bmix64build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 348 | $(CC) -v |
inikep | 2d5eb2b | 2016-08-18 13:53:26 +0200 | [diff] [blame] | 349 | CFLAGS="-O3 -mbmi -Werror" $(MAKE) -C $(TESTDIR) test |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 350 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 351 | bmix32build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 352 | $(CC) -v |
inikep | 2d5eb2b | 2016-08-18 13:53:26 +0200 | [diff] [blame] | 353 | CFLAGS="-O3 -mbmi -mx32 -Werror" $(MAKE) -C $(TESTDIR) test |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 354 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 355 | bmi32build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 356 | $(CC) -v |
inikep | 2d5eb2b | 2016-08-18 13:53:26 +0200 | [diff] [blame] | 357 | CFLAGS="-O3 -mbmi -m32 -Werror" $(MAKE) -C $(TESTDIR) test |
Yann Collet | c35cd5b | 2016-06-30 15:40:28 +0200 | [diff] [blame] | 358 | |
| 359 | staticAnalyze: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 360 | $(CC) -v |
Yann Collet | 677ed26 | 2016-07-10 14:23:30 +0200 | [diff] [blame] | 361 | CPPFLAGS=-g scan-build --status-bugs -v $(MAKE) all |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 362 | endif |