]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - tools/lib/api/Makefile
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-bionic-kernel.git] / tools / lib / api / Makefile
CommitLineData
b2441318 1# SPDX-License-Identifier: GPL-2.0
85c66be1 2include ../../scripts/Makefile.include
ca70c24f 3include ../../scripts/utilities.mak # QUIET_CLEAN
85c66be1 4
b4f91668 5ifeq ($(srctree),)
e19b7cee 6srctree := $(patsubst %/,%,$(dir $(CURDIR)))
b4f91668
JO
7srctree := $(patsubst %/,%,$(dir $(srctree)))
8srctree := $(patsubst %/,%,$(dir $(srctree)))
9#$(info Determined 'srctree' to be $(srctree))
10endif
11
12024aac
DCC
12CC ?= $(CROSS_COMPILE)gcc
13AR ?= $(CROSS_COMPILE)ar
14LD ?= $(CROSS_COMPILE)ld
3c4797d4 15
b4f91668 16MAKEFLAGS += --no-print-directory
85c66be1 17
285a8f24 18LIBFILE = $(OUTPUT)libapi.a
85c66be1 19
b4f91668 20CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
58b79186 21CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -fPIC
49b3cd30 22
58b79186 23ifeq ($(DEBUG),0)
3866058e 24ifeq ($(CC_NO_CLANG), 0)
49b3cd30
ACM
25 CFLAGS += -O3
26else
27 CFLAGS += -O6
28endif
58b79186
JO
29endif
30
31ifeq ($(DEBUG),0)
32 CFLAGS += -D_FORTIFY_SOURCE
33endif
b983d544
CP
34
35# Treat warnings as errors unless directed not to
36ifneq ($(WERROR),0)
37 CFLAGS += -Werror
38endif
39
b4f91668 40CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
975f14fa 41CFLAGS += -I$(srctree)/tools/lib/api
b31e3e33 42CFLAGS += -I$(srctree)/tools/include
85c66be1
BP
43
44RM = rm -f
45
285a8f24 46API_IN := $(OUTPUT)libapi-in.o
85c66be1 47
7c422f55
JO
48all:
49
b4f91668 50export srctree OUTPUT CC LD CFLAGS V
ab6201d0 51include $(srctree)/tools/build/Makefile.include
85c66be1 52
7c422f55 53all: fixdep $(LIBFILE)
553873e1 54
b4f91668 55$(API_IN): FORCE
285a8f24 56 @$(MAKE) $(build)=libapi
b4f91668
JO
57
58$(LIBFILE): $(API_IN)
59 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
85c66be1
BP
60
61clean:
285a8f24 62 $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
c867b150 63 find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
b4f91668
JO
64
65FORCE:
85c66be1 66
b4f91668 67.PHONY: clean FORCE