blob: 1aa47c2713138f05082bfafc30812bbee6d631cd [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 Olsab4f91662015-01-09 16:38:25 +010016LIBFILE = $(OUTPUT)libapikfs.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
25API_IN := $(OUTPUT)libapikfs-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
32 @$(MAKE) $(build)=libapikfs
33
34$(LIBFILE): $(API_IN)
35 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
Borislav Petkov85c66be2013-02-20 16:32:30 +010036
37clean:
Jiri Olsab4f91662015-01-09 16:38:25 +010038 $(call QUIET_CLEAN, libapikfs) $(RM) $(LIBFILE); \
39 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