forked from siemens/jailhouse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Kbuild
74 lines (54 loc) · 1.81 KB
/
Kbuild
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
67
68
69
70
71
72
73
74
#
# Jailhouse, a Linux-based partitioning hypervisor
#
# Copyright (c) Siemens AG, 2013-2017
#
# Authors:
# Jan Kiszka <[email protected]>
# Benjamin Block <[email protected]>
#
# This work is licensed under the terms of the GNU GPL, version 2. See
# the COPYING file in the top-level directory.
#
INC_CONFIG_H = $(src)/include/jailhouse/config.h
export INC_CONFIG_H
define filechk_config_mk
( \
echo "\$$(foreach config,\$$(filter CONFIG_%, \$$(.VARIABLES)), \
\$$(eval undefine \$$(config)))"; \
if [ -f $(INC_CONFIG_H) ]; then \
sed -e "/^#define \([^[:space:]]*\)[[:space:]]*1/!d; \
s/^#define \([^[:space:]]*\)[[:space:]]*1/\1=y/"\
$(INC_CONFIG_H); \
fi \
)
endef
GEN_CONFIG_MK := $(obj)/hypervisor/include/generated/config.mk
export GEN_CONFIG_MK
$(GEN_CONFIG_MK): $(src)/Makefile FORCE
$(call filechk,config_mk)
define filechk_version
$(src)/scripts/gen_version_h $(src)/
endef
GEN_VERSION_H := $(obj)/hypervisor/include/generated/version.h
$(GEN_VERSION_H): $(src)/Makefile FORCE
$(call filechk,version)
quiet_cmd_gen_pci_defs = GEN $@
define cmd_gen_pci_defs
$^ $(src)/include/jailhouse/pci_defs.h > $@
endef
GEN_PCI_DEFS_PY := $(obj)/pyjailhouse/pci_defs.py
$(GEN_PCI_DEFS_PY): $(src)/scripts/gen_pci_defs.sh
$(call if_changed,gen_pci_defs)
subdir-y := hypervisor configs inmates tools
subdir-ccflags-y := -Werror
obj-m := driver/
# Do not generate files by creating dependencies if we are cleaning up
ifeq ($(filter %/Makefile.clean,$(MAKEFILE_LIST)),)
$(obj)/driver $(addprefix $(obj)/,$(subdir-y)): $(GEN_CONFIG_MK)
$(obj)/driver $(obj)/hypervisor: $(GEN_VERSION_H)
$(obj)/tools: $(GEN_PCI_DEFS_PY)
endif
clean-files := pyjailhouse/*.pyc pyjailhouse/pci_defs.py
clean-dirs := Documentation/generated hypervisor/include/generated \
pyjailhouse/__pycache__