2013-02-20 16:32:30 +01:00
|
|
|
include ../../scripts/Makefile.include
|
2016-03-18 13:57:20 -03:00
|
|
|
include ../../scripts/utilities.mak # QUIET_CLEAN
|
2013-02-20 16:32:30 +01:00
|
|
|
|
2015-01-09 16:38:25 +01:00
|
|
|
ifeq ($(srctree),)
|
2016-11-22 09:30:26 +01:00
|
|
|
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
|
2015-01-09 16:38:25 +01:00
|
|
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
|
|
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
|
|
|
#$(info Determined 'srctree' to be $(srctree))
|
|
|
|
endif
|
|
|
|
|
2013-05-17 22:27:44 +02:00
|
|
|
CC = $(CROSS_COMPILE)gcc
|
|
|
|
AR = $(CROSS_COMPILE)ar
|
2016-03-17 18:27:50 +01:00
|
|
|
LD = $(CROSS_COMPILE)ld
|
2013-05-17 22:27:44 +02:00
|
|
|
|
2015-01-09 16:38:25 +01:00
|
|
|
MAKEFLAGS += --no-print-directory
|
2013-02-20 16:32:30 +01:00
|
|
|
|
2015-01-10 20:53:13 +01:00
|
|
|
LIBFILE = $(OUTPUT)libapi.a
|
2013-02-20 16:32:30 +01:00
|
|
|
|
2015-01-09 16:38:25 +01:00
|
|
|
CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
|
2017-02-14 10:55:27 -03:00
|
|
|
CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
|
|
|
|
|
|
|
|
ifeq ($(CC), clang)
|
|
|
|
CFLAGS += -O3
|
|
|
|
else
|
|
|
|
CFLAGS += -O6
|
|
|
|
endif
|
2016-06-30 22:12:32 -07:00
|
|
|
|
|
|
|
# Treat warnings as errors unless directed not to
|
|
|
|
ifneq ($(WERROR),0)
|
|
|
|
CFLAGS += -Werror
|
|
|
|
endif
|
|
|
|
|
2015-01-09 16:38:25 +01:00
|
|
|
CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
2016-02-14 17:03:42 +01:00
|
|
|
CFLAGS += -I$(srctree)/tools/lib/api
|
2016-07-08 15:26:50 -03:00
|
|
|
CFLAGS += -I$(srctree)/tools/include
|
2013-02-20 16:32:30 +01:00
|
|
|
|
|
|
|
RM = rm -f
|
|
|
|
|
2015-01-10 20:53:13 +01:00
|
|
|
API_IN := $(OUTPUT)libapi-in.o
|
2013-02-20 16:32:30 +01:00
|
|
|
|
2015-09-23 12:34:02 +02:00
|
|
|
all:
|
|
|
|
|
2015-01-09 16:38:25 +01:00
|
|
|
export srctree OUTPUT CC LD CFLAGS V
|
2015-09-23 12:33:56 +02:00
|
|
|
include $(srctree)/tools/build/Makefile.include
|
2013-02-20 16:32:30 +01:00
|
|
|
|
2015-09-23 12:34:02 +02:00
|
|
|
all: fixdep $(LIBFILE)
|
2013-12-09 17:14:23 +01:00
|
|
|
|
2015-01-09 16:38:25 +01:00
|
|
|
$(API_IN): FORCE
|
2015-01-10 20:53:13 +01:00
|
|
|
@$(MAKE) $(build)=libapi
|
2015-01-09 16:38:25 +01:00
|
|
|
|
|
|
|
$(LIBFILE): $(API_IN)
|
|
|
|
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
|
2013-02-20 16:32:30 +01:00
|
|
|
|
|
|
|
clean:
|
2015-01-10 20:53:13 +01:00
|
|
|
$(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
|
2015-06-18 15:52:18 +03:00
|
|
|
find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
|
2015-01-09 16:38:25 +01:00
|
|
|
|
|
|
|
FORCE:
|
2013-02-20 16:32:30 +01:00
|
|
|
|
2015-01-09 16:38:25 +01:00
|
|
|
.PHONY: clean FORCE
|