blob: f2487c59113cdedd25efa21d58f5f28b5a9cd49e [file] [log] [blame]
Yann Collet4856a002015-01-24 01:58:16 +01001# ################################################################
Yann Collete9dc2042017-08-31 11:24:54 -07002# Copyright (c) 2015-present, Yann Collet, Facebook, Inc.
Yann Collet4856a002015-01-24 01:58:16 +01003# All rights reserved.
Yann Collet118bfc42016-05-30 18:50:28 +02004#
Yann Collete9dc2042017-08-31 11:24:54 -07005# 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 Collet4856a002015-01-24 01:58:16 +01008# ################################################################
9
Yann Collet4c9a4c12016-09-19 14:58:14 +020010PRGDIR = programs
11ZSTDDIR = lib
12BUILDIR = build
inikepe9dfdf62016-05-27 11:56:15 +020013ZWRAPDIR = zlibWrapper
inikepa1c81152016-08-18 13:35:36 +020014TESTDIR = tests
Nick Terrell6bb781e2017-09-25 13:29:50 -070015FUZZDIR = $(TESTDIR)/fuzz
Yann Collet4856a002015-01-24 01:58:16 +010016
Yann Collet88fcd292015-11-25 14:42:45 +010017# Define nul output
Yann Collet88fcd292015-11-25 14:42:45 +010018VOID = /dev/null
Przemyslaw Skibinski3a415592016-11-03 12:59:20 +010019
20ifneq (,$(filter Windows%,$(OS)))
21EXT =.exe
22else
23EXT =
Yann Collet88fcd292015-11-25 14:42:45 +010024endif
25
Yann Colletf3f13212016-11-02 17:02:45 -070026.PHONY: default
Yann Collet8b1d0042017-03-05 21:17:32 -080027default: lib-release zstd-release
Yann Collet213089c2015-06-18 07:43:16 -080028
Yann Colletf3f13212016-11-02 17:02:45 -070029.PHONY: all
Yann Collet77575772017-02-22 01:10:43 -080030all: | allmost examples manual
Yann Colleta86a09e2016-12-22 11:31:39 +010031
32.PHONY: allmost
Yann Collet8e298382017-08-31 14:30:52 -070033allmost: allzstd
Yann Collet7cedbd12016-12-22 12:43:00 +010034 $(MAKE) -C $(ZWRAPDIR) all
35
Sean Purcell3437bf22017-03-01 16:10:26 -080036#skip zwrapper, can't build that on alternate architectures without the proper zlib installed
Yann Collet8e298382017-08-31 14:30:52 -070037.PHONY: allzstd
38allzstd:
Sean Purcell3437bf22017-03-01 16:10:26 -080039 $(MAKE) -C $(ZSTDDIR) all
40 $(MAKE) -C $(PRGDIR) all
41 $(MAKE) -C $(TESTDIR) all
42
Yann Collet7cedbd12016-12-22 12:43:00 +010043.PHONY: all32
44all32:
45 $(MAKE) -C $(PRGDIR) zstd32
46 $(MAKE) -C $(TESTDIR) all32
Yann Collet4856a002015-01-24 01:58:16 +010047
Yann Colletf3f13212016-11-02 17:02:45 -070048.PHONY: lib
49lib:
Yann Collet8b1d0042017-03-05 21:17:32 -080050 @$(MAKE) -C $(ZSTDDIR) $@
51
52.PHONY: lib-release
53lib-release:
Yann Collete19111c2016-10-12 11:09:36 -070054 @$(MAKE) -C $(ZSTDDIR)
55
Yann Colletd41380e2016-11-07 14:55:12 -080056.PHONY: zstd
Yann Collet32faf6c2016-07-22 04:45:06 +020057zstd:
Yann Colletd41380e2016-11-07 14:55:12 -080058 @$(MAKE) -C $(PRGDIR) $@
Przemyslaw Skibinski3a415592016-11-03 12:59:20 +010059 cp $(PRGDIR)/zstd$(EXT) .
Yann Collet4856a002015-01-24 01:58:16 +010060
Yann Colletc2a46322017-02-02 20:54:14 -080061.PHONY: zstd-release
62zstd-release:
63 @$(MAKE) -C $(PRGDIR)
64 cp $(PRGDIR)/zstd$(EXT) .
65
Yann Collet563ef8a2017-01-18 12:12:10 -080066.PHONY: zstdmt
67zstdmt:
68 @$(MAKE) -C $(PRGDIR) $@
69 cp $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT)
70
Yann Colletf3f13212016-11-02 17:02:45 -070071.PHONY: zlibwrapper
inikepe9dfdf62016-05-27 11:56:15 +020072zlibwrapper:
inikep68cd4762016-09-23 12:42:21 +020073 $(MAKE) -C $(ZWRAPDIR) test
inikepe9dfdf62016-05-27 11:56:15 +020074
W. Felix Handtee2bf70e2017-10-17 16:02:39 -040075.PHONY: check
76check: shortest
77
Yann Colletceda7a92017-07-21 11:44:39 -070078.PHONY: test shortest
79test shortest:
Yann Collet166645e2017-08-18 18:30:41 -070080 $(MAKE) -C $(PRGDIR) allVariants
inikepa1c81152016-08-18 13:35:36 +020081 $(MAKE) -C $(TESTDIR) $@
Yann Collet6f9c0562016-05-01 10:26:30 +020082
Yann Collet77575772017-02-22 01:10:43 -080083.PHONY: examples
84examples:
85 CPPFLAGS=-I../lib LDFLAGS=-L../lib $(MAKE) -C examples/ all
86
87.PHONY: manual
88manual:
89 $(MAKE) -C contrib/gen_html $@
90
Yann Collet6851db42017-03-30 12:42:44 -070091.PHONY: cleanTabs
92cleanTabs:
93 cd contrib; ./cleanTabs
94
Yann Colletf3f13212016-11-02 17:02:45 -070095.PHONY: clean
Yann Collet4856a002015-01-24 01:58:16 +010096clean:
Yann Collet88fcd292015-11-25 14:42:45 +010097 @$(MAKE) -C $(ZSTDDIR) $@ > $(VOID)
98 @$(MAKE) -C $(PRGDIR) $@ > $(VOID)
inikepa1c81152016-08-18 13:35:36 +020099 @$(MAKE) -C $(TESTDIR) $@ > $(VOID)
inikepe9dfdf62016-05-27 11:56:15 +0200100 @$(MAKE) -C $(ZWRAPDIR) $@ > $(VOID)
Yann Collet1f57c2e2016-12-21 16:20:11 +0100101 @$(MAKE) -C examples/ $@ > $(VOID)
Yann Collet88ba6472017-02-22 10:52:36 -0800102 @$(MAKE) -C contrib/gen_html $@ > $(VOID)
Yann Collet900f39e2017-01-20 16:36:29 -0800103 @$(RM) zstd$(EXT) zstdmt$(EXT) tmp*
W. Felix Handte5705d9f2017-09-21 17:30:43 -0700104 @$(RM) -r lz4
Yann Collet4856a002015-01-24 01:58:16 +0100105 @echo Cleaning completed
106
Yann Collete405c7a2016-10-12 15:29:22 -0700107#------------------------------------------------------------------------------
108# make install is validated only for Linux, OSX, Hurd and some BSD targets
109#------------------------------------------------------------------------------
cyan49738bcbf422017-06-04 23:52:00 -0700110ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD DragonFly NetBSD MSYS_NT))
Yann Colletb402f1e2017-04-18 14:34:24 -0700111
inikep13f42d92016-06-01 14:44:31 +0200112HOST_OS = POSIX
Milan Ševčíkf49f7602017-04-19 19:25:53 +0200113CMAKE_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 Colletf3f13212016-11-02 17:02:45 -0700114
Yann Colletb402f1e2017-04-18 14:34:24 -0700115.PHONY: list
116list:
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 Collet763f8b52017-09-27 12:09:52 -0700119.PHONY: install clangtest armtest usan asan uasan
Yann Collet4856a002015-01-24 01:58:16 +0100120install:
Yann Collete19111c2016-10-12 11:09:36 -0700121 @$(MAKE) -C $(ZSTDDIR) $@
122 @$(MAKE) -C $(PRGDIR) $@
Yann Collet4856a002015-01-24 01:58:16 +0100123
Yann Colletafb0aca2017-06-29 18:19:09 -0700124.PHONY: uninstall
Yann Collet4856a002015-01-24 01:58:16 +0100125uninstall:
Yann Collete19111c2016-10-12 11:09:36 -0700126 @$(MAKE) -C $(ZSTDDIR) $@
127 @$(MAKE) -C $(PRGDIR) $@
Yann Collet4856a002015-01-24 01:58:16 +0100128
Yann Colletafb0aca2017-06-29 18:19:09 -0700129.PHONY: travis-install
Yann Collet4856a002015-01-24 01:58:16 +0100130travis-install:
Yann Colletc620b482015-12-01 01:56:02 +0100131 $(MAKE) install PREFIX=~/install_test_dir
Yann Collet4856a002015-01-24 01:58:16 +0100132
Yann Colletafb0aca2017-06-29 18:19:09 -0700133.PHONY: gppbuild
Sean Purcell3437bf22017-03-01 16:10:26 -0800134gppbuild: clean
135 g++ -v
Yann Collet5eb749e2017-01-11 18:21:25 +0100136 CC=g++ $(MAKE) -C programs all CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror"
Yann Collet3e5b73b2016-01-10 20:46:20 +0100137
Yann Colletafb0aca2017-06-29 18:19:09 -0700138.PHONY: gcc5build
Sean Purcell3437bf22017-03-01 16:10:26 -0800139gcc5build: clean
140 gcc-5 -v
141 CC=gcc-5 $(MAKE) all MOREFLAGS="-Werror"
142
Yann Colletafb0aca2017-06-29 18:19:09 -0700143.PHONY: gcc6build
Sean Purcell3437bf22017-03-01 16:10:26 -0800144gcc6build: clean
145 gcc-6 -v
146 CC=gcc-6 $(MAKE) all MOREFLAGS="-Werror"
147
Nick Terrell9ba97182017-08-08 12:32:26 -0700148.PHONY: gcc7build
149gcc7build: clean
150 gcc-7 -v
151 CC=gcc-7 $(MAKE) all MOREFLAGS="-Werror"
152
Yann Colletafb0aca2017-06-29 18:19:09 -0700153.PHONY: clangbuild
Sean Purcell3437bf22017-03-01 16:10:26 -0800154clangbuild: clean
155 clang -v
156 CXX=clang++ CC=clang $(MAKE) all MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation"
157
158m32build: clean
159 gcc -v
160 $(MAKE) all32
161
162armbuild: clean
Yann Collet8e298382017-08-31 14:30:52 -0700163 CC=arm-linux-gnueabi-gcc CFLAGS="-Werror" $(MAKE) allzstd
Sean Purcell3437bf22017-03-01 16:10:26 -0800164
165aarch64build: clean
Yann Collet8e298382017-08-31 14:30:52 -0700166 CC=aarch64-linux-gnu-gcc CFLAGS="-Werror" $(MAKE) allzstd
Sean Purcell3437bf22017-03-01 16:10:26 -0800167
168ppcbuild: clean
Yann Collet8e298382017-08-31 14:30:52 -0700169 CC=powerpc-linux-gnu-gcc CLAGS="-m32 -Wno-attributes -Werror" $(MAKE) allzstd
Sean Purcell3437bf22017-03-01 16:10:26 -0800170
171ppc64build: clean
Yann Collet8e298382017-08-31 14:30:52 -0700172 CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) allzstd
Sean Purcell3437bf22017-03-01 16:10:26 -0800173
Sean Purcelldaec40d2017-03-07 12:08:15 -0800174armfuzz: clean
Sean Purcell0b0b10e2017-03-20 11:32:24 -0700175 CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
Sean Purcelldaec40d2017-03-07 12:08:15 -0800176
177aarch64fuzz: clean
Sean Purcell0b0b10e2017-03-20 11:32:24 -0700178 CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
Sean Purcelldaec40d2017-03-07 12:08:15 -0800179
180ppcfuzz: clean
Sean Purcell0b0b10e2017-03-20 11:32:24 -0700181 CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
Sean Purcelldaec40d2017-03-07 12:08:15 -0800182
183ppc64fuzz: clean
Sean Purcell0b0b10e2017-03-20 11:32:24 -0700184 CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
Sean Purcelldaec40d2017-03-07 12:08:15 -0800185
Yann Collet60ca44b2017-09-27 12:24:13 -0700186.PHONY: cxxtest
187cxxtest: CXXFLAGS += -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror
188cxxtest: clean
Yann Collet763f8b52017-09-27 12:09:52 -0700189 $(MAKE) -C $(PRGDIR) all CC="$(CXX) -Wno-deprecated" CFLAGS="$(CXXFLAGS)" # adding -Wno-deprecated to avoid clang++ warning on dealing with C files directly
Sean Purcell3437bf22017-03-01 16:10:26 -0800190
inikepc9bb1022016-06-21 18:04:13 +0200191gcc5test: clean
192 gcc-5 -v
193 $(MAKE) all CC=gcc-5 MOREFLAGS="-Werror"
194
195gcc6test: clean
196 gcc-6 -v
197 $(MAKE) all CC=gcc-6 MOREFLAGS="-Werror"
198
Yann Collet213089c2015-06-18 07:43:16 -0800199clangtest: clean
Yann Colletf4ce8912015-08-11 14:18:45 +0100200 clang -v
Sean Purcell3437bf22017-03-01 16:10:26 -0800201 $(MAKE) all CXX=clang-++ CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation"
Yann Collet213089c2015-06-18 07:43:16 -0800202
Yann Collet7083b8a2015-07-06 23:58:59 -0800203armtest: clean
inikep2d5eb2b2016-08-18 13:53:26 +0200204 $(MAKE) -C $(TESTDIR) datagen # use native, faster
Sean Purcell0b0b10e2017-03-20 11:32:24 -0700205 $(MAKE) -C $(TESTDIR) test CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static" FUZZER_FLAGS=--no-big-tests
Przemyslaw Skibinskie579ab52016-11-14 12:57:05 +0100206
207aarch64test:
208 $(MAKE) -C $(TESTDIR) datagen # use native, faster
Sean Purcell0b0b10e2017-03-20 11:32:24 -0700209 $(MAKE) -C $(TESTDIR) test CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static" FUZZER_FLAGS=--no-big-tests
Yann Collet521b0102016-02-08 01:27:59 +0100210
Yann Collet521b0102016-02-08 01:27:59 +0100211ppctest: clean
inikep2d5eb2b2016-08-18 13:53:26 +0200212 $(MAKE) -C $(TESTDIR) datagen # use native, faster
Sean Purcell0b0b10e2017-03-20 11:32:24 -0700213 $(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 Collet521b0102016-02-08 01:27:59 +0100214
inikep1981d5a2016-05-30 10:18:56 +0200215ppc64test: clean
inikep2d5eb2b2016-08-18 13:53:26 +0200216 $(MAKE) -C $(TESTDIR) datagen # use native, faster
Sean Purcell0b0b10e2017-03-20 11:32:24 -0700217 $(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests
inikep1981d5a2016-05-30 10:18:56 +0200218
Przemyslaw Skibinskid41c0482017-02-22 11:07:28 +0100219arm-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 Terrell6bb781e2017-09-25 13:29:50 -0700225regressiontest:
226 $(MAKE) -C $(FUZZDIR) regressiontest
227
228uasanregressiontest:
229 $(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=address,undefined" CXXFLAGS="-O3 -fsanitize=address,undefined"
230
231msanregressiontest:
232 $(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=memory" CXXFLAGS="-O3 -fsanitize=memory"
233
Sean Purcellcaf0ee82017-03-09 17:28:08 -0800234# 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 Collet83fae972015-10-23 15:21:53 +0100238usan: clean
Sean Purcellcaf0ee82017-03-09 17:28:08 -0800239 $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=undefined"
Yann Collet213089c2015-06-18 07:43:16 -0800240
Yann Collet83fae972015-10-23 15:21:53 +0100241asan: clean
242 $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address"
243
Sean Purcellcaf0ee82017-03-09 17:28:08 -0800244asan-%: clean
245 LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=address" $(MAKE) -C $(TESTDIR) $*
246
Yann Colletd9967432016-05-18 14:16:49 +0200247msan: clean
Nick Terrellc2edb782017-06-26 18:57:04 -0700248 $(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 Colletd9967432016-05-18 14:16:49 +0200249
Sean Purcelldaec40d2017-03-07 12:08:15 -0800250msan-%: clean
Yann Colletafb0aca2017-06-29 18:19:09 -0700251 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 Purcelldaec40d2017-03-07 12:08:15 -0800252
Yann Collet6c3e2e72015-12-11 10:44:07 +0100253asan32: clean
inikep2d5eb2b2016-08-18 13:53:26 +0200254 $(MAKE) -C $(TESTDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address"
Yann Collet6c3e2e72015-12-11 10:44:07 +0100255
Yann Collet83fae972015-10-23 15:21:53 +0100256uasan: clean
Sean Purcellcaf0ee82017-03-09 17:28:08 -0800257 $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined"
Yann Collet83fae972015-10-23 15:21:53 +0100258
Przemyslaw Skibinski8a51c692017-02-21 22:48:04 +0100259uasan-%: clean
Yann Colletafb0aca2017-06-29 18:19:09 -0700260 LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined" $(MAKE) -C $(TESTDIR) $*
Przemyslaw Skibinski8a51c692017-02-21 22:48:04 +0100261
Sean Purcelldaec40d2017-03-07 12:08:15 -0800262tsan-%: clean
Yann Colletbfc2f002017-06-21 17:57:14 -0700263 LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=thread" $(MAKE) -C $(TESTDIR) $* FUZZER_FLAGS=--no-big-tests
264
Przemyslaw Skibinski21911ad2017-02-22 08:54:56 +0100265apt-install:
266 sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install $(APT_PACKAGES)
267
268apt-add-repo:
269 sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
270 sudo apt-get update -y -qq
271
272ppcinstall:
273 APT_PACKAGES="qemu-system-ppc qemu-user-static gcc-powerpc-linux-gnu" $(MAKE) apt-install
274
275arminstall:
Sean Purcelldaec40d2017-03-07 12:08:15 -0800276 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 Skibinski21911ad2017-02-22 08:54:56 +0100277
Yann Collet27526c72017-03-01 17:02:49 -0800278valgrindinstall:
Przemyslaw Skibinski21911ad2017-02-22 08:54:56 +0100279 APT_PACKAGES="valgrind" $(MAKE) apt-install
280
281libc6install:
282 APT_PACKAGES="libc6-dev-i386 gcc-multilib" $(MAKE) apt-install
283
284gcc6install: apt-add-repo
285 APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-6 gcc-6-multilib" $(MAKE) apt-install
286
287gpp6install: apt-add-repo
288 APT_PACKAGES="libc6-dev-i386 g++-multilib gcc-6 g++-6 g++-6-multilib" $(MAKE) apt-install
289
Sean Purcelldaec40d2017-03-07 12:08:15 -0800290clang38install:
291 APT_PACKAGES="clang-3.8" $(MAKE) apt-install
292
W. Felix Handte5705d9f2017-09-21 17:30:43 -0700293# Ubuntu 14.04 ships a too-old lz4
294lz4install:
295 [ -e lz4 ] || git clone https://github.com/lz4/lz4 && sudo $(MAKE) -C lz4 install
296
Yann Collet4856a002015-01-24 01:58:16 +0100297endif
inikep13f42d92016-06-01 14:44:31 +0200298
299
300ifneq (,$(filter MSYS%,$(shell uname)))
301HOST_OS = MSYS
Milan Ševčík0d09c772017-03-20 15:57:08 +0100302CMAKE_PARAMS = -G"MSYS Makefiles" -DZSTD_MULTITHREAD_SUPPORT:BOOL=OFF -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON
inikep13f42d92016-06-01 14:44:31 +0200303endif
304
305
306#------------------------------------------------------------------------
Yann Colletbc32b402017-09-27 17:27:38 -0700307# target specific tests
inikep13f42d92016-06-01 14:44:31 +0200308#------------------------------------------------------------------------
309ifneq (,$(filter $(HOST_OS),MSYS POSIX))
Sean Purcell3437bf22017-03-01 16:10:26 -0800310cmakebuild:
inikep13f42d92016-06-01 14:44:31 +0200311 cmake --version
Yann Collet0704df32016-09-19 16:55:35 +0200312 $(RM) -r $(BUILDIR)/cmake/build
313 mkdir $(BUILDIR)/cmake/build
Milan Ševčíka8c0c2a2017-03-16 22:59:11 +0100314 cd $(BUILDIR)/cmake/build ; cmake -DCMAKE_INSTALL_PREFIX:PATH=~/install_test_dir $(CMAKE_PARAMS) .. ; $(MAKE) install ; $(MAKE) uninstall
inikep13f42d92016-06-01 14:44:31 +0200315
Sean Purcell3437bf22017-03-01 16:10:26 -0800316c90build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700317 $(CC) -v
Yann Collet88ba6472017-02-22 10:52:36 -0800318 CFLAGS="-std=c90" $(MAKE) allmost # will fail, due to missing support for `long long`
inikep13f42d92016-06-01 14:44:31 +0200319
Sean Purcell3437bf22017-03-01 16:10:26 -0800320gnu90build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700321 $(CC) -v
Yann Collet88ba6472017-02-22 10:52:36 -0800322 CFLAGS="-std=gnu90" $(MAKE) allmost
inikep13f42d92016-06-01 14:44:31 +0200323
Sean Purcell3437bf22017-03-01 16:10:26 -0800324c99build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700325 $(CC) -v
Yann Colleta86a09e2016-12-22 11:31:39 +0100326 CFLAGS="-std=c99" $(MAKE) allmost
inikep13f42d92016-06-01 14:44:31 +0200327
Sean Purcell3437bf22017-03-01 16:10:26 -0800328gnu99build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700329 $(CC) -v
Yann Collet88ba6472017-02-22 10:52:36 -0800330 CFLAGS="-std=gnu99" $(MAKE) allmost
inikep13f42d92016-06-01 14:44:31 +0200331
Sean Purcell3437bf22017-03-01 16:10:26 -0800332c11build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700333 $(CC) -v
Yann Colleta86a09e2016-12-22 11:31:39 +0100334 CFLAGS="-std=c11" $(MAKE) allmost
inikep13f42d92016-06-01 14:44:31 +0200335
Sean Purcell3437bf22017-03-01 16:10:26 -0800336bmix64build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700337 $(CC) -v
inikep2d5eb2b2016-08-18 13:53:26 +0200338 CFLAGS="-O3 -mbmi -Werror" $(MAKE) -C $(TESTDIR) test
inikep13f42d92016-06-01 14:44:31 +0200339
Sean Purcell3437bf22017-03-01 16:10:26 -0800340bmix32build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700341 $(CC) -v
inikep2d5eb2b2016-08-18 13:53:26 +0200342 CFLAGS="-O3 -mbmi -mx32 -Werror" $(MAKE) -C $(TESTDIR) test
inikep13f42d92016-06-01 14:44:31 +0200343
Sean Purcell3437bf22017-03-01 16:10:26 -0800344bmi32build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700345 $(CC) -v
inikep2d5eb2b2016-08-18 13:53:26 +0200346 CFLAGS="-O3 -mbmi -m32 -Werror" $(MAKE) -C $(TESTDIR) test
Yann Colletc35cd5b2016-06-30 15:40:28 +0200347
348staticAnalyze: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700349 $(CC) -v
Yann Collet677ed262016-07-10 14:23:30 +0200350 CPPFLAGS=-g scan-build --status-bugs -v $(MAKE) all
inikep13f42d92016-06-01 14:44:31 +0200351endif