]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
tooling: split Kbuild-related rules from the main Makefile
authorBenjamin Block <bebl@mageta.org>
Wed, 3 Sep 2014 12:53:15 +0000 (14:53 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Mon, 8 Sep 2014 11:22:00 +0000 (13:22 +0200)
Split all parts of the main Makefile, that are only related to the
kernel build-system, into their own file (Kbuild). When invokes, this
file will be search first for additional rules by the kernel
build-system.

The remaining rules in our own root-Makefile will not be seen by the
kernel build-system anymore and thus are easier to extend.

Also, change some variable-names to fit those suggested by the
kernel-documentation (Documentation/kbuild/modules.txt).

Signed-off-by: Benjamin Block <bebl@mageta.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Kbuild [new file with mode: 0644]
Makefile

diff --git a/Kbuild b/Kbuild
new file mode 100644 (file)
index 0000000..9563aaa
--- /dev/null
+++ b/Kbuild
@@ -0,0 +1,32 @@
+#
+# Jailhouse, a Linux-based partitioning hypervisor
+#
+# Copyright (c) Siemens AG, 2013, 2014
+#
+# Authors:
+#  Jan Kiszka <jan.kiszka@siemens.com>
+#  Banjmin 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.
+#
+
+subdir-y := hypervisor configs inmates
+
+obj-m := jailhouse.o
+
+ccflags-y := -I$(src)/hypervisor/arch/$(SRCARCH)/include \
+            -I$(src)/hypervisor/include
+
+jailhouse-y := driver.o
+
+define filechk_version
+       $(src)/scripts/gen_version_h $(src)
+endef
+
+clean-files := jailhouse-version.h
+
+$(obj)/jailhouse-version.h: $(src)/Makefile FORCE
+       $(call filechk,version)
+
+$(obj)/driver.o: $(obj)/jailhouse-version.h
index 629fabe73b1eaaad9eedf142e1e0e6e9ff68c9a9..c0e63f4c41d9fbdcad5b260a974426edd12fd0b3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 #
 # Jailhouse, a Linux-based partitioning hypervisor
 #
-# Copyright (c) Siemens AG, 2013
+# Copyright (c) Siemens AG, 2013, 2014
 #
 # Authors:
 #  Jan Kiszka <jan.kiszka@siemens.com>
 # the COPYING file in the top-level directory.
 #
 
-subdir-y := hypervisor configs inmates
-
-obj-m := jailhouse.o
-
-ccflags-y := -I$(src)/hypervisor/arch/$(SRCARCH)/include \
-            -I$(src)/hypervisor/include
-
-jailhouse-y := driver.o
-
-define filechk_version
-       $(src)/scripts/gen_version_h $(src)
-endef
-
-clean-files := jailhouse-version.h
+all: modules
 
 # out-of-tree build
-
-KERNELDIR = /lib/modules/`uname -r`/build
+KDIR ?= /lib/modules/`uname -r`/build
 
 modules modules_install clean:
-       $(MAKE) -C $(KERNELDIR) SUBDIRS=`pwd` $@
+       $(MAKE) -C $(KDIR) M=$$PWD $@
 
-$(obj)/jailhouse-version.h: $(src)/Makefile FORCE
-       $(call filechk,version)
+modules_install: modules
 
-$(obj)/driver.o: $(obj)/jailhouse-version.h
+hypervisor/jailhouse.bin: modules
 
-firmware_install:
-       cp hypervisor/jailhouse.bin /lib/firmware/
+firmware_install: hypervisor/jailhouse.bin
+       cp $< /lib/firmware/
 
 install: modules_install firmware_install
        depmod -aq
 
-.PHONY: modules_install install clean firmware_install
+.PHONY: modules_install install clean firmware_install modules