blob: 320fc68071d4eab0bcd9a03947398395d37ad266 [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 Collet97816402018-03-15 16:39:59 -070030all: | allmost examples manual contrib
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
Yann Colletcb5eba82018-01-19 11:26:35 -080075.PHONY: test
76test:
Yann Colletf4e58452018-01-16 11:50:16 -080077 $(MAKE) -C $(PRGDIR) allVariants MOREFLAGS+="-g -DZSTD_DEBUG=1"
inikepa1c81152016-08-18 13:35:36 +020078 $(MAKE) -C $(TESTDIR) $@
Yann Collet6f9c0562016-05-01 10:26:30 +020079
Yann Colletcb5eba82018-01-19 11:26:35 -080080.PHONY: shortest
81shortest:
82 $(MAKE) -C $(TESTDIR) $@
83
84.PHONY: check
85check: shortest
86
Yann Collet77575772017-02-22 01:10:43 -080087.PHONY: examples
88examples:
89 CPPFLAGS=-I../lib LDFLAGS=-L../lib $(MAKE) -C examples/ all
90
91.PHONY: manual
92manual:
93 $(MAKE) -C contrib/gen_html $@
94
Yann Collet97816402018-03-15 16:39:59 -070095.PHONY: contrib
96contrib: lib
97 $(MAKE) -C contrib/pzstd all
98 $(MAKE) -C contrib/seekable_format/examples all
Yann Collet5373e442018-03-15 17:10:15 -070099 $(MAKE) -C contrib/adaptive-compression all
Yann Collet97816402018-03-15 16:39:59 -0700100
Yann Collet6851db42017-03-30 12:42:44 -0700101.PHONY: cleanTabs
102cleanTabs:
103 cd contrib; ./cleanTabs
104
Yann Colletf3f13212016-11-02 17:02:45 -0700105.PHONY: clean
Yann Collet4856a002015-01-24 01:58:16 +0100106clean:
Yann Collet88fcd292015-11-25 14:42:45 +0100107 @$(MAKE) -C $(ZSTDDIR) $@ > $(VOID)
108 @$(MAKE) -C $(PRGDIR) $@ > $(VOID)
inikepa1c81152016-08-18 13:35:36 +0200109 @$(MAKE) -C $(TESTDIR) $@ > $(VOID)
inikepe9dfdf62016-05-27 11:56:15 +0200110 @$(MAKE) -C $(ZWRAPDIR) $@ > $(VOID)
Yann Collet1f57c2e2016-12-21 16:20:11 +0100111 @$(MAKE) -C examples/ $@ > $(VOID)
Yann Collet88ba6472017-02-22 10:52:36 -0800112 @$(MAKE) -C contrib/gen_html $@ > $(VOID)
Yann Collet97816402018-03-15 16:39:59 -0700113 @$(MAKE) -C contrib/pzstd $@ > $(VOID)
114 @$(MAKE) -C contrib/seekable_format/examples $@ > $(VOID)
Yann Collet5373e442018-03-15 17:10:15 -0700115 @$(MAKE) -C contrib/adaptive-compression $@ > $(VOID)
Yann Collet900f39e2017-01-20 16:36:29 -0800116 @$(RM) zstd$(EXT) zstdmt$(EXT) tmp*
W. Felix Handte5705d9f2017-09-21 17:30:43 -0700117 @$(RM) -r lz4
Yann Collet4856a002015-01-24 01:58:16 +0100118 @echo Cleaning completed
119
Yann Collete405c7a2016-10-12 15:29:22 -0700120#------------------------------------------------------------------------------
121# make install is validated only for Linux, OSX, Hurd and some BSD targets
122#------------------------------------------------------------------------------
cyan49738bcbf422017-06-04 23:52:00 -0700123ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD DragonFly NetBSD MSYS_NT))
Yann Colletb402f1e2017-04-18 14:34:24 -0700124
inikep13f42d92016-06-01 14:44:31 +0200125HOST_OS = POSIX
Milan Ševčíkf49f7602017-04-19 19:25:53 +0200126CMAKE_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 -0700127
Yann Colletb402f1e2017-04-18 14:34:24 -0700128.PHONY: list
129list:
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 Collet763f8b52017-09-27 12:09:52 -0700132.PHONY: install clangtest armtest usan asan uasan
Yann Collet4856a002015-01-24 01:58:16 +0100133install:
Yann Collete19111c2016-10-12 11:09:36 -0700134 @$(MAKE) -C $(ZSTDDIR) $@
135 @$(MAKE) -C $(PRGDIR) $@
Yann Collet4856a002015-01-24 01:58:16 +0100136
Yann Colletafb0aca2017-06-29 18:19:09 -0700137.PHONY: uninstall
Yann Collet4856a002015-01-24 01:58:16 +0100138uninstall:
Yann Collete19111c2016-10-12 11:09:36 -0700139 @$(MAKE) -C $(ZSTDDIR) $@
140 @$(MAKE) -C $(PRGDIR) $@
Yann Collet4856a002015-01-24 01:58:16 +0100141
Yann Colletafb0aca2017-06-29 18:19:09 -0700142.PHONY: travis-install
Yann Collet4856a002015-01-24 01:58:16 +0100143travis-install:
Yann Colletc620b482015-12-01 01:56:02 +0100144 $(MAKE) install PREFIX=~/install_test_dir
Yann Collet4856a002015-01-24 01:58:16 +0100145
Yann Colletafb0aca2017-06-29 18:19:09 -0700146.PHONY: gcc5build
Sean Purcell3437bf22017-03-01 16:10:26 -0800147gcc5build: clean
148 gcc-5 -v
149 CC=gcc-5 $(MAKE) all MOREFLAGS="-Werror"
150
Yann Colletafb0aca2017-06-29 18:19:09 -0700151.PHONY: gcc6build
Sean Purcell3437bf22017-03-01 16:10:26 -0800152gcc6build: clean
153 gcc-6 -v
154 CC=gcc-6 $(MAKE) all MOREFLAGS="-Werror"
155
Nick Terrell9ba97182017-08-08 12:32:26 -0700156.PHONY: gcc7build
157gcc7build: clean
158 gcc-7 -v
159 CC=gcc-7 $(MAKE) all MOREFLAGS="-Werror"
160
Yann Colletafb0aca2017-06-29 18:19:09 -0700161.PHONY: clangbuild
Sean Purcell3437bf22017-03-01 16:10:26 -0800162clangbuild: clean
163 clang -v
164 CXX=clang++ CC=clang $(MAKE) all MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation"
165
166m32build: clean
167 gcc -v
168 $(MAKE) all32
169
170armbuild: clean
Yann Collet8e298382017-08-31 14:30:52 -0700171 CC=arm-linux-gnueabi-gcc CFLAGS="-Werror" $(MAKE) allzstd
Sean Purcell3437bf22017-03-01 16:10:26 -0800172
173aarch64build: clean
Yann Collet8e298382017-08-31 14:30:52 -0700174 CC=aarch64-linux-gnu-gcc CFLAGS="-Werror" $(MAKE) allzstd
Sean Purcell3437bf22017-03-01 16:10:26 -0800175
176ppcbuild: clean
Yann Colletc6f5bf02017-12-01 17:35:19 -0800177 CC=powerpc-linux-gnu-gcc CFLAGS="-m32 -Wno-attributes -Werror" $(MAKE) allzstd
Sean Purcell3437bf22017-03-01 16:10:26 -0800178
179ppc64build: clean
Yann Collet8e298382017-08-31 14:30:52 -0700180 CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) allzstd
Sean Purcell3437bf22017-03-01 16:10:26 -0800181
Sean Purcelldaec40d2017-03-07 12:08:15 -0800182armfuzz: clean
Sean Purcell0b0b10e2017-03-20 11:32:24 -0700183 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 -0800184
185aarch64fuzz: clean
Sean Purcell0b0b10e2017-03-20 11:32:24 -0700186 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 -0800187
188ppcfuzz: clean
Sean Purcell0b0b10e2017-03-20 11:32:24 -0700189 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 -0800190
191ppc64fuzz: clean
Sean Purcell0b0b10e2017-03-20 11:32:24 -0700192 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 -0800193
Yann Collet60ca44b2017-09-27 12:24:13 -0700194.PHONY: cxxtest
195cxxtest: CXXFLAGS += -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror
196cxxtest: clean
Yann Collet763f8b52017-09-27 12:09:52 -0700197 $(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 -0800198
inikepc9bb1022016-06-21 18:04:13 +0200199gcc5test: clean
200 gcc-5 -v
201 $(MAKE) all CC=gcc-5 MOREFLAGS="-Werror"
202
203gcc6test: clean
204 gcc-6 -v
205 $(MAKE) all CC=gcc-6 MOREFLAGS="-Werror"
206
Yann Collet213089c2015-06-18 07:43:16 -0800207clangtest: clean
Yann Colletf4ce8912015-08-11 14:18:45 +0100208 clang -v
Sean Purcell3437bf22017-03-01 16:10:26 -0800209 $(MAKE) all CXX=clang-++ CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation"
Yann Collet213089c2015-06-18 07:43:16 -0800210
Yann Collet7083b8a2015-07-06 23:58:59 -0800211armtest: 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=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 +0100214
215aarch64test:
216 $(MAKE) -C $(TESTDIR) datagen # use native, faster
Sean Purcell0b0b10e2017-03-20 11:32:24 -0700217 $(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 +0100218
Yann Collet521b0102016-02-08 01:27:59 +0100219ppctest: clean
inikep2d5eb2b2016-08-18 13:53:26 +0200220 $(MAKE) -C $(TESTDIR) datagen # use native, faster
Sean Purcell0b0b10e2017-03-20 11:32:24 -0700221 $(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 +0100222
inikep1981d5a2016-05-30 10:18:56 +0200223ppc64test: clean
inikep2d5eb2b2016-08-18 13:53:26 +0200224 $(MAKE) -C $(TESTDIR) datagen # use native, faster
Sean Purcell0b0b10e2017-03-20 11:32:24 -0700225 $(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 +0200226
Przemyslaw Skibinskid41c0482017-02-22 11:07:28 +0100227arm-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 Terrell6bb781e2017-09-25 13:29:50 -0700233regressiontest:
234 $(MAKE) -C $(FUZZDIR) regressiontest
235
236uasanregressiontest:
237 $(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=address,undefined" CXXFLAGS="-O3 -fsanitize=address,undefined"
238
239msanregressiontest:
240 $(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=memory" CXXFLAGS="-O3 -fsanitize=memory"
241
Sean Purcellcaf0ee82017-03-09 17:28:08 -0800242# 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 Collet83fae972015-10-23 15:21:53 +0100246usan: clean
Yann Collet19cb37f2018-01-16 11:40:42 -0800247 $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=undefined -Werror"
Yann Collet213089c2015-06-18 07:43:16 -0800248
Yann Collet83fae972015-10-23 15:21:53 +0100249asan: clean
Yann Collet19cb37f2018-01-16 11:40:42 -0800250 $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address -Werror"
Yann Collet83fae972015-10-23 15:21:53 +0100251
Sean Purcellcaf0ee82017-03-09 17:28:08 -0800252asan-%: clean
Yann Collet19cb37f2018-01-16 11:40:42 -0800253 LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=address -Werror" $(MAKE) -C $(TESTDIR) $*
Sean Purcellcaf0ee82017-03-09 17:28:08 -0800254
Yann Colletd9967432016-05-18 14:16:49 +0200255msan: clean
Yann Collet19cb37f2018-01-16 11:40:42 -0800256 $(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 Colletd9967432016-05-18 14:16:49 +0200257
Sean Purcelldaec40d2017-03-07 12:08:15 -0800258msan-%: clean
Yann Collet19cb37f2018-01-16 11:40:42 -0800259 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 Purcelldaec40d2017-03-07 12:08:15 -0800260
Yann Collet6c3e2e72015-12-11 10:44:07 +0100261asan32: clean
inikep2d5eb2b2016-08-18 13:53:26 +0200262 $(MAKE) -C $(TESTDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address"
Yann Collet6c3e2e72015-12-11 10:44:07 +0100263
Yann Collet83fae972015-10-23 15:21:53 +0100264uasan: clean
Yann Collet19cb37f2018-01-16 11:40:42 -0800265 $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined -Werror"
Yann Collet83fae972015-10-23 15:21:53 +0100266
Przemyslaw Skibinski8a51c692017-02-21 22:48:04 +0100267uasan-%: clean
Yann Collet19cb37f2018-01-16 11:40:42 -0800268 LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined -Werror" $(MAKE) -C $(TESTDIR) $*
Przemyslaw Skibinski8a51c692017-02-21 22:48:04 +0100269
Sean Purcelldaec40d2017-03-07 12:08:15 -0800270tsan-%: clean
Yann Collet19cb37f2018-01-16 11:40:42 -0800271 LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=thread -Werror" $(MAKE) -C $(TESTDIR) $* FUZZER_FLAGS=--no-big-tests
Yann Colletbfc2f002017-06-21 17:57:14 -0700272
Przemyslaw Skibinski21911ad2017-02-22 08:54:56 +0100273apt-install:
274 sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install $(APT_PACKAGES)
275
276apt-add-repo:
277 sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
278 sudo apt-get update -y -qq
279
280ppcinstall:
281 APT_PACKAGES="qemu-system-ppc qemu-user-static gcc-powerpc-linux-gnu" $(MAKE) apt-install
282
283arminstall:
Sean Purcelldaec40d2017-03-07 12:08:15 -0800284 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 +0100285
Yann Collet27526c72017-03-01 17:02:49 -0800286valgrindinstall:
Przemyslaw Skibinski21911ad2017-02-22 08:54:56 +0100287 APT_PACKAGES="valgrind" $(MAKE) apt-install
288
289libc6install:
290 APT_PACKAGES="libc6-dev-i386 gcc-multilib" $(MAKE) apt-install
291
292gcc6install: apt-add-repo
293 APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-6 gcc-6-multilib" $(MAKE) apt-install
294
Yann Collet19cb37f2018-01-16 11:40:42 -0800295gcc7install: apt-add-repo
296 APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-7 gcc-7-multilib" $(MAKE) apt-install
297
Przemyslaw Skibinski21911ad2017-02-22 08:54:56 +0100298gpp6install: apt-add-repo
299 APT_PACKAGES="libc6-dev-i386 g++-multilib gcc-6 g++-6 g++-6-multilib" $(MAKE) apt-install
300
Sean Purcelldaec40d2017-03-07 12:08:15 -0800301clang38install:
302 APT_PACKAGES="clang-3.8" $(MAKE) apt-install
303
W. Felix Handte5705d9f2017-09-21 17:30:43 -0700304# Ubuntu 14.04 ships a too-old lz4
305lz4install:
306 [ -e lz4 ] || git clone https://github.com/lz4/lz4 && sudo $(MAKE) -C lz4 install
307
Yann Collet4856a002015-01-24 01:58:16 +0100308endif
inikep13f42d92016-06-01 14:44:31 +0200309
310
311ifneq (,$(filter MSYS%,$(shell uname)))
312HOST_OS = MSYS
Milan Ševčík0d09c772017-03-20 15:57:08 +0100313CMAKE_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 +0200314endif
315
316
317#------------------------------------------------------------------------
Yann Colletbc32b402017-09-27 17:27:38 -0700318# target specific tests
inikep13f42d92016-06-01 14:44:31 +0200319#------------------------------------------------------------------------
320ifneq (,$(filter $(HOST_OS),MSYS POSIX))
Sean Purcell3437bf22017-03-01 16:10:26 -0800321cmakebuild:
inikep13f42d92016-06-01 14:44:31 +0200322 cmake --version
Yann Collet0704df32016-09-19 16:55:35 +0200323 $(RM) -r $(BUILDIR)/cmake/build
324 mkdir $(BUILDIR)/cmake/build
Milan Ševčíka8c0c2a2017-03-16 22:59:11 +0100325 cd $(BUILDIR)/cmake/build ; cmake -DCMAKE_INSTALL_PREFIX:PATH=~/install_test_dir $(CMAKE_PARAMS) .. ; $(MAKE) install ; $(MAKE) uninstall
inikep13f42d92016-06-01 14:44:31 +0200326
Sean Purcell3437bf22017-03-01 16:10:26 -0800327c90build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700328 $(CC) -v
Yann Collet88ba6472017-02-22 10:52:36 -0800329 CFLAGS="-std=c90" $(MAKE) allmost # will fail, due to missing support for `long long`
inikep13f42d92016-06-01 14:44:31 +0200330
Sean Purcell3437bf22017-03-01 16:10:26 -0800331gnu90build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700332 $(CC) -v
Yann Collet88ba6472017-02-22 10:52:36 -0800333 CFLAGS="-std=gnu90" $(MAKE) allmost
inikep13f42d92016-06-01 14:44:31 +0200334
Sean Purcell3437bf22017-03-01 16:10:26 -0800335c99build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700336 $(CC) -v
Yann Colleta86a09e2016-12-22 11:31:39 +0100337 CFLAGS="-std=c99" $(MAKE) allmost
inikep13f42d92016-06-01 14:44:31 +0200338
Sean Purcell3437bf22017-03-01 16:10:26 -0800339gnu99build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700340 $(CC) -v
Yann Collet88ba6472017-02-22 10:52:36 -0800341 CFLAGS="-std=gnu99" $(MAKE) allmost
inikep13f42d92016-06-01 14:44:31 +0200342
Sean Purcell3437bf22017-03-01 16:10:26 -0800343c11build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700344 $(CC) -v
Yann Colleta86a09e2016-12-22 11:31:39 +0100345 CFLAGS="-std=c11" $(MAKE) allmost
inikep13f42d92016-06-01 14:44:31 +0200346
Sean Purcell3437bf22017-03-01 16:10:26 -0800347bmix64build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700348 $(CC) -v
inikep2d5eb2b2016-08-18 13:53:26 +0200349 CFLAGS="-O3 -mbmi -Werror" $(MAKE) -C $(TESTDIR) test
inikep13f42d92016-06-01 14:44:31 +0200350
Sean Purcell3437bf22017-03-01 16:10:26 -0800351bmix32build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700352 $(CC) -v
inikep2d5eb2b2016-08-18 13:53:26 +0200353 CFLAGS="-O3 -mbmi -mx32 -Werror" $(MAKE) -C $(TESTDIR) test
inikep13f42d92016-06-01 14:44:31 +0200354
Sean Purcell3437bf22017-03-01 16:10:26 -0800355bmi32build: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700356 $(CC) -v
inikep2d5eb2b2016-08-18 13:53:26 +0200357 CFLAGS="-O3 -mbmi -m32 -Werror" $(MAKE) -C $(TESTDIR) test
Yann Colletc35cd5b2016-06-30 15:40:28 +0200358
359staticAnalyze: clean
Yann Colletbc32b402017-09-27 17:27:38 -0700360 $(CC) -v
Yann Collet677ed262016-07-10 14:23:30 +0200361 CPPFLAGS=-g scan-build --status-bugs -v $(MAKE) all
inikep13f42d92016-06-01 14:44:31 +0200362endif