blob: 316f308a63ea691c4dfb258066a7f6e90bb8b199 [file] [log] [blame]
Borislav Petkov85c66be2013-02-20 16:32:30 +01001include ../../scripts/Makefile.include
Arnaldo Carvalho de Meloca70c242016-03-18 13:57:20 -03002include ../../scripts/utilities.mak # QUIET_CLEAN
Borislav Petkov85c66be2013-02-20 16:32:30 +01003
Jiri Olsab4f91662015-01-09 16:38:25 +01004ifeq ($(srctree),)
5srctree := $(patsubst %/,%,$(dir $(shell pwd)))
6srctree := $(patsubst %/,%,$(dir $(srctree)))
7srctree := $(patsubst %/,%,$(dir $(srctree)))
8#$(info Determined 'srctree' to be $(srctree))
9endif
10
Rabin Vincent3c4797d2013-05-17 22:27:44 +020011CC = $(CROSS_COMPILE)gcc
12AR = $(CROSS_COMPILE)ar
13
Jiri Olsab4f91662015-01-09 16:38:25 +010014MAKEFLAGS += --no-print-directory
Borislav Petkov85c66be2013-02-20 16:32:30 +010015
Jiri Olsa285a8f22015-01-10 20:53:13 +010016LIBFILE = $(OUTPUT)libapi.a
Borislav Petkov85c66be2013-02-20 16:32:30 +010017
Jiri Olsab4f91662015-01-09 16:38:25 +010018CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
Bobby Powersde28c152015-04-21 19:19:41 -040019CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
Jiri Olsab4f91662015-01-09 16:38:25 +010020CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
Jiri Olsa975f14f2016-02-14 17:03:42 +010021CFLAGS += -I$(srctree)/tools/lib/api
Borislav Petkov85c66be2013-02-20 16:32:30 +010022
23RM = rm -f
24
Jiri Olsa285a8f22015-01-10 20:53:13 +010025API_IN := $(OUTPUT)libapi-in.o
Borislav Petkov85c66be2013-02-20 16:32:30 +010026
Jiri Olsa7c422f52015-09-23 12:34:02 +020027all:
28
Jiri Olsab4f91662015-01-09 16:38:25 +010029export srctree OUTPUT CC LD CFLAGS V
Jiri Olsaab6201d2015-09-23 12:33:56 +020030include $(srctree)/tools/build/Makefile.include
Borislav Petkov85c66be2013-02-20 16:32:30 +010031
Jiri Olsa7c422f52015-09-23 12:34:02 +020032all: fixdep $(LIBFILE)
Borislav Petkov553873e2013-12-09 17:14:23 +010033
Jiri Olsab4f91662015-01-09 16:38:25 +010034$(API_IN): FORCE
Jiri Olsa285a8f22015-01-10 20:53:13 +010035 @$(MAKE) $(build)=libapi
Jiri Olsab4f91662015-01-09 16:38:25 +010036
37$(LIBFILE): $(API_IN)
38 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
Borislav Petkov85c66be2013-02-20 16:32:30 +010039
40clean:
Jiri Olsa285a8f22015-01-10 20:53:13 +010041 $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
Riku Voipioc867b152015-06-18 15:52:18 +030042 find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
Borislav Petkov85c66be2013-02-20 16:32:30 +010043
Jiri Olsab4f91662015-01-09 16:38:25 +010044FORCE:
45
46.PHONY: clean FORCE