Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 1 | include ../../scripts/Makefile.include |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 2 | include ../../perf/config/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) |
| 19 | CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -fPIC |
| 20 | CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 21 | |
| 22 | RM = rm -f |
| 23 | |
Jiri Olsa | b4f9166 | 2015-01-09 16:38:25 +0100 | [diff] [blame] | 24 | build := -f $(srctree)/tools/build/Makefile.build dir=. obj |
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 | b4f9166 | 2015-01-09 16:38:25 +0100 | [diff] [blame] | 27 | export srctree OUTPUT CC LD CFLAGS V |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 28 | |
Jiri Olsa | b4f9166 | 2015-01-09 16:38:25 +0100 | [diff] [blame] | 29 | all: $(LIBFILE) |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 30 | |
Jiri Olsa | b4f9166 | 2015-01-09 16:38:25 +0100 | [diff] [blame] | 31 | $(API_IN): FORCE |
Jiri Olsa | 285a8f2 | 2015-01-10 20:53:13 +0100 | [diff] [blame] | 32 | @$(MAKE) $(build)=libapi |
Jiri Olsa | b4f9166 | 2015-01-09 16:38:25 +0100 | [diff] [blame] | 33 | |
| 34 | $(LIBFILE): $(API_IN) |
| 35 | $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN) |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 36 | |
| 37 | clean: |
Jiri Olsa | 285a8f2 | 2015-01-10 20:53:13 +0100 | [diff] [blame] | 38 | $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \ |
Jiri Olsa | b4f9166 | 2015-01-09 16:38:25 +0100 | [diff] [blame] | 39 | find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM) |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 40 | |
Jiri Olsa | b4f9166 | 2015-01-09 16:38:25 +0100 | [diff] [blame] | 41 | FORCE: |
| 42 | |
| 43 | .PHONY: clean FORCE |