1 # SPDX-License-Identifier: GPL-2.0
2 include ../../scripts/Makefile.include
3 include ../../scripts/utilities.mak # QUIET_CLEAN
6 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
7 srctree := $(patsubst %/,%,$(dir $(srctree)))
8 srctree := $(patsubst %/,%,$(dir $(srctree)))
9 #$(info Determined 'srctree' to be $(srctree))
12 CC ?= $(CROSS_COMPILE)gcc
13 AR ?= $(CROSS_COMPILE)ar
14 LD ?= $(CROSS_COMPILE)ld
16 MAKEFLAGS += --no-print-directory
18 LIBFILE = $(OUTPUT)libapi.a
20 CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
21 CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -fPIC
24 ifeq ($(CC_NO_CLANG), 0)
32 CFLAGS += -D_FORTIFY_SOURCE
35 # Treat warnings as errors unless directed not to
40 CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
41 CFLAGS += -I$(srctree)/tools/lib/api
42 CFLAGS += -I$(srctree)/tools/include
46 API_IN := $(OUTPUT)libapi-in.o
50 export srctree OUTPUT CC LD CFLAGS V
51 include $(srctree)/tools/build/Makefile.include
53 all: fixdep $(LIBFILE)
56 @$(MAKE) $(build)=libapi
59 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
62 $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
63 find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)