GNU Linux-libre 4.4.300-gnu1
[releases.git] / tools / lib / api / Makefile
1 include ../../scripts/Makefile.include
2 include ../../perf/config/utilities.mak         # QUIET_CLEAN
3
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
11 CC = $(CROSS_COMPILE)gcc
12 AR = $(CROSS_COMPILE)ar
13
14 MAKEFLAGS += --no-print-directory
15
16 LIBFILE = $(OUTPUT)libapi.a
17
18 CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
19 CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
20 CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
21
22 RM = rm -f
23
24 API_IN := $(OUTPUT)libapi-in.o
25
26 all:
27
28 export srctree OUTPUT CC LD CFLAGS V
29 include $(srctree)/tools/build/Makefile.include
30
31 all: fixdep $(LIBFILE)
32
33 $(API_IN): FORCE
34         @$(MAKE) $(build)=libapi
35
36 $(LIBFILE): $(API_IN)
37         $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
38
39 clean:
40         $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
41         find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
42
43 FORCE:
44
45 .PHONY: clean FORCE