Makefile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. include src/Makefile.Host
  2. ifeq ($(OS),Linux)
  3. NPROCS ?= $(shell grep -c ^processor /proc/cpuinfo)
  4. else
  5. NPROCS ?= 1
  6. endif
  7. ifeq ($(OS),Linux)
  8. LINUX_GEN := 3.x
  9. LINUX_SRC := linux-3.19
  10. LINUX_KERNEL := $(LINUX_SRC)/arch/x86/boot/bzImage
  11. endif
  12. DIRS = src test regression
  13. all clean:
  14. for d in $(DIRS); \
  15. do \
  16. $(MAKE) -C $$d $@; \
  17. done
  18. .PHONY: linux-kernel
  19. linux-kernel: $(LINUX_KERNEL)
  20. ifneq ($(LINUX_KERNEL),)
  21. $(LINUX_KERNEL): $(LINUX_SRC)/Makefile $(LINUX_SRC)/graphene $(LINUX_SRC)/.config
  22. $(MAKE) -C $(LINUX_SRC) -j$(NPROCS)
  23. $(LINUX_SRC)/Makefile:
  24. [ -f $(LINUX_SRC).tar.gz ] || \
  25. wget https://www.kernel.org/pub/linux/kernel/v$(LINUX_GEN)/$(LINUX_SRC).tar.gz
  26. tar -xzf $(LINUX_SRC).tar.gz
  27. cd $(LINUX_SRC) && patch -p1 < ../$(LINUX_SRC).patch
  28. $(LINUX_SRC)/graphene: linux-kernel/graphene
  29. cd $(LINUX_SRC) && ln -s ../linux-kernel/graphene graphene
  30. $(LINUX_SRC)/.config: $(LINUX_SRC)/Makefile
  31. cd $(LINUX_SRC) && make menuconfig
  32. kernel_install: kernel
  33. $(MAKE) -C $(LINUX_SRC) install modules_install headers_install
  34. linux-deb:
  35. if [ ! -f $(LINUX_SRC)/.config ]; then \
  36. cp /boot/config-$(shell uname -r) $(LINUX_SRC)/.config && \
  37. cd $(LINUX_SRC) && $(MAKE) menuconfig; fi
  38. cd $(LINUX_SRC) && \
  39. CONCURRENCY_LEVEL=$(NPROCS) make-kpkg --rootcmd fakeroot \
  40. --append-to-version -graphene --initrd \
  41. kernel_image kernel_headers $(if $(DEBUG),kernel_debug,)
  42. else
  43. kernel_install:
  44. endif
  45. .PHONY: test
  46. test:
  47. $(MAKE) -C test test
  48. .PHONY: pack
  49. pack:
  50. $(MAKE) -C test pack
  51. $(MAKE) -C regression pack