Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 1 | include ../../scripts/Makefile.include |
Arnaldo Carvalho de Melo | ca70c24 | 2016-03-18 13:57:20 -0300 | [diff] [blame] | 2 | include ../../scripts/utilities.mak # QUIET_CLEAN |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 3 | |
Jiri Olsa | b4f9166 | 2015-01-09 16:38:25 +0100 | [diff] [blame] | 4 | ifeq ($(srctree),) |
| 5 | srctree := $(patsubst %/,%,$(dir $(shell pwd))) |
| 6 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 7 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 8 | #$(info Determined 'srctree' to be $(srctree)) |
| 9 | endif |
| 10 | |
Rabin Vincent | 3c4797d | 2013-05-17 22:27:44 +0200 | [diff] [blame] | 11 | CC = $(CROSS_COMPILE)gcc |
| 12 | AR = $(CROSS_COMPILE)ar |
| 13 | |
Jiri Olsa | b4f9166 | 2015-01-09 16:38:25 +0100 | [diff] [blame] | 14 | MAKEFLAGS += --no-print-directory |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 15 | |
Jiri Olsa | 285a8f2 | 2015-01-10 20:53:13 +0100 | [diff] [blame] | 16 | LIBFILE = $(OUTPUT)libapi.a |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 17 | |
Jiri Olsa | b4f9166 | 2015-01-09 16:38:25 +0100 | [diff] [blame] | 18 | CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) |
Bobby Powers | de28c15 | 2015-04-21 19:19:41 -0400 | [diff] [blame] | 19 | CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC |
Jiri Olsa | b4f9166 | 2015-01-09 16:38:25 +0100 | [diff] [blame] | 20 | CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 |
Jiri Olsa | 975f14f | 2016-02-14 17:03:42 +0100 | [diff] [blame] | 21 | CFLAGS += -I$(srctree)/tools/lib/api |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 22 | |
| 23 | RM = rm -f |
| 24 | |
Jiri Olsa | 285a8f2 | 2015-01-10 20:53:13 +0100 | [diff] [blame] | 25 | API_IN := $(OUTPUT)libapi-in.o |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 26 | |
Jiri Olsa | 7c422f5 | 2015-09-23 12:34:02 +0200 | [diff] [blame] | 27 | all: |
| 28 | |
Jiri Olsa | b4f9166 | 2015-01-09 16:38:25 +0100 | [diff] [blame] | 29 | export srctree OUTPUT CC LD CFLAGS V |
Jiri Olsa | ab6201d | 2015-09-23 12:33:56 +0200 | [diff] [blame] | 30 | include $(srctree)/tools/build/Makefile.include |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 31 | |
Jiri Olsa | 7c422f5 | 2015-09-23 12:34:02 +0200 | [diff] [blame] | 32 | all: fixdep $(LIBFILE) |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 33 | |
Jiri Olsa | b4f9166 | 2015-01-09 16:38:25 +0100 | [diff] [blame] | 34 | $(API_IN): FORCE |
Jiri Olsa | 285a8f2 | 2015-01-10 20:53:13 +0100 | [diff] [blame] | 35 | @$(MAKE) $(build)=libapi |
Jiri Olsa | b4f9166 | 2015-01-09 16:38:25 +0100 | [diff] [blame] | 36 | |
| 37 | $(LIBFILE): $(API_IN) |
| 38 | $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN) |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 39 | |
| 40 | clean: |
Jiri Olsa | 285a8f2 | 2015-01-10 20:53:13 +0100 | [diff] [blame] | 41 | $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \ |
Riku Voipio | c867b15 | 2015-06-18 15:52:18 +0300 | [diff] [blame] | 42 | find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 43 | |
Jiri Olsa | b4f9166 | 2015-01-09 16:38:25 +0100 | [diff] [blame] | 44 | FORCE: |
| 45 | |
| 46 | .PHONY: clean FORCE |