summaryrefslogtreecommitdiff
path: root/kernel/Makefile
blob: a1cba71ddb92e5244ae4ee06c3525da39b3b259c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
KDIR ?= /lib/modules/$(shell uname -r)/build
PROJECTS_BUILD := $(abspath $(CURDIR)/../projects/linux-build)

ifeq ($(PROJECTS_BUILD),$(abspath $(KDIR)/../../../../..))

# Build in projects/linux-build, use a separated build tree.

O := $(abspath $(KDIR))
M := ../../../kernel
B := $(abspath $O/$M)

$(info *** Building in $B)

default all: modules

modules modules_install:
	mkdir -p $B
	ln -srTf include $B/include
	ln -srTf Kbuild $B/Kbuild
	$(MAKE) -C $(KDIR) O=$O M=$M $@

clean help kernelrelease:
	$(MAKE) -C $(KDIR) O=$O M=$M $@

bindeb-pkg:
	./builddeb -C $(KDIR) O=$O M=$M

else # ifeq ($(PROJECTS_BUILD),$(abspath $(KDIR)/../../../../..))

# Regular build, build here.
ifneq ($(KERNEL_SRC),)
# Compile Android external module in OUT directory
# KERNEL_SRC = Kernel path
$(info *** Building Android in $O/$M )

KDIR := $(KERNEL_SRC)

all:
	$(MAKE) -C $(KDIR) M=$(M) modules $(KBUILD_OPTIONS)

else # ifneq ($(KERNEL_SRC),)
M := $(CURDIR)
endif # ifneq ($(KERNEL_SRC),)

B := $(abspath $O/$M)

default:
	$(MAKE) -C $(KDIR) M=$(M)
modules modules_install clean help kernelrelease:
	$(MAKE) -C $(KDIR) M=$(M) $@

endif # ifeq ($(PROJECTS_BUILD),$(abspath $(KDIR)/../../../../..))

# Install generated dw3000.dtbo
dtbo_install: modules_install
	d=`echo $(INSTALL_MOD_PATH)/lib/modules/* | sed 's#lib/modules#boot/dtbs#'` && \
	mkdir -p $$d/overlays && \
	find $B -name '*.dtbo' -print -exec cp -v {} $$d/overlays \;

# Run kunit tests
tests:
	../tools/kunit/run $(KDIR)

# Run coverage
cov:
	../tools/kunit/run $(KDIR)