blob: 0a6fda9837f7dd3a60a89fbe3083bf8a3835b6f3 [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 Olsab4f916682015-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
Lucas Stach703e0162016-03-17 18:27:50 +010013LD = $(CROSS_COMPILE)ld
Rabin Vincent3c4797d2013-05-17 22:27:44 +020014
Jiri Olsab4f916682015-01-09 16:38:25 +010015MAKEFLAGS += --no-print-directory
Borislav Petkov85c66be2013-02-20 16:32:30 +010016
Jiri Olsa285a8f22015-01-10 20:53:13 +010017LIBFILE = $(OUTPUT)libapi.a
Borislav Petkov85c66be2013-02-20 16:32:30 +010018
Jiri Olsab4f916682015-01-09 16:38:25 +010019CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
Chris Phlipotb983d542016-06-30 22:12:32 -070020CFLAGS += -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
Jiri Olsab4f916682015-01-09 16:38:25 +010027CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
Jiri Olsa975f14f2016-02-14 17:03:42 +010028CFLAGS += -I$(srctree)/tools/lib/api
Arnaldo Carvalho de Melob31e3e32016-07-08 15:26:50 -030029CFLAGS += -I$(srctree)/tools/include
Borislav Petkov85c66be2013-02-20 16:32:30 +010030
31RM = rm -f
32
Jiri Olsa285a8f22015-01-10 20:53:13 +010033API_IN := $(OUTPUT)libapi-in.o
Borislav Petkov85c66be2013-02-20 16:32:30 +010034
Jiri Olsa7c422f52015-09-23 12:34:02 +020035all:
36
Jiri Olsab4f916682015-01-09 16:38:25 +010037export srctree OUTPUT CC LD CFLAGS V
Jiri Olsaab6201d2015-09-23 12:33:56 +020038include $(srctree)/tools/build/Makefile.include
Borislav Petkov85c66be2013-02-20 16:32:30 +010039
Jiri Olsa7c422f52015-09-23 12:34:02 +020040all: fixdep $(LIBFILE)
Borislav Petkov553873e2013-12-09 17:14:23 +010041
Jiri Olsab4f916682015-01-09 16:38:25 +010042$(API_IN): FORCE
Jiri Olsa285a8f22015-01-10 20:53:13 +010043 @$(MAKE) $(build)=libapi
Jiri Olsab4f916682015-01-09 16:38:25 +010044
45$(LIBFILE): $(API_IN)
46 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
Borislav Petkov85c66be2013-02-20 16:32:30 +010047
48clean:
Jiri Olsa285a8f22015-01-10 20:53:13 +010049 $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
Riku Voipioc867b152015-06-18 15:52:18 +030050 find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
Borislav Petkov85c66be2013-02-20 16:32:30 +010051
Jiri Olsab4f916682015-01-09 16:38:25 +010052FORCE:
53
54.PHONY: clean FORCE