]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - tools/lib/api/Makefile
UBUNTU: Ubuntu-4.13.0-45.50
[mirror_ubuntu-artful-kernel.git] / tools / lib / api / Makefile
1 include ../../scripts/Makefile.include
2 include ../../scripts/utilities.mak # QUIET_CLEAN
3
4 ifeq ($(srctree),)
5 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
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 LD = $(CROSS_COMPILE)ld
14
15 MAKEFLAGS += --no-print-directory
16
17 LIBFILE = $(OUTPUT)libapi.a
18
19 CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
20 CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
21
22 ifeq ($(CC), clang)
23 CFLAGS += -O3
24 else
25 CFLAGS += -O6
26 endif
27
28 # Treat warnings as errors unless directed not to
29 ifneq ($(WERROR),0)
30 CFLAGS += -Werror
31 endif
32
33 CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
34 CFLAGS += -I$(srctree)/tools/lib/api
35 CFLAGS += -I$(srctree)/tools/include
36
37 RM = rm -f
38
39 API_IN := $(OUTPUT)libapi-in.o
40
41 all:
42
43 export srctree OUTPUT CC LD CFLAGS V
44 include $(srctree)/tools/build/Makefile.include
45
46 all: fixdep $(LIBFILE)
47
48 $(API_IN): FORCE
49 @$(MAKE) $(build)=libapi
50
51 $(LIBFILE): $(API_IN)
52 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
53
54 clean:
55 $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
56 find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
57
58 FORCE:
59
60 .PHONY: clean FORCE