xref: /aosp_15_r20/external/coreboot/util/cbfstool/lz4/Makefile (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1## SPDX-License-Identifier: BSD-2-Clause
2# ################################################################
3# LZ4 - Makefile
4# Copyright (C) Yann Collet 2011-2015
5# All rights reserved.
6#
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
13export VERSION=132
14export RELEASE=r$(VERSION)
15
16DESTDIR?=
17PREFIX ?= /usr/local
18
19LIBDIR ?= $(PREFIX)/lib
20INCLUDEDIR=$(PREFIX)/include
21PRGDIR  = programs
22LZ4DIR  = lib
23
24
25# Define nul output
26ifneq (,$(filter Windows%,$(OS)))
27VOID = nul
28else
29VOID = /dev/null
30endif
31
32
33.PHONY: default all lib lz4programs clean test versionsTest examples
34
35default: lz4programs
36
37all: lib lz4programs
38
39lib:
40	@$(MAKE) -C $(LZ4DIR) all
41
42lz4programs:
43	@$(MAKE) -C $(PRGDIR)
44
45clean:
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
55ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU))
56
57install:
58	@$(MAKE) -C $(LZ4DIR) $@
59	@$(MAKE) -C $(PRGDIR) $@
60
61uninstall:
62	@$(MAKE) -C $(LZ4DIR) $@
63	@$(MAKE) -C $(PRGDIR) $@
64
65travis-install:
66	sudo $(MAKE) install
67
68test:
69	$(MAKE) -C $(PRGDIR) test
70
71cmake:
72	@cd cmake_unofficial; cmake CMakeLists.txt; $(MAKE)
73
74gpptest: clean
75	$(MAKE) all CC=g++ CFLAGS="-O3 -I../lib -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror"
76
77clangtest: clean
78	CFLAGS="-O3 -Werror -Wconversion -Wno-sign-conversion" $(MAKE) all CC=clang
79
80sanitize: clean
81	CFLAGS="-O3 -g -fsanitize=undefined" $(MAKE) test CC=clang FUZZER_TIME="-T1mn" NB_LOOPS=-i1
82
83staticAnalyze: clean
84	CFLAGS=-g scan-build --status-bugs -v $(MAKE) all
85
86armtest: 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
90versionsTest: clean
91	$(MAKE) -C versionsTest
92
93examples:
94	$(MAKE) -C $(LZ4DIR)
95	$(MAKE) -C $(PRGDIR) lz4
96	$(MAKE) -C examples test
97
98endif
99