0001
0002 include ../../scripts/Makefile.include
0003 include ../../scripts/utilities.mak
0004
0005 ifeq ($(srctree),)
0006 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
0007 srctree := $(patsubst %/,%,$(dir $(srctree)))
0008 srctree := $(patsubst %/,%,$(dir $(srctree)))
0009
0010 endif
0011
0012 CC ?= $(CROSS_COMPILE)gcc
0013 AR ?= $(CROSS_COMPILE)ar
0014 LD ?= $(CROSS_COMPILE)ld
0015
0016 MAKEFLAGS += --no-print-directory
0017
0018 LIBFILE = $(OUTPUT)libapi.a
0019
0020 CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
0021 CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -fPIC
0022
0023 ifeq ($(DEBUG),0)
0024 ifeq ($(CC_NO_CLANG), 0)
0025 CFLAGS += -O3
0026 else
0027 CFLAGS += -O6
0028 endif
0029 endif
0030
0031 ifeq ($(DEBUG),0)
0032 CFLAGS += -D_FORTIFY_SOURCE
0033 endif
0034
0035
0036 ifneq ($(WERROR),0)
0037 CFLAGS += -Werror
0038 endif
0039
0040 CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
0041 CFLAGS += -I$(srctree)/tools/lib/api
0042 CFLAGS += -I$(srctree)/tools/include
0043
0044 RM = rm -f
0045
0046 API_IN := $(OUTPUT)libapi-in.o
0047
0048 all:
0049
0050 export srctree OUTPUT CC LD CFLAGS V
0051 include $(srctree)/tools/build/Makefile.include
0052
0053 all: fixdep $(LIBFILE)
0054
0055 $(API_IN): FORCE
0056 @$(MAKE) $(build)=libapi
0057
0058 $(LIBFILE): $(API_IN)
0059 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
0060
0061 clean:
0062 $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
0063 find $(or $(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
0064
0065 FORCE:
0066
0067 .PHONY: clean FORCE