1include ../../scripts/Makefile.include 2include ../../perf/config/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 13 14MAKEFLAGS += --no-print-directory 15 16LIBFILE = $(OUTPUT)libapi.a 17 18CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) 19CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC 20CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 21 22RM = rm -f 23 24build := -f $(srctree)/tools/build/Makefile.build dir=. obj 25API_IN := $(OUTPUT)libapi-in.o 26 27export srctree OUTPUT CC LD CFLAGS V 28 29all: $(LIBFILE) 30 31$(API_IN): FORCE 32 @$(MAKE) $(build)=libapi 33 34$(LIBFILE): $(API_IN) 35 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN) 36 37clean: 38 $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \ 39 find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) 40 41FORCE: 42 43.PHONY: clean FORCE 44