]> rtime.felk.cvut.cz Git - jailhouse.git/blobdiff - Makefile
arm: Rename reg parameter of handle_irq_target to irq
[jailhouse.git] / Makefile
index d7beede4828afaf9effe2063a560db503a938565..6d597af281d4a74c91e59cb38aa9ebe63464f382 100644 (file)
--- a/Makefile
+++ b/Makefile
 # the COPYING file in the top-level directory.
 #
 
-firmwaredir ?= /lib/firmware
-
-# all directories listed here will be created using a generic rule below
-INSTALL_DIRECTORIES := $(DESTDIR)$(firmwaredir)
-
-INSTALL      ?= install
-INSTALL_DATA ?= $(INSTALL) -m 644
-INSTALL_DIR  ?= $(INSTALL) -d -m 755
+# Check make version
+need := 3.82
+ifneq ($(need),$(firstword $(sort $(MAKE_VERSION) $(need))))
+$(error Too old make version $(MAKE_VERSION), at least $(need) required)
+endif
 
 # no recipes above this one (also no includes)
 all: modules tools
 
+# includes installation-related variables and definitions
+include scripts/include.mk
+
 # out-of-tree build for our kernel-module, firmware and inmates
 KDIR ?= /lib/modules/`uname -r`/build
 
-define run-kbuild =
-       $(MAKE) -C $(KDIR) M=$$PWD $@
-endef
+INSTALL_MOD_PATH ?= $(DESTDIR)
+export INSTALL_MOD_PATH
 
-modules:
-       $(run-kbuild)
+DOXYGEN ?= doxygen
 
-hypervisor/jailhouse.bin: modules
+kbuild = -C $(KDIR) M=$$PWD $@
+
+modules:
+       $(Q)$(MAKE) $(kbuild)
 
 # recursive build of tools
 tools:
-       $(MAKE) -C tools
+       $(Q)$(MAKE) -C tools
 
-# clean up kernel and tools
-clean:
-       $(run-kbuild)
-       $(MAKE) -C tools $@
+# documentation, build needs to be triggered explicitly
+docs:
+       $(DOXYGEN) Documentation/Doxyfile
 
-# create all necessary install-directories
-$(INSTALL_DIRECTORIES):
-       $(INSTALL_DIR) $@
+# remove generated docs
+docs_clean:
+       rm -rf Documentation/generated
+
+# clean up kernel, tools and generated docs
+clean: docs_clean
+       $(Q)$(MAKE) $(kbuild)
+       $(Q)$(MAKE) -C tools $@
 
 modules_install: modules
-       $(run-kbuild)
-       depmod -aq
+       $(Q)$(MAKE) $(kbuild)
+
+firmware_install: $(DESTDIR)$(firmwaredir) modules
+       $(INSTALL_DATA) hypervisor/jailhouse*.bin $<
 
-firmware_install: hypervisor/jailhouse.bin $(DESTDIR)$(firmwaredir)
-       $(INSTALL_DATA) $(filter-out $(lastword $^),$^) $(lastword $^)
+ifeq ($(ARCH),x86)
+TOOL_INMATES_INSTALL := tool_inmates_install
+tool_inmates_install: $(DESTDIR)$(libexecdir)/jailhouse
+       $(INSTALL_DATA) inmates/tools/$(ARCH)/*.bin $<
+endif
 
-install: modules_install firmware_install
-       $(MAKE) -C tools $@
+install: modules_install firmware_install $(TOOL_INMATES_INSTALL)
+       $(Q)$(MAKE) -C tools $@
 
-.PHONY: modules_install install clean firmware_install modules tools
+.PHONY: modules_install install clean firmware_install modules tools docs \
+       docs_clean