1include ../../scripts/Makefile.include 2include ../../scripts/utilities.mak # QUIET_CLEAN 3 4ifeq ($(srctree),) 5srctree := $(patsubst %/,%,$(dir $(shell pwd))) 6srctree := $(patsubst %/,%,$(dir $(srctree))) 7srctree := $(patsubst %/,%,$(dir $(srctree))) 8#$(info Determined 'srctree' to be $(srctree)) 9endif 10 11CC = $(CROSS_COMPILE)gcc 12AR = $(CROSS_COMPILE)ar 13LD = $(CROSS_COMPILE)ld 14 15MAKEFLAGS += --no-print-directory 16 17LIBFILE = $(OUTPUT)libapi.a 18 19CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) 20CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC 21 22# Treat warnings as errors unless directed not to 23ifneq ($(WERROR),0) 24 CFLAGS += -Werror 25endif 26 27CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 28CFLAGS += -I$(srctree)/tools/lib/api 29CFLAGS += -I$(srctree)/tools/include 30 31RM = rm -f 32 33API_IN := $(OUTPUT)libapi-in.o 34 35all: 36 37export srctree OUTPUT CC LD CFLAGS V 38include $(srctree)/tools/build/Makefile.include 39 40all: fixdep $(LIBFILE) 41 42$(API_IN): FORCE 43 @$(MAKE) $(build)=libapi 44 45$(LIBFILE): $(API_IN) 46 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN) 47 48clean: 49 $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \ 50 find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) 51 52FORCE: 53 54.PHONY: clean FORCE 55