blob: d8fe29fc19a41de308141fac73ce05dc80388f39 [file] [log] [blame]
Borislav Petkov85c66be2013-02-20 16:32:30 +01001include ../../scripts/Makefile.include
Borislav Petkov553873e2013-12-09 17:14:23 +01002include ../../perf/config/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)
19CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -fPIC
20CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
Borislav Petkov85c66be2013-02-20 16:32:30 +010021
22RM = rm -f
23
Jiri Olsab4f91662015-01-09 16:38:25 +010024build := -f $(srctree)/tools/build/Makefile.build dir=. obj
Jiri Olsa285a8f22015-01-10 20:53:13 +010025API_IN := $(OUTPUT)libapi-in.o
Borislav Petkov85c66be2013-02-20 16:32:30 +010026
Jiri Olsab4f91662015-01-09 16:38:25 +010027export srctree OUTPUT CC LD CFLAGS V
Borislav Petkov85c66be2013-02-20 16:32:30 +010028
Jiri Olsab4f91662015-01-09 16:38:25 +010029all: $(LIBFILE)
Borislav Petkov553873e2013-12-09 17:14:23 +010030
Jiri Olsab4f91662015-01-09 16:38:25 +010031$(API_IN): FORCE
Jiri Olsa285a8f22015-01-10 20:53:13 +010032 @$(MAKE) $(build)=libapi
Jiri Olsab4f91662015-01-09 16:38:25 +010033
34$(LIBFILE): $(API_IN)
35 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
Borislav Petkov85c66be2013-02-20 16:32:30 +010036
37clean:
Jiri Olsa285a8f22015-01-10 20:53:13 +010038 $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
Jiri Olsab4f91662015-01-09 16:38:25 +010039 find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM)
Borislav Petkov85c66be2013-02-20 16:32:30 +010040
Jiri Olsab4f91662015-01-09 16:38:25 +010041FORCE:
42
43.PHONY: clean FORCE