Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1include ../../scripts/Makefile.include
2include ../../scripts/utilities.mak # QUIET_CLEAN
3
4ifeq ($(srctree),)
5srctree := $(patsubst %/,%,$(dir $(CURDIR)))
6srctree := $(patsubst %/,%,$(dir $(srctree)))
7srctree := $(patsubst %/,%,$(dir $(srctree)))
8#$(info Determined 'srctree' to be $(srctree))
9endif
10
11CC = $(CROSS_COMPILE)gcc
12AR = $(CROSS_COMPILE)ar
13LD = $(CROSS_COMPILE)ld
14
15MAKEFLAGS += --no-print-directory
16
17LIBFILE = $(OUTPUT)libapi.a
18
19CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
20CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
21
22ifeq ($(CC), clang)
23 CFLAGS += -O3
24else
25 CFLAGS += -O6
26endif
27
28# Treat warnings as errors unless directed not to
29ifneq ($(WERROR),0)
30 CFLAGS += -Werror
31endif
32
33CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
34CFLAGS += -I$(srctree)/tools/lib/api
35CFLAGS += -I$(srctree)/tools/include
36
37RM = rm -f
38
39API_IN := $(OUTPUT)libapi-in.o
40
41all:
42
43export srctree OUTPUT CC LD CFLAGS V
44include $(srctree)/tools/build/Makefile.include
45
46all: 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
54clean:
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
58FORCE:
59
60.PHONY: clean FORCE