]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | # SPDX-License-Identifier: GPL-2.0 |
85c66be1 | 2 | include ../../scripts/Makefile.include |
ca70c24f | 3 | include ../../scripts/utilities.mak # QUIET_CLEAN |
85c66be1 | 4 | |
b4f91668 | 5 | ifeq ($(srctree),) |
e19b7cee | 6 | srctree := $(patsubst %/,%,$(dir $(CURDIR))) |
b4f91668 JO |
7 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
8 | srctree := $(patsubst %/,%,$(dir $(srctree))) | |
9 | #$(info Determined 'srctree' to be $(srctree)) | |
10 | endif | |
11 | ||
12024aac DCC |
12 | CC ?= $(CROSS_COMPILE)gcc |
13 | AR ?= $(CROSS_COMPILE)ar | |
14 | LD ?= $(CROSS_COMPILE)ld | |
3c4797d4 | 15 | |
b4f91668 | 16 | MAKEFLAGS += --no-print-directory |
85c66be1 | 17 | |
285a8f24 | 18 | LIBFILE = $(OUTPUT)libapi.a |
85c66be1 | 19 | |
b4f91668 | 20 | CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) |
58b79186 | 21 | CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -fPIC |
49b3cd30 | 22 | |
58b79186 | 23 | ifeq ($(DEBUG),0) |
3866058e | 24 | ifeq ($(CC_NO_CLANG), 0) |
49b3cd30 ACM |
25 | CFLAGS += -O3 |
26 | else | |
27 | CFLAGS += -O6 | |
28 | endif | |
58b79186 JO |
29 | endif |
30 | ||
31 | ifeq ($(DEBUG),0) | |
32 | CFLAGS += -D_FORTIFY_SOURCE | |
33 | endif | |
b983d544 CP |
34 | |
35 | # Treat warnings as errors unless directed not to | |
36 | ifneq ($(WERROR),0) | |
37 | CFLAGS += -Werror | |
38 | endif | |
39 | ||
b4f91668 | 40 | CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 |
975f14fa | 41 | CFLAGS += -I$(srctree)/tools/lib/api |
b31e3e33 | 42 | CFLAGS += -I$(srctree)/tools/include |
85c66be1 BP |
43 | |
44 | RM = rm -f | |
45 | ||
285a8f24 | 46 | API_IN := $(OUTPUT)libapi-in.o |
85c66be1 | 47 | |
7c422f55 JO |
48 | all: |
49 | ||
b4f91668 | 50 | export srctree OUTPUT CC LD CFLAGS V |
ab6201d0 | 51 | include $(srctree)/tools/build/Makefile.include |
85c66be1 | 52 | |
7c422f55 | 53 | all: 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 | |
61 | clean: | |
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 | |
65 | FORCE: | |
85c66be1 | 66 | |
b4f91668 | 67 | .PHONY: clean FORCE |