forked from siemens/jailhouse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKbuild
60 lines (45 loc) · 1.47 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
#
# Jailhouse, a Linux-based partitioning hypervisor
#
# Copyright (c) Siemens AG, 2013-2017
#
# Authors:
# Jan Kiszka <jan.kiszka@siemens.com>
# Benjamin Block <bebl@mageta.org>
#
# 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)/hypervisor/include/jailhouse/config.h
export INC_CONFIG_H
define sed_config_mk
"/^#define \([^[:space:]]*\)[[:space:]]*1/!d; \
s/^#define \([^[:space:]]*\)[[:space:]]*1/\1=y\nexport \1/"
endef
define filechk_config_mk
( \
echo "\$$(foreach config,\$$(filter CONFIG_%, \
\$$(.VARIABLES)), \$$(eval undefine \$$(config)))"; \
if [ -f $(INC_CONFIG_H) ]; then \
sed -e $(sed_config_mk) $(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)
# Do not generate files by creating dependencies if we are cleaning up
ifeq ($(filter %/Makefile.clean,$(MAKEFILE_LIST)),)
$(obj)/hypervisor $(obj)/inmates: $(GEN_CONFIG_MK)
$(obj)/driver $(obj)/hypervisor: $(GEN_VERSION_H)
endif
subdir-y := driver hypervisor configs inmates tools
subdir-ccflags-y := -Werror
clean-dirs := Documentation/generated hypervisor/include/generated