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 | 7757577 | 2017-02-22 01:10:43 -0800 | [diff] [blame] | 30 | all: | allmost examples manual |
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 | |
W. Felix Handte | e2bf70e | 2017-10-17 16:02:39 -0400 | [diff] [blame] | 75 | .PHONY: check |
| 76 | check: shortest |
| 77 | |
Yann Collet | ceda7a9 | 2017-07-21 11:44:39 -0700 | [diff] [blame] | 78 | .PHONY: test shortest |
| 79 | test shortest: |
Yann Collet | 166645e | 2017-08-18 18:30:41 -0700 | [diff] [blame] | 80 | $(MAKE) -C $(PRGDIR) allVariants |
inikep | a1c8115 | 2016-08-18 13:35:36 +0200 | [diff] [blame] | 81 | $(MAKE) -C $(TESTDIR) $@ |
Yann Collet | 6f9c056 | 2016-05-01 10:26:30 +0200 | [diff] [blame] | 82 | |
Yann Collet | 7757577 | 2017-02-22 01:10:43 -0800 | [diff] [blame] | 83 | .PHONY: examples |
| 84 | examples: |
| 85 | CPPFLAGS=-I../lib LDFLAGS=-L../lib $(MAKE) -C examples/ all |
| 86 | |
| 87 | .PHONY: manual |
| 88 | manual: |
| 89 | $(MAKE) -C contrib/gen_html $@ |
| 90 | |
Yann Collet | 6851db4 | 2017-03-30 12:42:44 -0700 | [diff] [blame] | 91 | .PHONY: cleanTabs |
| 92 | cleanTabs: |
| 93 | cd contrib; ./cleanTabs |
| 94 | |
Yann Collet | f3f1321 | 2016-11-02 17:02:45 -0700 | [diff] [blame] | 95 | .PHONY: clean |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 96 | clean: |
Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 97 | @$(MAKE) -C $(ZSTDDIR) $@ > $(VOID) |
| 98 | @$(MAKE) -C $(PRGDIR) $@ > $(VOID) |
inikep | a1c8115 | 2016-08-18 13:35:36 +0200 | [diff] [blame] | 99 | @$(MAKE) -C $(TESTDIR) $@ > $(VOID) |
inikep | e9dfdf6 | 2016-05-27 11:56:15 +0200 | [diff] [blame] | 100 | @$(MAKE) -C $(ZWRAPDIR) $@ > $(VOID) |
Yann Collet | 1f57c2e | 2016-12-21 16:20:11 +0100 | [diff] [blame] | 101 | @$(MAKE) -C examples/ $@ > $(VOID) |
Yann Collet | 88ba647 | 2017-02-22 10:52:36 -0800 | [diff] [blame] | 102 | @$(MAKE) -C contrib/gen_html $@ > $(VOID) |
Yann Collet | 900f39e | 2017-01-20 16:36:29 -0800 | [diff] [blame] | 103 | @$(RM) zstd$(EXT) zstdmt$(EXT) tmp* |
W. Felix Handte | 5705d9f | 2017-09-21 17:30:43 -0700 | [diff] [blame] | 104 | @$(RM) -r lz4 |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 105 | @echo Cleaning completed |
| 106 | |
Yann Collet | e405c7a | 2016-10-12 15:29:22 -0700 | [diff] [blame] | 107 | #------------------------------------------------------------------------------ |
| 108 | # make install is validated only for Linux, OSX, Hurd and some BSD targets |
| 109 | #------------------------------------------------------------------------------ |
cyan4973 | 8bcbf42 | 2017-06-04 23:52:00 -0700 | [diff] [blame] | 110 | 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] | 111 | |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 112 | HOST_OS = POSIX |
Milan Ševčík | f49f760 | 2017-04-19 19:25:53 +0200 | [diff] [blame] | 113 | 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] | 114 | |
Yann Collet | b402f1e | 2017-04-18 14:34:24 -0700 | [diff] [blame] | 115 | .PHONY: list |
| 116 | list: |
| 117 | @$(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 |
| 118 | |
Yann Collet | 763f8b5 | 2017-09-27 12:09:52 -0700 | [diff] [blame] | 119 | .PHONY: install clangtest armtest usan asan uasan |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 120 | install: |
Yann Collet | e19111c | 2016-10-12 11:09:36 -0700 | [diff] [blame] | 121 | @$(MAKE) -C $(ZSTDDIR) $@ |
| 122 | @$(MAKE) -C $(PRGDIR) $@ |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 123 | |
Yann Collet | afb0aca | 2017-06-29 18:19:09 -0700 | [diff] [blame] | 124 | .PHONY: uninstall |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 125 | uninstall: |
Yann Collet | e19111c | 2016-10-12 11:09:36 -0700 | [diff] [blame] | 126 | @$(MAKE) -C $(ZSTDDIR) $@ |
| 127 | @$(MAKE) -C $(PRGDIR) $@ |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 128 | |
Yann Collet | afb0aca | 2017-06-29 18:19:09 -0700 | [diff] [blame] | 129 | .PHONY: travis-install |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 130 | travis-install: |
Yann Collet | c620b48 | 2015-12-01 01:56:02 +0100 | [diff] [blame] | 131 | $(MAKE) install PREFIX=~/install_test_dir |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 132 | |
Yann Collet | afb0aca | 2017-06-29 18:19:09 -0700 | [diff] [blame] | 133 | .PHONY: gppbuild |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 134 | gppbuild: clean |
| 135 | g++ -v |
Yann Collet | 5eb749e | 2017-01-11 18:21:25 +0100 | [diff] [blame] | 136 | CC=g++ $(MAKE) -C programs all CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror" |
Yann Collet | 3e5b73b | 2016-01-10 20:46:20 +0100 | [diff] [blame] | 137 | |
Yann Collet | afb0aca | 2017-06-29 18:19:09 -0700 | [diff] [blame] | 138 | .PHONY: gcc5build |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 139 | gcc5build: clean |
| 140 | gcc-5 -v |
| 141 | CC=gcc-5 $(MAKE) all MOREFLAGS="-Werror" |
| 142 | |
Yann Collet | afb0aca | 2017-06-29 18:19:09 -0700 | [diff] [blame] | 143 | .PHONY: gcc6build |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 144 | gcc6build: clean |
| 145 | gcc-6 -v |
| 146 | CC=gcc-6 $(MAKE) all MOREFLAGS="-Werror" |
| 147 | |
Nick Terrell | 9ba9718 | 2017-08-08 12:32:26 -0700 | [diff] [blame] | 148 | .PHONY: gcc7build |
| 149 | gcc7build: clean |
| 150 | gcc-7 -v |
| 151 | CC=gcc-7 $(MAKE) all MOREFLAGS="-Werror" |
| 152 | |
Yann Collet | afb0aca | 2017-06-29 18:19:09 -0700 | [diff] [blame] | 153 | .PHONY: clangbuild |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 154 | clangbuild: clean |
| 155 | clang -v |
| 156 | CXX=clang++ CC=clang $(MAKE) all MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation" |
| 157 | |
| 158 | m32build: clean |
| 159 | gcc -v |
| 160 | $(MAKE) all32 |
| 161 | |
| 162 | armbuild: clean |
Yann Collet | 8e29838 | 2017-08-31 14:30:52 -0700 | [diff] [blame] | 163 | CC=arm-linux-gnueabi-gcc CFLAGS="-Werror" $(MAKE) allzstd |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 164 | |
| 165 | aarch64build: clean |
Yann Collet | 8e29838 | 2017-08-31 14:30:52 -0700 | [diff] [blame] | 166 | CC=aarch64-linux-gnu-gcc CFLAGS="-Werror" $(MAKE) allzstd |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 167 | |
| 168 | ppcbuild: clean |
Yann Collet | 8e29838 | 2017-08-31 14:30:52 -0700 | [diff] [blame] | 169 | CC=powerpc-linux-gnu-gcc CLAGS="-m32 -Wno-attributes -Werror" $(MAKE) allzstd |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 170 | |
| 171 | ppc64build: clean |
Yann Collet | 8e29838 | 2017-08-31 14:30:52 -0700 | [diff] [blame] | 172 | CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) allzstd |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 173 | |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 174 | armfuzz: clean |
Sean Purcell | 0b0b10e | 2017-03-20 11:32:24 -0700 | [diff] [blame] | 175 | 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] | 176 | |
| 177 | aarch64fuzz: clean |
Sean Purcell | 0b0b10e | 2017-03-20 11:32:24 -0700 | [diff] [blame] | 178 | 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] | 179 | |
| 180 | ppcfuzz: clean |
Sean Purcell | 0b0b10e | 2017-03-20 11:32:24 -0700 | [diff] [blame] | 181 | 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] | 182 | |
| 183 | ppc64fuzz: clean |
Sean Purcell | 0b0b10e | 2017-03-20 11:32:24 -0700 | [diff] [blame] | 184 | 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] | 185 | |
Yann Collet | 60ca44b | 2017-09-27 12:24:13 -0700 | [diff] [blame] | 186 | .PHONY: cxxtest |
| 187 | cxxtest: CXXFLAGS += -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror |
| 188 | cxxtest: clean |
Yann Collet | 763f8b5 | 2017-09-27 12:09:52 -0700 | [diff] [blame] | 189 | $(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] | 190 | |
inikep | c9bb102 | 2016-06-21 18:04:13 +0200 | [diff] [blame] | 191 | gcc5test: clean |
| 192 | gcc-5 -v |
| 193 | $(MAKE) all CC=gcc-5 MOREFLAGS="-Werror" |
| 194 | |
| 195 | gcc6test: clean |
| 196 | gcc-6 -v |
| 197 | $(MAKE) all CC=gcc-6 MOREFLAGS="-Werror" |
| 198 | |
Yann Collet | 213089c | 2015-06-18 07:43:16 -0800 | [diff] [blame] | 199 | clangtest: clean |
Yann Collet | f4ce891 | 2015-08-11 14:18:45 +0100 | [diff] [blame] | 200 | clang -v |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 201 | $(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] | 202 | |
Yann Collet | 7083b8a | 2015-07-06 23:58:59 -0800 | [diff] [blame] | 203 | armtest: clean |
inikep | 2d5eb2b | 2016-08-18 13:53:26 +0200 | [diff] [blame] | 204 | $(MAKE) -C $(TESTDIR) datagen # use native, faster |
Sean Purcell | 0b0b10e | 2017-03-20 11:32:24 -0700 | [diff] [blame] | 205 | $(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] | 206 | |
| 207 | aarch64test: |
| 208 | $(MAKE) -C $(TESTDIR) datagen # use native, faster |
Sean Purcell | 0b0b10e | 2017-03-20 11:32:24 -0700 | [diff] [blame] | 209 | $(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] | 210 | |
Yann Collet | 521b010 | 2016-02-08 01:27:59 +0100 | [diff] [blame] | 211 | ppctest: 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=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] | 214 | |
inikep | 1981d5a | 2016-05-30 10:18:56 +0200 | [diff] [blame] | 215 | ppc64test: clean |
inikep | 2d5eb2b | 2016-08-18 13:53:26 +0200 | [diff] [blame] | 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=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] | 218 | |
Przemyslaw Skibinski | d41c048 | 2017-02-22 11:07:28 +0100 | [diff] [blame] | 219 | arm-ppc-compilation: |
| 220 | $(MAKE) -C $(PRGDIR) clean zstd CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static" |
| 221 | $(MAKE) -C $(PRGDIR) clean zstd CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static" |
| 222 | $(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static" |
| 223 | $(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static" |
| 224 | |
Nick Terrell | 6bb781e | 2017-09-25 13:29:50 -0700 | [diff] [blame] | 225 | regressiontest: |
| 226 | $(MAKE) -C $(FUZZDIR) regressiontest |
| 227 | |
| 228 | uasanregressiontest: |
| 229 | $(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=address,undefined" CXXFLAGS="-O3 -fsanitize=address,undefined" |
| 230 | |
| 231 | msanregressiontest: |
| 232 | $(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=memory" CXXFLAGS="-O3 -fsanitize=memory" |
| 233 | |
Sean Purcell | caf0ee8 | 2017-03-09 17:28:08 -0800 | [diff] [blame] | 234 | # run UBsan with -fsanitize-recover=signed-integer-overflow |
| 235 | # due to a bug in UBsan when doing pointer subtraction |
| 236 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63303 |
| 237 | |
Yann Collet | 83fae97 | 2015-10-23 15:21:53 +0100 | [diff] [blame] | 238 | usan: clean |
Sean Purcell | caf0ee8 | 2017-03-09 17:28:08 -0800 | [diff] [blame] | 239 | $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=undefined" |
Yann Collet | 213089c | 2015-06-18 07:43:16 -0800 | [diff] [blame] | 240 | |
Yann Collet | 83fae97 | 2015-10-23 15:21:53 +0100 | [diff] [blame] | 241 | asan: clean |
| 242 | $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address" |
| 243 | |
Sean Purcell | caf0ee8 | 2017-03-09 17:28:08 -0800 | [diff] [blame] | 244 | asan-%: clean |
| 245 | LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=address" $(MAKE) -C $(TESTDIR) $* |
| 246 | |
Yann Collet | d996743 | 2016-05-18 14:16:49 +0200 | [diff] [blame] | 247 | msan: clean |
Nick Terrell | c2edb78 | 2017-06-26 18:57:04 -0700 | [diff] [blame] | 248 | $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=memory -fno-omit-frame-pointer" HAVE_LZMA=0 # datagen.c fails this test for no obvious reason |
Yann Collet | d996743 | 2016-05-18 14:16:49 +0200 | [diff] [blame] | 249 | |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 250 | msan-%: clean |
Yann Collet | afb0aca | 2017-06-29 18:19:09 -0700 | [diff] [blame] | 251 | LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=memory -fno-omit-frame-pointer" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) HAVE_LZMA=0 $* |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 252 | |
Yann Collet | 6c3e2e7 | 2015-12-11 10:44:07 +0100 | [diff] [blame] | 253 | asan32: clean |
inikep | 2d5eb2b | 2016-08-18 13:53:26 +0200 | [diff] [blame] | 254 | $(MAKE) -C $(TESTDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address" |
Yann Collet | 6c3e2e7 | 2015-12-11 10:44:07 +0100 | [diff] [blame] | 255 | |
Yann Collet | 83fae97 | 2015-10-23 15:21:53 +0100 | [diff] [blame] | 256 | uasan: clean |
Sean Purcell | caf0ee8 | 2017-03-09 17:28:08 -0800 | [diff] [blame] | 257 | $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined" |
Yann Collet | 83fae97 | 2015-10-23 15:21:53 +0100 | [diff] [blame] | 258 | |
Przemyslaw Skibinski | 8a51c69 | 2017-02-21 22:48:04 +0100 | [diff] [blame] | 259 | uasan-%: clean |
Yann Collet | afb0aca | 2017-06-29 18:19:09 -0700 | [diff] [blame] | 260 | LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined" $(MAKE) -C $(TESTDIR) $* |
Przemyslaw Skibinski | 8a51c69 | 2017-02-21 22:48:04 +0100 | [diff] [blame] | 261 | |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 262 | tsan-%: clean |
Yann Collet | bfc2f00 | 2017-06-21 17:57:14 -0700 | [diff] [blame] | 263 | LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=thread" $(MAKE) -C $(TESTDIR) $* FUZZER_FLAGS=--no-big-tests |
| 264 | |
Przemyslaw Skibinski | 21911ad | 2017-02-22 08:54:56 +0100 | [diff] [blame] | 265 | apt-install: |
| 266 | sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install $(APT_PACKAGES) |
| 267 | |
| 268 | apt-add-repo: |
| 269 | sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test |
| 270 | sudo apt-get update -y -qq |
| 271 | |
| 272 | ppcinstall: |
| 273 | APT_PACKAGES="qemu-system-ppc qemu-user-static gcc-powerpc-linux-gnu" $(MAKE) apt-install |
| 274 | |
| 275 | arminstall: |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 276 | 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] | 277 | |
Yann Collet | 27526c7 | 2017-03-01 17:02:49 -0800 | [diff] [blame] | 278 | valgrindinstall: |
Przemyslaw Skibinski | 21911ad | 2017-02-22 08:54:56 +0100 | [diff] [blame] | 279 | APT_PACKAGES="valgrind" $(MAKE) apt-install |
| 280 | |
| 281 | libc6install: |
| 282 | APT_PACKAGES="libc6-dev-i386 gcc-multilib" $(MAKE) apt-install |
| 283 | |
| 284 | gcc6install: apt-add-repo |
| 285 | APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-6 gcc-6-multilib" $(MAKE) apt-install |
| 286 | |
| 287 | gpp6install: apt-add-repo |
| 288 | APT_PACKAGES="libc6-dev-i386 g++-multilib gcc-6 g++-6 g++-6-multilib" $(MAKE) apt-install |
| 289 | |
Sean Purcell | daec40d | 2017-03-07 12:08:15 -0800 | [diff] [blame] | 290 | clang38install: |
| 291 | APT_PACKAGES="clang-3.8" $(MAKE) apt-install |
| 292 | |
W. Felix Handte | 5705d9f | 2017-09-21 17:30:43 -0700 | [diff] [blame] | 293 | # Ubuntu 14.04 ships a too-old lz4 |
| 294 | lz4install: |
| 295 | [ -e lz4 ] || git clone https://github.com/lz4/lz4 && sudo $(MAKE) -C lz4 install |
| 296 | |
Yann Collet | 4856a00 | 2015-01-24 01:58:16 +0100 | [diff] [blame] | 297 | endif |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 298 | |
| 299 | |
| 300 | ifneq (,$(filter MSYS%,$(shell uname))) |
| 301 | HOST_OS = MSYS |
Milan Ševčík | 0d09c77 | 2017-03-20 15:57:08 +0100 | [diff] [blame] | 302 | 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] | 303 | endif |
| 304 | |
| 305 | |
| 306 | #------------------------------------------------------------------------ |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 307 | # target specific tests |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 308 | #------------------------------------------------------------------------ |
| 309 | ifneq (,$(filter $(HOST_OS),MSYS POSIX)) |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 310 | cmakebuild: |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 311 | cmake --version |
Yann Collet | 0704df3 | 2016-09-19 16:55:35 +0200 | [diff] [blame] | 312 | $(RM) -r $(BUILDIR)/cmake/build |
| 313 | mkdir $(BUILDIR)/cmake/build |
Milan Ševčík | a8c0c2a | 2017-03-16 22:59:11 +0100 | [diff] [blame] | 314 | 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] | 315 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 316 | c90build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 317 | $(CC) -v |
Yann Collet | 88ba647 | 2017-02-22 10:52:36 -0800 | [diff] [blame] | 318 | 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] | 319 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 320 | gnu90build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 321 | $(CC) -v |
Yann Collet | 88ba647 | 2017-02-22 10:52:36 -0800 | [diff] [blame] | 322 | CFLAGS="-std=gnu90" $(MAKE) allmost |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 323 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 324 | c99build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 325 | $(CC) -v |
Yann Collet | a86a09e | 2016-12-22 11:31:39 +0100 | [diff] [blame] | 326 | CFLAGS="-std=c99" $(MAKE) allmost |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 327 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 328 | gnu99build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 329 | $(CC) -v |
Yann Collet | 88ba647 | 2017-02-22 10:52:36 -0800 | [diff] [blame] | 330 | CFLAGS="-std=gnu99" $(MAKE) allmost |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 331 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 332 | c11build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 333 | $(CC) -v |
Yann Collet | a86a09e | 2016-12-22 11:31:39 +0100 | [diff] [blame] | 334 | CFLAGS="-std=c11" $(MAKE) allmost |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 335 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 336 | bmix64build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 337 | $(CC) -v |
inikep | 2d5eb2b | 2016-08-18 13:53:26 +0200 | [diff] [blame] | 338 | CFLAGS="-O3 -mbmi -Werror" $(MAKE) -C $(TESTDIR) test |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 339 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 340 | bmix32build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 341 | $(CC) -v |
inikep | 2d5eb2b | 2016-08-18 13:53:26 +0200 | [diff] [blame] | 342 | CFLAGS="-O3 -mbmi -mx32 -Werror" $(MAKE) -C $(TESTDIR) test |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 343 | |
Sean Purcell | 3437bf2 | 2017-03-01 16:10:26 -0800 | [diff] [blame] | 344 | bmi32build: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 345 | $(CC) -v |
inikep | 2d5eb2b | 2016-08-18 13:53:26 +0200 | [diff] [blame] | 346 | CFLAGS="-O3 -mbmi -m32 -Werror" $(MAKE) -C $(TESTDIR) test |
Yann Collet | c35cd5b | 2016-06-30 15:40:28 +0200 | [diff] [blame] | 347 | |
| 348 | staticAnalyze: clean |
Yann Collet | bc32b40 | 2017-09-27 17:27:38 -0700 | [diff] [blame] | 349 | $(CC) -v |
Yann Collet | 677ed26 | 2016-07-10 14:23:30 +0200 | [diff] [blame] | 350 | CPPFLAGS=-g scan-build --status-bugs -v $(MAKE) all |
inikep | 13f42d9 | 2016-06-01 14:44:31 +0200 | [diff] [blame] | 351 | endif |