Martin Roth | adaab4a | 2022-10-28 22:38:44 -0600 | [diff] [blame^] | 1 | ## SPDX-License-Identifier: BSD-2-Clause |
Julius Werner | 09f2921 | 2015-09-29 13:51:35 -0700 | [diff] [blame] | 2 | # ################################################################ |
| 3 | # LZ4 - Makefile |
| 4 | # Copyright (C) Yann Collet 2011-2015 |
| 5 | # All rights reserved. |
| 6 | # |
Julius Werner | 09f2921 | 2015-09-29 13:51:35 -0700 | [diff] [blame] | 7 | # You can contact the author at : |
| 8 | # - LZ4 source repository : https://github.com/Cyan4973/lz4 |
| 9 | # - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c |
| 10 | # ################################################################ |
| 11 | |
| 12 | # Version number |
| 13 | export VERSION=132 |
| 14 | export RELEASE=r$(VERSION) |
| 15 | |
| 16 | DESTDIR?= |
| 17 | PREFIX ?= /usr/local |
| 18 | |
| 19 | LIBDIR ?= $(PREFIX)/lib |
| 20 | INCLUDEDIR=$(PREFIX)/include |
| 21 | PRGDIR = programs |
| 22 | LZ4DIR = lib |
| 23 | |
| 24 | |
| 25 | # Define nul output |
| 26 | ifneq (,$(filter Windows%,$(OS))) |
| 27 | VOID = nul |
| 28 | else |
| 29 | VOID = /dev/null |
| 30 | endif |
| 31 | |
| 32 | |
| 33 | .PHONY: default all lib lz4programs clean test versionsTest examples |
| 34 | |
| 35 | default: lz4programs |
| 36 | |
| 37 | all: lib lz4programs |
| 38 | |
| 39 | lib: |
| 40 | @$(MAKE) -C $(LZ4DIR) all |
| 41 | |
| 42 | lz4programs: |
| 43 | @$(MAKE) -C $(PRGDIR) |
| 44 | |
| 45 | clean: |
| 46 | @$(MAKE) -C $(PRGDIR) $@ > $(VOID) |
| 47 | @$(MAKE) -C $(LZ4DIR) $@ > $(VOID) |
| 48 | @$(MAKE) -C examples $@ > $(VOID) |
| 49 | @$(MAKE) -C versionsTest $@ > $(VOID) |
| 50 | @echo Cleaning completed |
| 51 | |
| 52 | |
| 53 | #------------------------------------------------------------------------ |
| 54 | #make install is validated only for Linux, OSX, kFreeBSD and Hurd targets |
| 55 | ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU)) |
| 56 | |
| 57 | install: |
| 58 | @$(MAKE) -C $(LZ4DIR) $@ |
| 59 | @$(MAKE) -C $(PRGDIR) $@ |
| 60 | |
| 61 | uninstall: |
| 62 | @$(MAKE) -C $(LZ4DIR) $@ |
| 63 | @$(MAKE) -C $(PRGDIR) $@ |
| 64 | |
| 65 | travis-install: |
| 66 | sudo $(MAKE) install |
| 67 | |
| 68 | test: |
| 69 | $(MAKE) -C $(PRGDIR) test |
| 70 | |
| 71 | cmake: |
| 72 | @cd cmake_unofficial; cmake CMakeLists.txt; $(MAKE) |
| 73 | |
| 74 | gpptest: clean |
| 75 | $(MAKE) all CC=g++ CFLAGS="-O3 -I../lib -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror" |
| 76 | |
| 77 | clangtest: clean |
| 78 | CFLAGS="-O3 -Werror -Wconversion -Wno-sign-conversion" $(MAKE) all CC=clang |
| 79 | |
| 80 | sanitize: clean |
| 81 | CFLAGS="-O3 -g -fsanitize=undefined" $(MAKE) test CC=clang FUZZER_TIME="-T1mn" NB_LOOPS=-i1 |
| 82 | |
| 83 | staticAnalyze: clean |
| 84 | CFLAGS=-g scan-build --status-bugs -v $(MAKE) all |
| 85 | |
| 86 | armtest: clean |
| 87 | CFLAGS="-O3 -Werror" $(MAKE) -C $(LZ4DIR) all CC=arm-linux-gnueabi-gcc |
| 88 | CFLAGS="-O3 -Werror" $(MAKE) -C $(PRGDIR) bins CC=arm-linux-gnueabi-gcc |
| 89 | |
| 90 | versionsTest: clean |
| 91 | $(MAKE) -C versionsTest |
| 92 | |
| 93 | examples: |
| 94 | $(MAKE) -C $(LZ4DIR) |
| 95 | $(MAKE) -C $(PRGDIR) lz4 |
| 96 | $(MAKE) -C examples test |
| 97 | |
| 98 | endif |